publish( Configuration::get('LOGISTICS_QUEUE_'.(int) $cookie->id_employee), json_encode(array('data' => base64_encode( chr(2).'n'."\n" // Inch mode .chr(2).'O0100'."\n" // Start position .chr(2).'L'."\n" .'C0000'."\n" .'D11'."\n" .chr(2).'L'."\n" .$this->isoreplace($data) .'Q0001'."\n" // Number of labels to print .'E'."\n" // End ))) ); } else { $redis->publish( Configuration::get('LOGISTICS_QUEUE_'.(int) $cookie->id_employee), json_encode(array('data' => base64_encode( $data ))) ); } return TRUE; } public function postProcess() { global $cookie, $logistics_carriers; // Delete number if(( in_array((int)$cookie->profile, array(1,9,7,13,14)) ) && ( $delete_number = Tools::getValue('delete_number') )) { // Suppression LAPOSTE if($delete = (int) Tools::getValue('delete_laposte')) { Db::getInstance()->ExecuteS(' DELETE FROM `'._DB_PREFIX_.'lapostews` WHERE `id_order_detail` = '.$delete.' AND `shipping_number` = "'.pSQL($delete_number).'" '); if(!Db::getInstance()->getRow(' SELECT l.`shipping_number` FROM `'._DB_PREFIX_.'lapostews` l LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON l.`id_order_detail` = d.`id_order_detail` WHERE l.`shipping_number` = "'.pSQL($delete_number).'" AND d.`id_order` = '.(int) Tools::getValue('id_order').' ')) { Db::getInstance()->ExecuteS(' DELETE FROM `'._DB_PREFIX_.'shipping_history` WHERE `id_order` = '.(int) Tools::getValue('id_order').' AND `shipping_number` = "'.pSQL($delete_number).'" '); } } // Suppression EXAPAQ elseif ($delete = (int) Tools::getValue('delete_exapaq')) { Db::getInstance()->ExecuteS(' DELETE FROM `'._DB_PREFIX_.'exapaqws` WHERE `id_order_detail` = '.$delete.' AND `shipping_number` = "'.pSQL($delete_number).'" '); if(!Db::getInstance()->getRow(' SELECT `shipping_number` FROM `'._DB_PREFIX_.'exapaqws` WHERE `shipping_number` = "'.pSQL($delete_number).'" ')) { Db::getInstance()->ExecuteS(' DELETE FROM `'._DB_PREFIX_.'shipping_history` WHERE `id_order` = '.(int) Tools::getValue('id_order').' AND `shipping_number` = "'.pSQL($delete_number).'" '); } } // Suppression MONDIAL RELAY elseif ($delete = (int) Tools::getValue('delete_mondialrelay')) { Db::getInstance()->ExecuteS(' DELETE FROM `'._DB_PREFIX_.'mondialrelay_parcel` WHERE `id_order_detail` = '.$delete.' AND `shipping_number` = "'.pSQL($delete_number).'" '); if(!Db::getInstance()->getRow(' SELECT `shipping_number` FROM `'._DB_PREFIX_.'mondialrelay_parcel` WHERE `shipping_number` = "'.pSQL($delete_number).'" ')) { Db::getInstance()->ExecuteS(' DELETE FROM `'._DB_PREFIX_.'shipping_history` WHERE `id_order` = '.(int) Tools::getValue('id_order').' AND `shipping_number` = "'.pSQL($delete_number).'" '); } } // Suppression PHILEA elseif ($delete = (int) Tools::getValue('delete_philea')) { Db::getInstance()->ExecuteS(' DELETE FROM `'._DB_PREFIX_.'philea_parcel` WHERE `id_order_detail` = '.$delete.' AND `shipping_number` = "'.pSQL($delete_number).'" '); if(!Db::getInstance()->getRow(' SELECT `shipping_number` FROM `'._DB_PREFIX_.'philea_parcel` WHERE `shipping_number` = "'.pSQL($delete_number).'" ')) { Db::getInstance()->ExecuteS(' DELETE FROM `'._DB_PREFIX_.'shipping_history` WHERE `id_order` = '.(int) Tools::getValue('id_order').' AND `shipping_number` = "'.pSQL($delete_number).'" '); } } // Pour les commandes et les articles mise à jours en commande non envoyé, simplement payé $id_order_details = array(); foreach(Db::getInstance()->ExecuteS(' SELECT `id_order_detail` FROM `'._DB_PREFIX_.'order_detail` WHERE `id_order` = '.(int) Tools::getValue('id_order').' ') as $row) { $id_order_details[] = (int) $row['id_order_detail']; } if(!Db::getInstance()->getRow(' SELECT * FROM `'._DB_PREFIX_.'lapostews` WHERE `id_order_detail` IN ('.implode(', ', $id_order_details).') ')) { Db::getInstance()->ExecuteS(' INSERT INTO `'._DB_PREFIX_.'order_history` VALUES ( DEFAULT, '.(int) $cookie->id_employee.', '.(int) Tools::getValue('id_order').', '.(int) Configuration::get('PS_OS_PAYMENT').', NOW() ) '); Db::getInstance()->ExecuteS(' INSERT INTO `'._DB_PREFIX_.'order_state_current` VALUES ( '.(int) Tools::getValue('id_order').', '.(int) Configuration::get('PS_OS_PAYMENT').', NOW() ) ON DUPLICATE KEY UPDATE `id_order_state` = '.(int) Configuration::get('PS_OS_PAYMENT').', `date_upd` = NOW() '); } Tools::redirectLink('http://'.$_SERVER['SERVER_NAME'].'/adm/index.php?tab=AdminAntLogistic&token='.Tools::getAdminTokenLite('AdminAntLogistic').'&id_order='.(int) Tools::getValue('id_order').'&mode='.Tools::getValue('mode', '').'#'.Tools::getValue('mode', '')); } // Generate a new shipping number for product sent with many parcels if( (Tools::isSubmit('submitReprintShip')) && in_array((int)$cookie->profile, array(1,9,7,13,14)) && ( ($id_order = Tools::getValue('id_order_reprint')) && ($products = Tools::getValue('products_reprint')) && ($parcel_carrier = Tools::getValue('carrier_reprint')) ) ) { $weight = 0.24; $order = new Order((int) $id_order); if(Validate::isLoadedObject($order)) { $parcel_carrier == 'laposte' ? $weight = 0.24 : true; if ($parcel_carrier == 'laposte' || $parcel_carrier == 'mondialrelay') { $result = $logistics_carriers[$parcel_carrier]->registerParcel($order, $products, $weight); if($result[0] != '') { $this->_html .= $result[0]; return; } $render = $logistics_carriers[$parcel_carrier]->renderLabel($order, $weight, $result[1]); if($render === 'pr_error') { $this->_html .= '
'.$this->l('Unknown delivery point').'
'.$this->l('Route not found').'
'.$this->l('Registration complete, label sent to printer').'
'.$this->l('An error happened during the label rendering').'
'.$this->l('Registration complete, label sent to printer').'
'.$this->l('Registration complete, label sent to printer').'
'.$this->l('Registration complete, label sent to printer').'
'.$this->l('Unknown delivery point').'
'.$this->l('Route not found').'
'.$this->l('Registration complete, label sent to printer').'
'.$this->l('An error happened during the label rendering').'
'.$this->l('Please enter a weight and select at least one product').'
'.$this->l('Please enter a weight and select at least one product').'
'.$this->l('Order status changed').'
'.$this->l('Error occured').'
'.$this->l('Order in pending').'
'.$class->displayName.' – '.$this->l('Webservices are unavailable at the moment, please try again later.').'
'; } } $locked_products = array(); $_locked_products = Configuration::get('LOGISTICS_LOCK'); if($_locked_products === FALSE || $_locked_products == 0 || $_locked_products == 's:8:"s:1:"0"' || empty($_locked_products)) { $_locked_products = serialize(array()); } foreach(unserialize($_locked_products) as $id_s) { $_s = new Sale($id_s); foreach($_s->getProducts() as $p) { $locked_products[] = $p; } } $sales_list = array(); if(isset($_COOKIE['logistics_sales'])) { foreach(explode('-', $_COOKIE['logistics_sales']) as $chunk) { $sales_list[] = (int) $chunk; } } $helperForm = new HelperFormBootstrap(); $helperForm->_css.=' body.mode_light, body.mode_light #top_container, body.mode_light #container, body.mode_light #container #content { background: #f5f5f9; border: 0px; } body.mode_light #orderInfos .addresses, body.mode_light #orderInfos > .infos, body.mode_light #orderInfos #shippingLogs, body.mode_light #header_infos, body.mode_light #header_search, body.mode_light #header_quick, body.mode_light ul#menu, body.mode_light ul#submenu, body.mode_light #footer, body.mode_light .path_bar, body.mode_light div#tab1_subtabs, body.mode_light div#tab2_subtabs, body.mode_light div#tab3_subtabs, body.mode_light div#tab4_subtabs, body.mode_light div#tab5_subtabs, body.mode_light div#tab6_subtabs, body.mode_light div#tab7_subtabs, body.mode_light div#tab8_subtabs, body.mode_light div#tab9_subtabs, body.mode_light div#tab29_subtabs, body.mode_light div#tab89_subtabs { display: none; } .ui-multiselect { padding: 2px 0 2px 4px; text-align: left; } .ui-multiselect span.ui-icon { float: right; } .ui-multiselect-single .ui-multiselect-checkboxes input { left: -9999px; position: absolute !important; top: auto !important; } .ui-multiselect-single .ui-multiselect-checkboxes label { padding: 5px !important; } .ui-multiselect-header { margin-bottom: 3px; padding: 3px 0 3px 4px; } .ui-multiselect-header ul { font-size: 0.9em; } .ui-multiselect-header ul li { float: left; padding: 0 10px 0 0; } .ui-multiselect-header a { text-decoration: none; } .ui-multiselect-header a:hover { text-decoration: underline; } .ui-multiselect-header span.ui-icon { float: left; } .ui-multiselect-header li.ui-multiselect-close { float: right; padding-right: 0; text-align: right; } .ui-multiselect-menu { display: none; padding: 3px; position: absolute; text-align: left; z-index: 10000; width: 842px; } .ui-multiselect-checkboxes { overflow-y: scroll; position: relative; } .ui-multiselect-checkboxes label { border: 1px solid transparent; cursor: default; display: block; padding: 3px 1px; float: none; text-align: left; width: auto; } .ui-multiselect-checkboxes label input { position: relative; top: 1px; margin-right: 5px; } .ui-multiselect-checkboxes li { clear: both; font-size: 0.9em; padding-right: 3px; } .ui-multiselect-checkboxes li.ui-multiselect-optgroup-label { border-bottom: 1px solid; font-weight: bold; text-align: center; } .ui-multiselect-checkboxes li.ui-multiselect-optgroup-label a { display: block; margin: 1px 0; padding: 3px; text-decoration: none; } * html .ui-multiselect-checkboxes label { border: medium none; } .ui-multiselect-hasfilter ul { position:relative; top:2px } .ui-multiselect-filter { float:left; margin-right:10px; font-size:11px } .ui-multiselect-filter input { width:300px; font-size:10px; margin-left:5px; height:15px; padding:2px; border:1px solid #292929; -webkit-appearance:textfield; -webkit-box-sizing:content-box; } .location { color: #0066ff; } #html_products thead th, #html_logs thead th{ font-size:12px; vertical-align:middle; } #html_products tbody tr.grey{ background:#efefef !important; } #html_products tbody tr td{ vertical-align:middle; } #html_products tbody tr td input.input_quantity{ width: 40px; font-size: 22px; display: inline-block; vertical-align: middle; height: 41px; text-align: center; } #html_products tbody tr td .qtyblock{ width: 30px; display: inline-block; vertical-align: middle; } #html_products tbody tr td .qtyblock a{ background: #504d8b; font-size: 18px; width: 30px; text-align: center; display: block; line-height: 20px; cursor: pointer; color:#fff; } #html_products tbody tr td .qtyblock a.qty_down{ border-top:1px solid; } '; $this->_html .= $helperForm->renderStyle(); $helperForm->_js.=' '; $helperForm->_js .='