* @copyright 2012-2019 Patryk Marek - PrestaDev.pl * @license License is for use in domain / or one multistore enviroment (do not modify or reuse this code or part of it) if you want any changes please contact with me at info@prestadev.pl * @link http://prestadev.pl * @package PD CSV Price update on products - PrestaShop 1.5.x and 1.6.x Module and 1.7.x Module * @version 1.0.3 * @date 20-02-2017 */ class HistoryCsvPriceUpdateModel extends ObjectModel { public $file_name = ''; public $products_csv; public $products_updated; public $products_attributes_updated; public $products_not_found; public $update_type; public $products_identifier; public $csv_header_ignore; public $sv_delimeter; public $same_csv_allow; public $date_add = '0000-00-00'; public $prices_with_tax; /** * @see ObjectModel::$definition */ public static $definition = array( 'table' => 'pdcsvpriceupdate_history', 'primary' => 'id_history_csv', 'multilang' => false, 'fields' => array( 'file_name' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'), 'products_updated' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), 'products_attributes_updated' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), 'products_csv' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), 'products_not_found' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), 'update_type' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), 'products_identifier' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), 'csv_delimeter' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'csv_header_ignore' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'same_csv_allow' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'prices_with_tax' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat'), ) ); public function __construct($id = null, $id_lang = null, $id_shop = null) { parent::__construct($id, $id_lang, $id_shop); } public function add($autodate = false, $null_values = false) { return parent::add($autodate, $null_values); } public function delete() { if ((int)$this->id === 0) { return false; } return parent::delete(); } public function update($null_values = false) { if ((int)$this->id === 0) { return false; } return parent::update($null_values); } /** * Creates tables */ public static function createTables() { return Db::getInstance()->execute(' CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'pdcsvpriceupdate_history` ( `id_history_csv` int(10) unsigned NOT NULL AUTO_INCREMENT, `file_name` varchar(255) NOT NULL, `csv_header_ignore` tinyint(1) DEFAULT 0, `same_csv_allow` tinyint(1) DEFAULT 0, `csv_delimeter` varchar(16) NOT NULL, `products_csv` int(10) unsigned NOT NULL, `products_updated` int(10) unsigned NOT NULL, `products_attributes_updated` int(10) unsigned NOT NULL, `products_not_found` int(10) unsigned NOT NULL, `update_type` int(10) unsigned NOT NULL, `products_identifier` int(10) unsigned NOT NULL, `prices_with_tax` tinyint(1) DEFAULT 0, `date_add` date, PRIMARY KEY (`id_history_csv`) ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=UTF8; '); } public static function dropTables() { $sql = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'pdcsvpriceupdate_history`'; return Db::getInstance()->execute($sql); } }