public function renderList()
 {
     $this->toolbar_title = $this->l('Suppliers');
     return parent::renderList();
 }
 public function renderList()
 {
     $this->toolbar_title = $this->l('Order Management');
     $statuses_array = array();
     $statuses = ErpOrderState::getOrderStates((int) $this->context->language->id);
     foreach ($statuses as $status) {
         $statuses_array[$status['id_order_state']] = $status['name'];
     }
     require_once _PS_MODULE_DIR_ . 'erpillicopresta/models/ErpFeature.php';
     $this->context->smarty->assign(array('token_mr' => ModuleCore::isEnabled('mondialrelay') ? MondialRelay::getToken('back') : 'false', 'token_expeditor' => ModuleCore::isEnabled('expeditor') ? Tools::getAdminToken('AdminExpeditor' . (int) Tab::getIdFromClassName('AdminExpeditor') . (int) $this->context->employee->id) : 'false', 'id_employee' => (int) $this->context->employee->id, 'order_statuses' => $statuses_array, 'controller_status' => $this->controller_status, 'erp_feature' => ErpFeature::getFeaturesWithToken($this->context->language->iso_code), 'template_path' => $this->template_path, 'expeditor_status' => Configuration::get('EXPEDITOR_STATE_EXP'), '_module_dir_' => _MODULE_DIR_));
     $this->tpl_list_vars['has_bulk_actions'] = 'true';
     // handle may contain error messages
     $handle = Tools::getValue('handle');
     switch (trim($handle)) {
         case '':
             break;
         case 'false':
             $this->confirmations[] = $this->l('All orders have been updated') . '<br/>';
             break;
         default:
             if (!empty($handle)) {
                 // $handle = str_replace('u00e9', 'é', $handle);
                 // $handle = str_replace('u00ea', 'ê', $handle);
                 $handle = Tools::replaceAccentedChars($handle);
                 // We take note about orders with error: no valid carrier (split on order number #)
                 $orderWithoutShipping = strstr($handle, '#') != false ? true : false;
                 $errors = explode('<br/>', str_replace('#', '<br/>', $handle));
                 foreach ($errors as $key => $error) {
                     if (!empty($error)) {
                         if (!$orderWithoutShipping) {
                             $message = $error;
                         } else {
                             $message = $error;
                         }
                         $this->errors[] = Tools::displayError($message);
                     }
                 }
             }
             break;
     }
     if (Tools::getValue('linkPDF') != '' && Tools::getValue('newState') != '') {
         // if state need invoice generation
         if (ErpOrderState::invoiceAvailable(Tools::getValue('newState'))) {
             $pdf_link = new Link();
             $pdf_link = $pdf_link->getAdminLink("AdminAdvancedOrder", true) . '&submitAction=generateInvoicesPDF3&id_orders=' . Tools::getValue('linkPDF');
             $this->confirmations[] = '&nbsp;<a target="_blank" href="' . $pdf_link . '" alt="invoices">' . $this->l('Download all invoices') . '<br/></a>';
         }
         // if state need delivery slip generation
         if (ErpOrderState::deliverySlipAvailable(Tools::getValue('newState'))) {
             $pdf_link = new Link();
             $pdf_link = $pdf_link->getAdminLink("AdminAdvancedOrder", true) . '&submitAction=generateDeliverySlipsPDF2&id_orders=' . Tools::getValue('linkPDF');
             $this->confirmations[] = '&nbsp;<a target="_blank" href="' . $pdf_link . '" alt="delivery">' . $this->l('Download all delivery slip') . '<br/></a>';
         }
     }
     if (Tools::getValue('linkPDFPrint') != '') {
         if ($this->controller_status == STATUS1 && count(explode(',', Tools::getValue('linkPDFPrint'))) > ERP_ORDERFR) {
             $this->informations[] = sprintf($this->l('You are using the free version of 1-Click ERP which limits the possible number of documents to print to %d orders'), ERP_ORDERFR);
         } else {
             $invoices = '';
             $delivery = '';
             foreach (explode(',', Tools::getValue('linkPDFPrint')) as $id_order) {
                 if (ErpOrderState::invoiceAvailable(ErpOrder::getIdStateByIdOrder($id_order))) {
                     $invoices .= $id_order . ',';
                 }
                 if (ErpOrderState::deliverySlipAvailable(ErpOrder::getIdStateByIdOrder($id_order))) {
                     $delivery .= $id_order . ',';
                 }
             }
             if ($invoices != '') {
                 $pdf_link = new Link();
                 $pdf_link = $pdf_link->getAdminLink("AdminAdvancedOrder", true) . '&submitAction=generateInvoicesPDF3&id_orders=' . Tools::substr($invoices, 0, -1);
                 $this->confirmations[] = '&nbsp;<a target="_blank" href="' . $pdf_link . '" alt="invoices">' . $this->l('Download all invoices') . '</br></a>';
             }
             if ($delivery != '') {
                 $pdf_link = new Link();
                 $pdf_link = $pdf_link->getAdminLink("AdminAdvancedOrder", true) . '&submitAction=generateDeliverySlipsPDF2&id_orders=' . Tools::substr($delivery, 0, -1);
                 $this->confirmations[] = '&nbsp;<a target="_blank" href="' . $pdf_link . '" alt="delivery">' . $this->l('Download all delivery slip') . '</br></a>';
             }
             if ($invoices == '' && $delivery == '') {
                 $this->errors[] = $this->l('The selected orders have no invoice or delivery !') . '<br/>';
             }
         }
     }
     if (Tools::getValue('etiquettesMR') != '') {
         // Downlad all pdf and zip then delete and display link to zip file
         $etiquettesMR = explode(' ', Tools::getValue('etiquettesMR'));
         unset($etiquettesMR[count($etiquettesMR) - 1]);
         $zipPath = '../modules/erpillicopresta/export/mondialrelay.zip';
         $zip = new ZipArchive();
         if ($zip->open($zipPath, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) !== true) {
             throw new Exception($this->l('Impossible to create the zip archive containing the shipping labels to Mondial Relay carrier !') . '<br/>');
         }
         foreach ($etiquettesMR as $key => $i) {
             $zip->addFromString('mondialrelay_' . $key . '.pdf', Tools::file_get_contents($i));
         }
         $zip->close();
         //Display link to dl zip file
         $this->confirmations[] = '&nbsp;<a target="_blank" href="' . $zipPath . '" alt="zip_file">' . $this->l('Download zip archive which contents all labels for Mondial Relay shipment') . '<br/></a>';
         if (Tools::getValue('deliveryNumbersMR') != '') {
             // Get all tracking numbers
             $numbers = explode(" ", Tools::getValue('deliveryNumbersMR'));
             unset($numbers[count($numbers) - 1]);
             foreach ($numbers as $number) {
                 $tabNumber = explode("-", $number);
                 $order_carrier = new OrderCarrier(ErpOrder::getIdCarrierbyIdOrder((int) $tabNumber[1]));
                 $order = new ErpOrder((int) $tabNumber[1]);
                 // Update carrier
                 $order->shipping_number = $tabNumber[0];
                 $order->update();
                 // Update order_carrier
                 $order_carrier->tracking_number = pSQL($tabNumber[0]);
                 $order_carrier->update();
             }
         }
     }
     if (Tools::getValue('expeditorCSV') != '') {
         // CSV file creation
         $csvPath = '../modules/erpillicopresta/export/expeditor_inet.csv';
         $fileCSV = fopen($csvPath, 'w');
         // Fill in file
         fwrite($fileCSV, str_replace(',', '', Tools::getValue('expeditorCSV')));
         //Close
         fclose($fileCSV);
         // link creation
         $this->confirmations[] = '&nbsp;<a target="_blank" href="' . $csvPath . '" alt="csv_file">' . $this->l('Download export file (CSV) for ExpeditorInet') . '</br></a>';
     }
     if (Tools::getValue('idOthers') != '') {
         //BEGIN Initialisations for TNT
         if (Module::isEnabled('tntcarrier')) {
             $TNTCheck = false;
             require_once _PS_MODULE_DIR_ . '/tntcarrier/classes/PackageTnt.php';
             if (class_exists('ZipArchive', false) && ($tnt_zip = new ZipArchive())) {
                 // Protection du ZIP
                 $dateday = new DateTime();
                 $uniqid_file = uniqid('file_');
                 $token = md5($dateday->getTimestamp() . $uniqid_file);
                 // Put all tnt pdf into a zip
                 $tnt_zip_path = 'erpillicopresta/export/tnt_' . date('Y-m-d_His') . '_' . $uniqid_file . $token . '.zip';
                 if ($tnt_zip->open(_PS_MODULE_DIR_ . $tnt_zip_path, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) !== true) {
                     $this->errors[] = Tools::displayError($this->l('Failed to create a ZIP archive containing the shipping labels to TNT carrier !') . '<br/>');
                 } else {
                     // one or several id orders
                     $id_others_order_array = strpos(Tools::getValue('idOthers'), ',') !== false ? explode(',', Tools::getValue('idOthers')) : (int) Tools::getValue('idOthers');
                     // Browse all orders not in ExpeditorInet nor MondialRelay
                     foreach ((array) $id_others_order_array as $i => $id_order) {
                         // BEGIN Commande TNT
                         $id_order = (int) $id_order;
                         if (ErpOrder::isTntOrder($id_order)) {
                             // status change
                             $currOrder = new ErpOrder($id_order);
                             $currOrder->setCurrentState(4, $this->context->employee->id);
                             // Start to check that weight order is valid if not tnt crash !
                             //echo($data['poid'] * 1000);die;
                             // Get tracking number : dedicated class created for this action
                             // Execution of the hook generating the tracking number at an order opening ... So ctrl c / ctrl v to execute here
                             /*$erp_tntCarrier = new ErpTntCarrier();
                               $generate = $erp_tntCarrier->generateShipping($id_order);*/
                             $generateShipping = Hook::exec('adminOrder', array('id_order' => $id_order));
                             $tnt = new PackageTnt($id_order);
                             $tntNumber = $tnt->getShippingNumber();
                             if (count($tntNumber) == 0) {
                                 $this->errors[] = Tools::displayError($this->l('Failed to get shipping number from TNT services : you have to fit the weight of the order.'));
                                 continue;
                             }
                             $tntNumber = $tntNumber[0]['shipping_number'];
                             // Update order
                             $order_carrier = new OrderCarrier(ErpOrder::getIdCarrierbyIdOrder((int) $id_order));
                             $order = new ErpOrder((int) $id_order);
                             $order->shipping_number = $tntNumber;
                             $order->update();
                             $order_carrier->tracking_number = pSQL($tntNumber);
                             $order_carrier->update();
                             // Add pdf to zip
                             $tnt_zip->addFile(_PS_MODULE_DIR_ . '/tntcarrier/pdf/' . $tntNumber . '.pdf', $tntNumber . '.pdf');
                             $TNTCheck = true;
                         }
                         // END Order TNT
                         // SPLICE  idOther
                         if (is_array($id_others_order_array)) {
                             unset($id_others_order_array[$i]);
                         } else {
                             unset($id_others_order_array);
                         }
                     }
                     //Display dl zip link
                     $tnt_zip->close();
                     if ($TNTCheck) {
                         $this->confirmations[] = '&nbsp;<a target="_blank" href="' . _MODULE_DIR_ . $tnt_zip_path . '" alt="zip_file">' . $this->l('Download zip archive which contents all labels for TNT shipment') . '<br/></a>';
                     }
                 }
             } else {
                 $this->errors[] = Tools::displayError($this->l('Class ZipArchive does not exist !') . '<br/>');
             }
             //END Initialisations for TNT
         }
         // Display for order not  processed  : idothers
         if (isset($id_others_order_array)) {
             if (count($id_others_order_array) == 1) {
                 //var_dump($id_others_order_array);die();
                 if (is_array($id_others_order_array)) {
                     $id_others_order_array = $id_others_order_array[1];
                 }
                 $this->errors[] = Tools::displayError($this->l('The following order has not been processed : order #') . $id_others_order_array . '. ' . $this->l('Please make sure that the carrier is either TNT, ExpeditorInet, or MondialRelay and that the order fits the carrier requirements.'));
             } elseif (count($id_others_order_array) > 1) {
                 $this->errors[] = Tools::displayError($this->l('The following orders have not been processed : orders #') . implode(", ", $id_others_order_array) . '. ' . $this->l('Please make sure that the carrier is either TNT, ExpeditorInet, or MondialRelay and that the orders fit the carrier requirements.'));
             }
         }
     }
     return parent::renderList();
 }
 public function postProcess()
 {
     // record all order unselected
     $this->saveUnselectedOrders();
     // Export PDF of supply order
     if (Tools::isSubmit('submitAction') && Tools::getValue('submitAction') == 'generateSupplyOrderFormPDF') {
         $this->processGenerateSupplyOrderFormPDF();
     }
     require_once _PS_MODULE_DIR_ . 'erpillicopresta/models/ErpFeature.php';
     $this->context->smarty->assign(array('erp_feature' => ErpFeature::getFeaturesWithToken($this->context->language->iso_code), 'template_path' => $this->template_path));
     parent::postProcess();
 }
 public function initProcess()
 {
     if (!Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
         $this->warnings[md5('PS_ADVANCED_STOCK_MANAGEMENT')] = $this->l('You need to activate advanced stock management prior to using this feature. (See Preferences > Products)');
         return false;
     }
     parent::initProcess();
 }
 public function InitToolbar()
 {
     return parent::initToolbar();
 }
Exemplo n.º 6
0
 public function initPageHeaderToolbar()
 {
     parent::initPageHeaderToolbar();
     if ($this->display != 'add' && $this->display != 'edit') {
         $url_add_zone = self::$currentIndex . '&';
         $url_add_zone .= 'add' . $this->table . '&';
         $url_add_zone .= 'token=' . $this->token . '&';
         $url_add_zone .= 'id_parent=' . Tools::getValue('id_erpip_zone') . '&';
         $url_add_zone .= 'id_warehouse=' . Tools::getValue('id_warehouse') . '&';
         $url_add_zone .= 'warehouse_name=' . Tools::getValue('warehouse_name') . '&';
         $url_add_zone .= 'zone_name=' . Tools::getValue('zone_name') . '&';
         $url_add_zone .= 'display=add';
         $this->page_header_toolbar_btn['new'] = array('href' => $url_add_zone, 'desc' => $this->l('Add new'));
         $this->page_header_toolbar_btn['save'] = array('href' => self::$currentIndex . '&add' . $this->table . '&token=' . $this->token . '&export_csv', 'desc' => $this->l('Export'));
     }
     if (!empty($this->display) || Tools::isSubmit('id_erpip_zone')) {
         $this->page_header_toolbar_btn['back_to_list'] = array('href' => self::$currentIndex . '&token=' . $this->token, 'desc' => $this->l('Back'), 'icon' => 'process-icon-back');
     }
 }
 public function postProcess()
 {
     if (Tools::isSubmit('submitFilterconfiguration')) {
         // get an array with first paramettre id_product, second paramettre id_product attribute, third area
         // fourth id_wharehouse_product_location, fifth id_erpip_warhouse_product_location
         $areas = Tools::getValue('data_location');
         if (!empty($areas) && is_array($areas)) {
             foreach ($areas as $id_product => $product) {
                 foreach ($product as $id_attribute => $attribute) {
                     // data already exists in warehouse product location table
                     if (!empty($attribute['id_warehouse_product_location']) && $attribute['id_warehouse_product_location'] != '0') {
                         $warehouse = new WarehouseProductLocationCore((int) $attribute['id_warehouse_product_location']);
                     } else {
                         $warehouse = new WarehouseProductLocationCore();
                         $warehouse->id_product = (int) $id_product;
                         $warehouse->id_product_attribute = (int) $id_attribute;
                         $warehouse->id_warehouse = (int) Tools::getValue('id_warehouse');
                     }
                     //save location
                     $warehouse->location = empty($attribute['location']) ? null : $attribute['location'];
                     $warehouse->save();
                     // data not exists in ERP warehouse product location table
                     if ($attribute['id_erpip_warehouse_product_location'] == '0') {
                         $erp_warehouse = new ErpWarehouseProductLocation();
                     } else {
                         $erp_warehouse = new ErpWarehouseProductLocation((int) $attribute['id_erpip_warehouse_product_location']);
                     }
                     // save area and sub area
                     $erp_warehouse->id_warehouse_product_location = (int) $warehouse->id;
                     $erp_warehouse->id_zone_parent = empty($attribute['area']) ? null : (int) $attribute['area'];
                     //id_zone_parent  = area
                     $erp_warehouse->id_zone = empty($attribute['sub_area']) ? null : (int) $attribute['sub_area'];
                     //id_zone = sub_area
                     $erp_warehouse->save();
                 }
             }
             $this->confirmations[] = $this->l('Locations updated successfully');
         }
     }
     if (Tools::isSubmit('createImageStock')) {
         // list of stock images
         $images = Tools::getValue('images');
         if (!empty($images) && is_array($images)) {
             foreach ($images as $image) {
                 //if isset id_image then this is the selected images stock
                 if (isset($image['id_stock_image'])) {
                     $stock_image = new StockImage();
                     $stock_image->createImage((int) $image['id_stock_image'], $image['name_stock_image']);
                     break;
                 }
             }
         }
     }
     //Display Information or confirmation message / error of end of inventory
     switch (Tools::getValue('submitFilterstock')) {
         case 0:
             $this->displayInformation($this->l('You may create a new stock image or select an older one'));
             break;
         case 1:
             $this->confirmations[] = $this->l('New image saved');
             break;
         case 2:
             $this->errors[] = Tools::displayError('Error while handling products');
             break;
         default:
             $this->displayInformation($this->l('You may create a new stock image or select an older one'));
             break;
     }
     // Stock image selection
     $this->context->smarty->assign(array('images' => StockImage::getStockImages(), 'pack' => ERP_SLOT_IPTIMEMACHINE, 'id_warehouse' => Tools::getValue('id_warehouse')));
     $this->getCurrentValue('id_image');
     // Get context link and display toolbar
     $this->context_link = $this->context->link;
     $this->initToolbar();
     $this->initPageHeaderToolbar();
     require_once _PS_MODULE_DIR_ . 'erpillicopresta/models/ErpFeature.php';
     $this->context->smarty->assign(array('erp_feature' => ErpFeature::getFeaturesWithToken($this->context->language->iso_code), 'template_path' => $this->template_path));
     return parent::postProcess();
 }
 public function postProcess()
 {
     require_once _PS_MODULE_DIR_ . 'erpillicopresta/models/ErpFeature.php';
     $this->context->smarty->assign(array('erp_feature' => ErpFeature::getFeaturesWithToken($this->context->language->iso_code), 'template_path' => $this->template_path));
     // Export CSV
     if (Tools::isSubmit('export_csv')) {
         $this->renderCSV();
     }
     parent::postProcess();
 }
 public function postProcess()
 {
     //create manual inventory
     if (Tools::isSubmit('submitAction') && Tools::getValue('submitAction') == 'submitCreateInventory') {
         $this->processCreateInventory();
     } else {
         if (isset($_FILES['file']) && Tools::isSubmit('submitAction') && Tools::getValue('submitAction') == 'submitCreateInventoryFromCsv') {
             // ASA - Security Audit
             $_FILES['file']['name'] = str_replace("", "", $_FILES['file']['name']);
             // get extention file
             $file_extension = strrchr($_FILES['file']['name'], '.');
             // allowed exention
             $allowed_extensions = array('.csv');
             $file_name = basename($_FILES['file']['name']);
             if (!in_array($file_extension, $allowed_extensions)) {
                 $this->errors[] = Tools::displayError($this->l('The uploaded file is not a CSV !'));
                 return;
             }
             // max file size
             $max_file_size = 1048576;
             //1 Mo
             //file size
             $file_size = filesize($_FILES['file']['tmp_name']);
             if ($file_size > $max_file_size) {
                 $this->errors[] = Tools::displayError($this->l('Your CSV file should not weight more than 1Mo !'));
                 return;
             }
             // if error
             if (!empty($_FILES['file']['error'])) {
                 switch ($_FILES['file']['error']) {
                     case UPLOAD_ERR_INI_SIZE:
                         $this->errors[] = Tools::displayError($this->l('The uploaded file exceeds the upload_max_filesize directive in php.ini. If your server configuration allows it, you may add a directive in your .htaccess.'));
                         break;
                     case UPLOAD_ERR_FORM_SIZE:
                         $this->errors[] = Tools::displayError($this->l('The uploaded file exceeds the post_max_size directive in php.ini.
                                                                                 If your server configuration allows it, you may add a directive in your .htaccess, for example:')) . '<br/><a target="_blank" href="' . $this->context->link->getAdminLink('AdminMeta') . '" >
                                                 <code>php_value post_max_size 20M</code> ' . ($this->errors[] = Tools::displayError($this->l('(click to open "Generators" page)')) . '</a>');
                         break;
                     case UPLOAD_ERR_PARTIAL:
                         $this->errors[] = Tools::displayError($this->l('The uploaded file was only partially uploaded. Please try again.'));
                         break;
                     case UPLOAD_ERR_NO_FILE:
                         $this->errors[] = Tools::displayError($this->l('No file was uploaded'));
                         break;
                 }
             }
             // if no error
             if (count($this->errors) == 0) {
                 //we format file name
                 // $file_name = strtr($file_name,
                 // 'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ',
                 // 'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
                 $file_name = Tools::replaceAccentedChars($file_name);
                 $file_name = preg_replace('/([^.a-z0-9]+)/i', '-', $file_name);
                 $file_name = str_replace('.csv', '-' . date('Y_m_d_his') . '.csv', $file_name);
                 // try to upload
                 if (@move_uploaded_file($_FILES['file']['tmp_name'], _PS_MODULE_DIR_ . 'erpillicopresta/imports/' . $file_name)) {
                     $directory = explode("_", Tools::getValue('id_inventory'));
                     $id_erpip_inventory = $directory[0];
                     // if directory has only one element, mean it s a new directory and we get the name in the dedicated field
                     if (count($directory) > 1) {
                         $name = $directory[1];
                     } else {
                         $name = Tools::getValue('new_inventory');
                     }
                     $id_warehouse = Tools::getValue('selected_warehouse');
                     $id_employee = $this->context->employee->id;
                     $firstname = $this->context->employee->firstname;
                     $lastname = $this->context->employee->lastname;
                     $inventory_values = '';
                     /* ------------------ TREATMENT CSV ------------*/
                     // 2 - open file
                     $handle = $this->openCsvFile($file_name);
                     // 3 - Browse file
                     $i = 0;
                     while ($data = fgetcsv($handle, 0, ";")) {
                         // 4 - reconstruct inventory_values
                         /*
                         $id_product = $data[0];
                         $id_product_attribute = $data[1];
                         $area = $data[5];
                         $subarea = $data[6];
                         $location = $data[7];
                         $physical_quantity = $data[8];
                         $found_quantity = $data[9];
                         */
                         //idproduct==6|idproductattribute==0|idreason==109|area==null|subarea==null|location==|physicalquantity==61|foundquantity==20_
                         // don't use the first line : headers
                         if ($i > 0) {
                             $inventory_values .= 'idproduct==' . $data[0] . '|';
                             $inventory_values .= 'idproductattribute==' . $data[1] . '|';
                             //$inventory_values .= 'idreason==|area=='.$data[-1].'|';
                             $inventory_values .= 'area==' . $data[5] . '|';
                             $inventory_values .= 'subarea==' . $data[6] . '|';
                             $inventory_values .= 'location==' . $data[7] . '|';
                             if (isset($data[8])) {
                                 $inventory_values .= 'physicalquantity==' . $data[8] . '|';
                             }
                             if (isset($data[9])) {
                                 $inventory_values .= 'foundquantity==' . (int) $data[9] . '_';
                             }
                         }
                         $i++;
                     }
                     // 5 - prepare inventory
                     $this->id_erpip_inventory = $id_erpip_inventory;
                     $this->name = $name;
                     $this->id_warehouse = $id_warehouse;
                     $this->id_employee = $id_employee;
                     $this->firstname = $firstname;
                     $this->lastname = $lastname;
                     $this->advanced_stock_management = $this->advanced_stock_management;
                     $this->inventory_values = $inventory_values;
                     $this->createContainer();
                 } else {
                     $this->errors[] = $this->l('An error occurred while uploading and copying the file. Please try again or contact the customer service.');
                 }
             }
         }
     }
     // Export CSV
     if (Tools::isSubmit('export_csv')) {
         $this->renderCSV();
     }
     // Export PDF
     if (Tools::isSubmit('submitAction') && Tools::getValue('submitAction') == 'generateInventoryPDF') {
         $this->processGenerateInventoryPDF();
     }
     parent::postProcess();
 }