Fix import_key was erased after update

This commit is contained in:
Laurent Destailleur 2020-04-04 18:35:40 +02:00
parent c22a6ad98c
commit 9307e3821f
2 changed files with 8 additions and 3 deletions

View File

@ -206,7 +206,8 @@ class WebsitePage extends CommonObject
$sql .= " t.tms as date_modification,";
$sql .= " t.fk_user_creat,";
$sql .= " t.author_alias,";
$sql .= " t.fk_user_modif";
$sql .= " t.fk_user_modif,";
$sql .= " t.import_key";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
//$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level
$sql .= ' WHERE 1 = 1';
@ -265,6 +266,7 @@ class WebsitePage extends CommonObject
$this->fk_user_creat = $obj->fk_user_creat;
$this->author_alias = $obj->author_alias;
$this->fk_user_modif = $obj->fk_user_modif;
$this->import_key = $obj->import_key;
}
$this->db->free($resql);
@ -319,7 +321,8 @@ class WebsitePage extends CommonObject
$sql .= " t.tms as date_modification,";
$sql .= " t.fk_user_creat,";
$sql .= " t.author_alias,";
$sql .= " t.fk_user_modif";
$sql .= " t.fk_user_modif,";
$sql .= " t.import_key";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql .= ' WHERE t.fk_website = '.$websiteid;
// Manage filter
@ -374,6 +377,7 @@ class WebsitePage extends CommonObject
$record->fk_user_creat = $obj->fk_user_creat;
$record->author_alias = $obj->author_alias;
$record->fk_user_modif = $obj->fk_user_modif;
$record->import_key = $obj->import_key;
//var_dump($record->id);
$records[$record->id] = $record;
}
@ -560,6 +564,7 @@ class WebsitePage extends CommonObject
if ($istranslation) $object->fk_page = $fromid;
else $object->fk_page = 0;
if (!empty($newwebsite)) $object->fk_website = $newwebsite;
$object->import_key = '';
// Create clone
$object->context['createfromclone'] = 'createfromclone';

View File

@ -184,7 +184,7 @@ if ($mode == 'confirm' && ! $error) {
print $nbimported." page(s) imported with importid=".$importid."\n";
$db->commit();
} else {
print "Rollback\n";
print "Rollback (mode=test)\n";
$db->rollback();
}