getValue(' SELECT `id_customer` FROM `ps_customer` WHERE `id_erp` = ' . (int) $id_customer_erp ); } public static function productAlreadyExists ($id_product_erp) { return (boolean) Db::getInstance()->getValue(' SELECT `id_product` FROM `ps_product` WHERE `id_erp` = ' . (int) $id_product_erp ); } public static function getCountryIdForPresta($id_country_odoo) { /** * Association country Odoo - Prestashop */ $assoc_country = array( 76 => 8, // France 21 => 3, // Belgique 44 => 19, // Suisse 114 => 11, // Japon 137 => 152, // Maroc 13 => 2, // Autriche 134 => 12, // Luxembourg 233 => 17, // Royaume-uni 185 => 15, // Portugal 189 => 176, // Ile de la réunion 161 => 158, // Nouvelle Calédonie 248 => 144, // Mayotte 189 => 176, // Réunion 95 => 22, // Hong-Kong 49 => 5 // China ); if (!empty($assoc_country[$id_country_odoo])) { return $assoc_country[$id_country_odoo]; } else { return 8; } } public static function validateRecordCustomer($record) { if (empty($record['city'])) { return false; } if (empty($record['street'])) { return false; } if (empty($record['zip'])) { return false; } if (empty($record['phone'])) { return false; } if(!Validate::isPhoneNumber($record['phone'])) { return false; } return true; } public static function logError($record, $type = 'unknown') { return true; Db::getInstance()->execute(' INSERT INTO `ps_erp_log` (`data`, `type`, `date_add`) VALUES ( \''.pSQL(json_encode($record)).'\', "'.pSQL($type).'", NOW() )' ); return true; } }