From 9307e3821f76ea63f1317ab2c16c5765a080c869 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Apr 2020 18:35:40 +0200 Subject: [PATCH] Fix import_key was erased after update --- htdocs/website/class/websitepage.class.php | 9 +++++++-- scripts/website/migrate-news-joomla2dolibarr.php | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 7d1f345d8c2..03d52c5ce77 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -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'; diff --git a/scripts/website/migrate-news-joomla2dolibarr.php b/scripts/website/migrate-news-joomla2dolibarr.php index 2d4e8befbcc..0c03acf53ef 100755 --- a/scripts/website/migrate-news-joomla2dolibarr.php +++ b/scripts/website/migrate-news-joomla2dolibarr.php @@ -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(); }