public function __construct()
 {
     $this->bootstrap = true;
     $this->table = 'order';
     $this->className = 'Order';
     $this->lang = false;
     $this->addRowAction('view');
     $this->context = Context::getContext();
     $this->list_no_link = true;
     $this->is_1_6 = version_compare(_PS_VERSION_, '1.6') > 0;
     // status à appliquer
     $this->generate_order_state = Configuration::get('ERP_GENERATE_ORDER_STATE');
     $this->generate_order_state_to = Configuration::get('ERP_GENERATE_ORDER_STATE_TO');
     // template path
     $this->template_path = _PS_MODULE_DIR_ . 'erpillicopresta/views/templates/admin/';
     $this->override_folder = $this->template_path;
     // build query
     $this->_select = 'a.id_order as checkbox,a.id_order as action, CONCAT(c.`firstname`, \' \', c.`lastname`) AS `customer`, c.`email`';
     $this->_where = 'AND a.current_state = ' . (int) $this->generate_order_state;
     $this->_join = 'LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = a.`id_customer`) ';
     $this->_orderBy = 'id_order';
     $this->_orderWay = 'DESC';
     $this->fields_list = array('checkbox' => array('title' => $this->l('Choice'), 'align' => 'center', 'width' => 25, 'havingFilter' => 'false', 'orderby' => false, 'search' => false, 'callback' => 'isOrderSelected'), 'id_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'customer' => array('title' => $this->l('Customer name'), 'havingFilter' => true), 'email' => array('title' => $this->l('Email'), 'havingFilter' => true), 'total_products' => array('title' => $this->l('Total TE without shipping'), 'align' => 'right', 'prefix' => '<b>', 'suffix' => '</b>', 'type' => 'price', 'currency' => true), 'total_shipping_tax_incl' => array('title' => $this->l('Shipping'), 'align' => 'right', 'prefix' => '<b>', 'suffix' => '</b>', 'type' => 'price', 'currency' => true));
     parent::__construct();
     $this->toolbar_title = $this->l('1 Click ERP ILLICOPRESTA');
     require_once _PS_MODULE_DIR_ . 'erpillicopresta/models/ErpFeature.php';
     // send var to template
     $this->context->smarty->assign(array('erp_feature' => ErpFeature::getFeaturesWithToken($this->context->language->iso_code)));
     // get controller status
     $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminAdvancedOrder'));
 }
 public function __construct()
 {
     // get controller status
     $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminAdvancedOrder'));
     parent::__construct();
     $this->bootstrap = true;
     // Base columns
     $this->baseColumns = array('ids' => array('title' => $this->l('#'), 'width' => 20, 'search' => false, 'class' => 'ids'), 'EAN' => array('title' => 'EAN', 'width' => 100, 'search' => false, 'havingFilter' => true), 'name' => array('title' => $this->l('Name'), 'align' => 'left', 'width' => 200, 'search' => false, 'havingFilter' => true), 'physical_quantity' => array('title' => $this->l('Physical quantity'), 'width' => 50, 'align' => 'center', 'search' => false, 'class' => 'physical_quantity text-center'), 'usable_quantity' => array('title' => $this->l('Usable quantity'), 'width' => 50, 'align' => 'center', 'search' => false, 'class' => 'usable_quantity text-center'));
     // template path
     $this->template_path = _PS_MODULE_DIR_ . 'erpillicopresta/views/templates/admin/';
     $this->toolbar_title = $this->l('1 Click ERP ILLICOPRESTA');
     $this->is_1_6 = version_compare(_PS_VERSION_, '1.6') > 0;
     $this->context->smarty->assign(array('transfers' => ''));
     // message to downloas file after transfer
     if (Tools::isSubmit('validate_transfer') && (Tools::isSubmit('ids_mvt') || Tools::isSubmit('ids_mvt_csv'))) {
         $link = new Link();
         $link = $link->getAdminLink("AdminStockTransfer", true);
         if (Tools::isSubmit('ids_mvt')) {
             $ids_mvt = Tools::getValue('ids_mvt');
             if (!empty($ids_mvt)) {
                 $url_get_pdf = $link . '&action=generateTransferPDF&ids_mvt=' . $ids_mvt;
                 $url_get_pdf .= '&stockA=' . Tools::getValue('id_warehouse_src') . '&stockB=' . Tools::getValue('id_warehouse_dst');
                 $this->confirmations[] = $this->l('The stock has been transferred successfully.') . '' . '<br/>&nbsp;<a href="' . $url_get_pdf . '">' . '<b>' . $this->l('Download PDF transfer') . '</b></a>';
             }
         }
         if (Tools::isSubmit('ids_mvt_csv')) {
             $ids_mvt_csv = Tools::getValue('ids_mvt_csv');
             $url_get_csv = $link . '&get_csv_transfer&ids_mvt_csv=' . $ids_mvt_csv;
             $url_get_csv .= '&id_warehouse_src=' . Tools::getValue('id_warehouse_src') . '&id_warehouse_dst=' . Tools::getValue('id_warehouse_dst');
             if (!empty($ids_mvt_csv)) {
                 $this->confirmations[] = '<br />&nbsp;<a target="_blank" href="' . $url_get_csv . '" alt="csv_file"><b>' . $this->l('Download CSV transfer') . '</b></a>';
             }
         }
     }
 }
 public function __construct()
 {
     $this->bootstrap = true;
     $this->table = 'erpip_inventory_product';
     $this->className = 'InventoryProduct';
     $this->list_no_link = true;
     $this->id_container = Tools::isSubmit('id_container') ? Tools::getValue('id_container') : (int) ErpInventory::getFirstId();
     // template path
     $this->template_path = _PS_MODULE_DIR_ . 'erpillicopresta/views/templates/admin/';
     $this->toolbar_title = $this->l('1 Click ERP ILLICOPRESTA');
     $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminAdvancedStock'));
     parent::__construct();
     $this->fields_list = array('warehouse' => array('title' => $this->l('Warehouse')), 'id_product' => array('title' => $this->l('Id product')), 'id_product_attribute' => array('title' => $this->l('Id product attribute')), 'reference' => array('title' => $this->l('SKU')), 'first_supplier_ref' => array('title' => $this->l('Supplier references'), 'search' => false), 'product_name' => array('title' => $this->l('product name'), 'search' => false), 'qte_before' => array('title' => $this->l('Quantity before inventory')), 'qte_after' => array('title' => $this->l('Quantity after inventory')), 'reason' => array('title' => $this->l('Movement reason'), 'filter_key' => 'smrl!name'), 'gap' => array('title' => $this->l('Stock Gap'), 'search' => false));
 }
 public function __construct()
 {
     $this->bootstrap = true;
     $this->table = 'product';
     $this->className = 'Product';
     $this->list_no_link = true;
     // template path
     $this->template_path = _PS_MODULE_DIR_ . 'erpillicopresta/views/templates/admin/';
     parent::__construct();
     // Get the stock manager type and send it to template
     $this->advanced_stock_management = $this->tpl_list_vars['advanced_stock_management'] = Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT');
     // get controller status
     $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminInventory'));
     $this->advanced_stock_token = Tools::getAdminToken('AdminAdvancedStock' . (int) Tab::getIdFromClassName('AdminAdvancedStock') . (int) $this->context->employee->id);
     $this->product_token = Tools::getAdminToken('AdminProducts' . (int) Tab::getIdFromClassName('AdminProducts') . (int) $this->context->employee->id);
     $this->mvt_stock_reason = ErpStockMvtReason::getStockMvtReasons((int) $this->context->language->id);
     $this->toolbar_title = $this->l('1 Click ERP ILLICOPRESTA');
     // JMA
     // Record get variables cookies id_warehouse, areaFilter and subareaFilter for Ajax
     if (!Tools::isSubmit('ajax')) {
         $this->setCookie('id_warehouse', Tools::isSubmit('id_warehouse') ? Tools::getValue('id_warehouse') : self::getFirstWarehouse());
         $this->setCookie('areaFilter', Tools::getValue('areaFilter'));
         $this->setCookie('subareaFilter', Tools::getValue('subareaFilter'));
     }
     // Buidl product array
     $global = array('id_product' => array('title' => 'ID', 'width' => 10, 'search' => false, 'class' => 'id_product'), 'picture' => array('title' => $this->l('Picture'), 'align' => 'center', 'image' => 'p', 'width' => 70, 'orderby' => false, 'filter' => false, 'search' => false), 'category_name' => array('title' => $this->l('Category'), 'search' => false, 'callback' => 'renderCategoryNameColumn'), 'reference' => array('title' => $this->l('SKU'), 'search' => false), 'first_supplier_ref' => array('title' => $this->l('Supplier reference'), 'search' => false, 'callback' => 'renderFirstSupplierRefColumn'), 'product_name' => array('title' => $this->l('Label'), 'search' => false, 'callback' => 'renderNameColumn'));
     // if advanced stock manager is inactif, only show the usable quantity in shop
     if (!$this->advanced_stock_management) {
         $quantity = array('quantity' => array('title' => $this->l('Quantity'), 'width' => 50, 'search' => false, 'class' => 'quantity', 'orderby' => false));
         $global = array_merge((array) $global, (array) $quantity);
     } else {
         $quantity = array('physical_quantity' => array('title' => $this->l('Physical quantity'), 'width' => 50, 'search' => false, 'class' => 'physical_quantity', 'orderby' => false), 'location' => array('title' => $this->l('Location'), 'width' => 200, 'search' => false, 'orderby' => false, 'callback' => 'renderLocationColumn'));
         $global = array_merge((array) $global, (array) $quantity);
     }
     $edit = array('mvt_reason' => array('title' => $this->l('Movement reason'), 'width' => 50, 'search' => false, 'orderby' => false, 'callback' => 'renderMvtReasonColumn'), 'new_quantity' => array('title' => $this->l('Found quantity'), 'width' => 50, 'hint' => $this->l('What you actually have'), 'search' => false, 'orderby' => false, 'callback' => 'renderColumnNewQuantity'));
     $this->fields_list = array_merge((array) $global, (array) $edit);
     // if we already have inventory values recorded, send them (pagination & filters)
     if (Tools::isSubmit('inventory_values') && Tools::getValue('inventory_values') != '') {
         $this->context->smarty->assign(array('inventory_values' => Tools::getValue('inventory_values')));
     } else {
         $this->context->smarty->assign(array('inventory_values' => ''));
     }
     // if we get stock gap values already recorded, send them (pagination & filters)
     if (Tools::isSubmit('gap_values') && Tools::getValue('gap_values') != '') {
         $this->context->smarty->assign(array('gap_values' => Tools::getValue('gap_values')));
     } else {
         $this->context->smarty->assign(array('gap_values' => ''));
     }
 }
 public function __construct()
 {
     parent::__construct();
     $this->bootstrap = true;
     // template path
     $this->template_path = _PS_MODULE_DIR_ . 'erpillicopresta/views/templates/admin/';
     $this->is_1_6 = version_compare(_PS_VERSION_, '1.6') > 0;
     // Get the type of active stock management and send to tpl
     $this->advanced_stock_management = Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT');
     // get controller status
     $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminAdvancedStock'));
     $this->product_token = Tools::getAdminToken('AdminProducts' . (int) Tab::getIdFromClassName('AdminProducts') . (int) $this->context->employee->id);
     $this->erp_zone_token = Tools::getAdminToken('AdminErpZone' . (int) Tab::getIdFromClassName('AdminErpZone') . (int) $this->context->employee->id);
     // get controller status
     $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminAdvancedOrder'));
 }
 public function __construct()
 {
     $this->table = 'supplier';
     $this->className = 'Supplier';
     $this->addRowAction('view');
     $this->addRowAction('edit');
     $this->addRowAction('delete');
     $this->allow_export = true;
     // template path for avdanced supply ordr
     $this->template_path = _PS_MODULE_DIR_ . 'erpillicopresta/views/templates/admin/';
     $this->toolbar_title = $this->l('1 Click ERP ILLICOPRESTA');
     $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selection'), 'confirm' => $this->l('Delete selected items?')));
     $this->_select = 'COUNT(DISTINCT ps.`id_product`) AS products, email';
     $this->_join = 'LEFT JOIN `' . _DB_PREFIX_ . 'product_supplier` ps ON (a.`id_supplier` = ps.`id_supplier`)';
     $this->_join .= 'LEFT JOIN `' . _DB_PREFIX_ . 'erpip_supplier` es ON (a.`id_supplier` = es.`id_supplier`)';
     $this->_group = 'GROUP BY a.`id_supplier`';
     $this->fieldImageSettings = array('name' => 'logo', 'dir' => 'su');
     $this->fields_list = array('id_supplier' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'logo' => array('title' => $this->l('Logo'), 'width' => 150, 'align' => 'center', 'image' => 'su', 'orderby' => false, 'search' => false), 'name' => array('title' => $this->l('Name'), 'width' => 'auto'), 'email' => array('title' => $this->l('Email'), 'width' => 'auto'), 'products' => array('title' => $this->l('Number of products'), 'width' => 70, 'align' => 'right', 'filter_type' => 'int', 'tmpTableFilter' => true), 'active' => array('title' => $this->l('Enabled'), 'width' => 70, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false));
     // get controller status
     $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminAdvancedOrder'));
     parent::__construct();
 }
 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();
 }
    public function __construct()
    {
        $this->table = 'order';
        $this->className = 'Order';
        $this->lang = false;
        $this->addRowAction('view');
        $this->explicitSelect = true;
        $this->allow_export = true;
        $this->deleted = false;
        $this->context = Context::getContext();
        $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminAdvancedOrder'));
        $this->bulk_actions = array('-' => array('text' => $this->l('-')));
        // template path
        $this->template_path = _PS_MODULE_DIR_ . 'erpillicopresta/views/templates/admin/';
        $this->toolbar_title = $this->l('1 Click ERP ILLICOPRESTA');
        $this->_select = '
		a.id_currency,
		a.id_order AS id_pdf,
		a.id_order AS quickView,
		CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
		osl.`name` AS `osname`,
		os.`color`,
		IF((SELECT COUNT(so.id_order) FROM `' . _DB_PREFIX_ . 'orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new ';
        // additional select
        $this->_select .= '
		, ca.id_carrier as carrier_id,
		SUM(d.product_weight * d.product_quantity) as poid, a.id_order as document,
		GROUP_CONCAT(d.product_id, "-",d.product_attribute_id, "-", d.product_quantity, "-", a.id_order SEPARATOR " ") as stock ';
        $this->_join = '
		LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = a.`id_customer`)
		LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON (os.`id_order_state` = a.`current_state`)
		LEFT JOIN `' . _DB_PREFIX_ . 'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state`
		AND osl.`id_lang` = ' . (int) $this->context->language->id . ')';
        // additional join
        $this->_join .= '
		LEFT JOIN `' . _DB_PREFIX_ . 'carrier` ca ON (ca.`id_carrier` = a.`id_carrier`)
		LEFT JOIN `' . _DB_PREFIX_ . 'order_detail` d ON ( d.`id_order` = a.`id_order`)';
        $this->_group = 'GROUP BY a.id_order';
        $this->_orderBy = 'id_order';
        $this->_orderWay = 'DESC';
        $statuses_array = array();
        $statuses = ErpOrderState::getOrderStates((int) $this->context->language->id);
        foreach ($statuses as $status) {
            $statuses_array[$status['id_order_state']] = $status['name'];
        }
        // get carrier list
        $carrier_array = $this->getListCarrier();
        if (_PS_VERSION_ < 1.6) {
            $this->no_link = true;
        } else {
            $this->list_no_link = true;
        }
        $this->fields_list = array('quickView' => array('title' => $this->l('Quick View'), 'align' => 'center', 'width' => 20, 'search' => false, 'orderby' => false, 'callback' => 'renderQuickViewColumn', 'remove_onclick' => true), 'id_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 40, 'remove_onclick' => true), 'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 65, 'remove_onclick' => true), 'stock' => array('title' => $this->l('Stock'), 'width' => 20, 'align' => 'center', 'search' => false, 'orderby' => false, 'callback' => 'getStock', 'remove_onclick' => true), 'carrier_id' => array('title' => $this->l('Carrier'), 'width' => 70, 'type' => 'select', 'list' => $carrier_array, 'filter_key' => 'ca!id_carrier', 'filter_type' => 'int', 'align' => 'center', 'callback' => 'getCarrierImage', 'remove_onclick' => true), 'document' => array('title' => $this->l('Document'), 'width' => 30, 'align' => 'center', 'search' => false, 'orderby' => false, 'havingFilter' => false, 'callback' => 'getLastDocument', 'remove_onclick' => true), 'new' => array('title' => $this->l('New'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'tmpTableFilter' => true, 'icon' => array(0 => 'blank.gif', 1 => array('src' => 'note.png', 'alt' => $this->l('First customer order'))), 'orderby' => false, 'remove_onclick' => true), 'customer' => array('title' => $this->l('Customer'), 'havingFilter' => true, 'width' => 100, 'remove_onclick' => true), 'total_paid_tax_incl' => array('title' => $this->l('Total'), 'width' => 70, 'align' => 'right', 'prefix' => '<b>', 'suffix' => '</b>', 'type' => 'price', 'currency' => true, 'remove_onclick' => true), 'payment' => array('title' => $this->l('Payment'), 'remove_onclick' => true, 'width' => 100, 'remove_onclick' => true), 'osname' => array('title' => $this->l('Status'), 'color' => 'color', 'width' => 220, 'type' => 'select', 'list' => $statuses_array, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', 'remove_onclick' => true, 'callback' => 'getStatutsListe'), 'date_add' => array('title' => $this->l('Date'), 'width' => 130, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add', 'remove_onclick' => true));
        //$this->shopLinkType = 'shop';
        //$this->shopShareDatas = Shop::SHARE_ORDER;
        if (Tools::isSubmit('id_order')) {
            // Save context (in order to apply cart rule)
            $order = new ErpOrder((int) Tools::getValue('id_order'));
            if (!Validate::isLoadedObject($order)) {
                throw new PrestaShopException($this->l('Cannot load Order object'));
            }
            $this->context->cart = new Cart($order->id_cart);
            $this->context->customer = new Customer($order->id_customer);
        }
        // get controller status
        $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminAdvancedOrder'));
        parent::__construct();
    }
 public function __construct()
 {
     $this->bootstrap = true;
     $this->context = Context::getContext();
     $this->table = 'supply_order';
     $this->className = 'SupplyOrder';
     $this->identifier = 'id_supply_order';
     $this->lang = false;
     $this->is_template_list = false;
     $this->multishop_context = Shop::CONTEXT_ALL;
     // get controller status
     $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminAdvancedSupplyOrder'));
     if ($this->controller_status == STATUS1) {
         $sql = 'SELECT count(*) from ' . _DB_PREFIX_ . 'erpip_supply_order';
         $query = new DbQuery();
         $query->select('count(distinct so.id_supply_order)');
         $query->from('erpip_supply_order', 'so');
         $query->innerJoin('supply_order', 's', 'so.id_supply_order = s.id_supply_order');
         $query->where("s.date_add >= '" . pSQL(Configuration::get('ERP_FIRST_INSTALL_DATE')) . "'");
         $this->nbcmdfou = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
     }
     // template path for avdanced supply ordr
     $this->template_path = _PS_MODULE_DIR_ . 'erpillicopresta/views/templates/admin/';
     $this->toolbar_title = $this->l('1 Click ERP ILLICOPRESTA');
     //get if advanced stock enabled
     $this->advanced_stock_management = Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT');
     $this->is_1_6 = version_compare(_PS_VERSION_, '1.6') > 0;
     $this->token = Tools::getAdminToken('AdminAdvancedSupplyOrder' . (int) Tab::getIdFromClassName('AdminAdvancedSupplyOrder') . (int) $this->context->employee->id);
     $this->addRowAction('updatereceipt');
     $this->addRowAction('changestate');
     $this->addRowAction('edit');
     $this->addRowAction('view');
     $this->addRowAction('details');
     $this->list_no_link = true;
     $statuses_array = array();
     $statuses = SupplyOrderState::getSupplyOrderStates((int) $this->context->language->id);
     foreach ($statuses as $status) {
         $statuses_array[$status['id_supply_order_state']] = $status['name'];
     }
     $this->fields_list = array('id_supply_order' => array('title' => 'ID', 'width' => 100, 'search' => false, 'havingFilter' => false, 'orderby' => true, 'callback' => 'renderIdSupplyOrderColumn'), 'reference' => array('title' => $this->l('Reference'), 'width' => 100, 'havingFilter' => true, 'callback' => 'renderReferenceColumn'), 'with_description' => array('title' => $this->l('Description'), 'width' => 25, 'align' => 'center', 'class' => 'view_description', 'callback' => 'renderWithDescriptionColumn', 'search' => false, 'orderby' => false));
     if ($this->controller_status) {
         $this->fields_list = array_merge($this->fields_list, array('invoice_number' => array('title' => $this->l('Invoice Number'), 'width' => 100, 'havingFilter' => true), 'date_to_invoice' => array('title' => $this->l('Invoice Date'), 'width' => 100, 'type' => 'date', 'havingFilter' => true)));
     }
     $this->fields_list = array_merge($this->fields_list, array('supplier' => array('title' => $this->l('Supplier'), 'width' => 100, 'filter_key' => 's!name'), 'warehouse' => array('title' => $this->l('Warehouse'), 'width' => 100, 'filter_key' => 'w!name'), 'state' => array('title' => $this->l('Status'), 'color' => 'color', 'width' => 150, 'type' => 'select', 'list' => $statuses_array, 'filter_key' => 'stl!name', 'filter_type' => 'int', 'color' => 'color', 'callback' => 'renderSupplyOrderStatesColumn'), 'date_add' => array('title' => $this->l('Creation'), 'width' => 150, 'align' => 'left', 'type' => 'date', 'havingFilter' => true, 'filter_key' => 'a!date_add'), 'date_upd' => array('title' => $this->l('Last modification'), 'width' => 150, 'align' => 'left', 'type' => 'date', 'havingFilter' => true, 'filter_key' => 'a!date_upd'), 'date_delivery_expected' => array('title' => $this->l('Expected delivery date'), 'width' => 150, 'align' => 'left', 'type' => 'date', 'havingFilter' => true, 'filter_key' => 'a!date_delivery_expected'), 'id_export' => array('title' => $this->l('Export'), 'width' => 80, 'callback' => 'printExportIcons', 'orderby' => false, 'search' => false)));
     // gets the list of warehouses available
     $this->warehouses = Warehouse::getWarehouses(true);
     // gets the final list of warehouses
     array_unshift($this->warehouses, array('id_warehouse' => -1, 'name' => $this->l('All warehouses')));
     require_once _PS_MODULE_DIR_ . 'erpillicopresta/models/ErpFeature.php';
     // send var to template
     $this->context->smarty->assign(array('is_1_6' => $this->is_1_6, 'erp_feature' => ErpFeature::getFeaturesWithToken($this->context->language->iso_code), 'inheritance_merge_compiled_includes' => false));
     // get controller status
     $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminAdvancedOrder'));
     parent::__construct();
 }