From 36fcfe8d98f01e37fe49aec951fe22607bc3a705 Mon Sep 17 00:00:00 2001 From: mDeflotte Date: Mon, 2 Jul 2012 15:00:32 +0000 Subject: [PATCH] [-] BO : #PSCFV-2956 - Fix bug on creating carriers --- classes/Carrier.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/classes/Carrier.php b/classes/Carrier.php index 9a10881c6..9de4bd220 100644 --- a/classes/Carrier.php +++ b/classes/Carrier.php @@ -183,11 +183,9 @@ class CarrierCore extends ObjectModel $this->position = Carrier::getHigherPosition() + 1; if (!parent::add($autodate, $null_values) || !Validate::isLoadedObject($this)) return false; - if (!Db::getInstance()->executeS('SELECT `id_carrier` FROM `'._DB_PREFIX_.$this->def['table'].'` WHERE `deleted` = 0')) + if (!$count = Db::getInstance()->getValue('SELECT count(`id_carrier`) FROM `'._DB_PREFIX_.$this->def['table'].'` WHERE `deleted` = 0')) return false; - if (!$num_rows = Db::getInstance()->NumRows()) - return false; - if ((int)$num_rows == 1) + if ($count == 1) Configuration::updateValue('PS_CARRIER_DEFAULT', (int)$this->id); // Register reference