Example #1
0
 public function add($autodate = true, $nullValues = false)
 {
     if (_PS_VERSION_ >= '1.5') {
         return parent::add($autodate, $nullValues);
     }
     if (!parent::add($autodate, $nullValues)) {
         return false;
     }
     include_once dirname(__FILE__) . "/../../modules/agilemultipleseller/agilemultipleseller.php";
     $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'carrier_owner` (id_owner,id_carrier,is_default) values(' . intval(Tools::getValue('id_seller')) . ',' . $this->id . ',' . intval(Tools::getValue('is_default')) . ')';
     Db::getInstance()->Execute($sql);
     return true;
 }
Example #2
0
	public function add($autodate = true, $null_values = false)
	{
		if ($this->position <= 0)
			$this->position = Carrier::getHigherPosition() + 1;
		if (!parent::add($autodate, $null_values) || !Validate::isLoadedObject($this))
			return false;
		if (!$count = Db::getInstance()->getValue('SELECT count(`id_carrier`) FROM `'._DB_PREFIX_.$this->def['table'].'` WHERE `deleted` = 0'))
			return false;
		if ($count == 1)
			Configuration::updateValue('PS_CARRIER_DEFAULT', (int)$this->id);

		// Register reference
		Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.$this->def['table'].'` SET `id_reference` = '.$this->id.' WHERE `id_carrier` = '.$this->id);

		return true;
	}