'gls_log', 'primary' => 'id_gls_log', 'fields' => array( 'id_shop_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'message' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 16777216), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), ) ); public static function createDbTable() { return Db::getInstance()->Execute('CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'gls_log` ( `id_gls_log` int(10) unsigned NOT NULL AUTO_INCREMENT, `id_shop_group` int(11) UNSIGNED NOT NULL DEFAULT \'1\', `id_shop` int(11) UNSIGNED NOT NULL DEFAULT \'1\', `id_employee` int(10) UNSIGNED DEFAULT NULL, `message` text NOT NULL, `date_add` datetime NOT NULL, PRIMARY KEY (`id_gls_log`), KEY `id_shop_group` (`id_shop_group`), KEY `id_shop` (`id_shop`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'); } public static function removeDbTable() { return Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'gls_log`'); } public function log($message, $autoDate = true, $nullValues = false) { if (!empty($message)) { $this->message = $message; $this->id_shop = ($this->id_shop) ? $this->id_shop : Context::getContext()->shop->id; $this->id_shop_group = ($this->id_shop_group) ? $this->id_shop_group : Context::getContext()->shop->id_shop_group; $this->id_employee = ($this->id_employee) ? $this->id_employee : Context::getContext()->employee->id; $return = parent::add($autoDate, $nullValues); return $return; } } }