* @copyright 2019 Dominik Wójcicki * International Registered Trademark & Property of FuenRob * */ if (!defined('_PS_VERSION_')) { exit; } class AddOrderExtraFields extends Module { public function __construct() { $this->name = 'AddOrderExtraFields'; $this->tab = 'administration'; $this->version = '1.0'; $this->author = 'Dominik Wójcicki'; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_); $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Dodatkowe pola w zamówieniu'); $this->description = $this->l('Moduł dodatkowych pól w zamówieniu dla Back Office'); $this->confirmUninstall = $this->l('Czy na pewno odinstalować moduł?'); /*if (!Configuration::get('AddOrderExtraFields')) $this->warning = $this->l('No name provided');*/ } public function install() { if (!parent::install()) { return false; } if (Module::isInstalled('modrefchange')) { copy(_PS_MODULE_DIR_ . $this->name . '/_overrides/classes/order/Order-modrefchange.php', _PS_ROOT_DIR_ . '/override/classes/order/Order.php'); } else { copy(_PS_MODULE_DIR_ . $this->name . '/_overrides/classes/order/Order.php', _PS_ROOT_DIR_ . '/override/classes/order/Order.php'); } $sql = 'SELECT order_source from ' . _DB_PREFIX_ . 'orders'; if ($results = Db::getInstance()->ExecuteS($sql)) { return true; } else { if (!Db::getInstance()->execute( 'ALTER TABLE ' . _DB_PREFIX_ . 'orders ADD `order_source` enum(\'Allegro\', \'Sklep int.\', \'Telefonicznie\') NULL DEFAULT' )); return true; } return true; } public function uninstall() { return parent::uninstall(); } }