Пример #1
0
 public function __construct()
 {
     $this->table = 'erpip_zone';
     $this->className = 'ErpZone';
     $this->lang = false;
     $this->context = Context::getContext();
     if (_PS_VERSION_ < 1.6) {
         $this->no_link = true;
     } else {
         $this->list_no_link = true;
     }
     $this->addRowAction('view');
     $this->addRowAction('edit');
     $this->addRowAction('delete');
     // template path
     $this->template_path = _PS_MODULE_DIR_ . 'erpillicopresta/views/templates/admin/';
     $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selection'), 'confirm' => $this->l('Delete selected items?')));
     $this->is_1_6 = version_compare(_PS_VERSION_, '1.6') > 0;
     $this->_select = ' IFNULL(ez.name, \'' . $this->l('Home') . '\') as parent_name, w.name as warehouse_name, w.id_warehouse';
     $this->_join = 'LEFT JOIN `' . _DB_PREFIX_ . 'erpip_zone` as ez ON (ez.`id_erpip_zone` = a.`id_parent`)';
     $this->_join .= 'LEFT JOIN `' . _DB_PREFIX_ . 'warehouse` as w ON (w.`id_warehouse` = a.`id_warehouse`)';
     if (Tools::isSubmit('id_erpip_zone') && (int) Tools::getValue('id_erpip_zone') > 0 || Tools::isSubmit('id_parent') && (int) Tools::getValue('id_parent') > 0) {
         $id_erpip_zone = (int) Tools::getValue('id_erpip_zone') > 0 ? (int) Tools::getValue('id_erpip_zone') : (int) Tools::getValue('id_parent');
         $this->_where .= ' AND a.id_parent = ' . $id_erpip_zone;
         $this->toolbar_title = $this->l('1 Click ERP ILLICOPRESTA : ');
         $this->toolbar_title .= implode(' > ', array_reverse(ErpZone::getZoneBreadcrumbs($id_erpip_zone)));
     } else {
         $this->_where .= ' AND a.id_parent = 0';
         $this->toolbar_title = $this->l('1 Click ERP ILLICOPRESTA : Home zones');
     }
     $this->fields_list = array('id_erpip_zone' => array('title' => $this->l('ID'), 'width' => '30', 'remove_onclick' => true), 'name' => array('title' => $this->l('Zone name'), 'width' => 'auto', 'filter_key' => 'a!name', 'remove_onclick' => true), 'parent_name' => array('title' => $this->l('Parent zone'), 'width' => 'auto', 'search' => false, 'remove_onclick' => true), 'warehouse_name' => array('title' => $this->l('Warehouse'), 'width' => 'auto', 'filter_key' => 'w!name', 'remove_onclick' => true), 'active' => array('title' => $this->l('Enabled'), 'width' => 70, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'remove_onclick' => true));
     $this->context->smarty->assign(array('template_path' => $this->template_path, 'erp_feature' => ErpFeature::getFeaturesWithToken($this->context->language->iso_code)));
     // get controller status
     $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminAdvancedOrder'));
     parent::__construct();
 }