From 8479ef58eef4bf885142d6660504be1316f973fa Mon Sep 17 00:00:00 2001 From: dMetzger Date: Wed, 8 Aug 2012 09:23:31 +0000 Subject: [PATCH] [-] Installer : fixed errors at the installation with insertion of null values in the database #PSCFV-3544 git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16758 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/ObjectModel.php | 4 ++-- classes/db/Db.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index c6a57369f..d7a96b321 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -270,7 +270,7 @@ abstract class ObjectModelCore $fields = array_merge($fields, $this->getFieldsShop()); // Ensure that we get something to insert - if (!$fields) + if (!$fields && $this->id) $fields[$this->def['primary']] = $this->id; return $fields; } @@ -286,7 +286,7 @@ abstract class ObjectModelCore public function getFieldsShop() { $fields = $this->formatFields(self::FORMAT_SHOP); - if (!$fields) + if (!$fields && $this->id) $fields[$this->def['primary']] = $this->id; return $fields; } diff --git a/classes/db/Db.php b/classes/db/Db.php index 4b460af11..49cf11ee9 100644 --- a/classes/db/Db.php +++ b/classes/db/Db.php @@ -322,7 +322,7 @@ abstract class DbCore */ public function insert($table, $data, $null_values = false, $use_cache = true, $type = Db::INSERT, $add_prefix = true) { - if (!$data) + if (!$data && !$null_values) return true; if ($add_prefix)