
Originally Posted by
lat9
Thanks for the detailed report (I appreciate it). I'll give this a deeper look later today.
Days are getting long down here in Florida. I've got a correction staged on GitHub for the v1.6.3 release of DbIo.
Find this method in /admin/includes/classes/dbio/DbIoProductsAttribsRawHandler.php:
Code:
protected function importUpdateRecordKey($table_name, $table_fields, $record_key_value)
{
$proceed_with_update = true;
if ($table_name == TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD) {
if (empty($table_fields['products_attributes_filename']['value'])) {
$proceed_with_update = false;
// -----
// If the current DbIo operation is an import-check, simply output a debug message containing
// the record-deletion SQL. Otherwise, actually run the SQL, removing that record.
//
$sql =
"DELETE FROM " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " WHERE products_attributes_id = " . $this->key_fields['products_attributes_id'] . " LIMIT 1";
if ($this->operation == 'check') {
$this->debugMessage("importUpdateRecordKey, removing record: $sql", self::DBIO_STATUS);
} else {
$GLOBALS['db']->Execute($sql);
}
} elseif ($this->import_is_insert) {
$table_fields['products_attributes_id'] = array(
'value' => $record_key_value,
'type' => 'integer',
);
}
}
return ($proceed_with_update) ? $table_fields : false;
}
... and add the highlighted clause:
Code:
protected function importUpdateRecordKey($table_name, $table_fields, $record_key_value)
{
$proceed_with_update = true;
if ($table_name == TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD) {
if (!$this->import_is_insert && empty($table_fields['products_attributes_filename']['value'])) {
$proceed_with_update = false;
// -----
// If the current DbIo operation is an import-check, simply output a debug message containing
// the record-deletion SQL. Otherwise, actually run the SQL, removing that record.
//
$sql =
"DELETE FROM " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " WHERE products_attributes_id = " . $this->key_fields['products_attributes_id'] . " LIMIT 1";
if ($this->operation == 'check') {
$this->debugMessage("importUpdateRecordKey, removing record: $sql", self::DBIO_STATUS);
} else {
$GLOBALS['db']->Execute($sql);
}
} elseif ($this->import_is_insert) {
$table_fields['products_attributes_id'] = array(
'value' => $record_key_value,
'type' => 'integer',
);
}
}
return ($proceed_with_update) ? $table_fields : false;
}
Bookmarks