This commit is contained in:
Michael RICOIS 2018-01-26 16:24:00 +01:00
parent 6b8472979c
commit 02def68974
4 changed files with 120 additions and 146 deletions

View File

@ -17,10 +17,12 @@ foreach(array_map(function($value) {
include _PS_ROOT_DIR_.'/modules/privatesales/Sale.php';
require_once(PS_ADMIN_DIR . '/helpers/HelperFormBootstrap.php');
class AdminAntLogistic extends AdminTab {
class AdminAntLogistic extends AdminTab
{
public $_html = '';
private function stripaccents($str) {
private function stripaccents($str)
{
return preg_replace(
'~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);~i',
'$1',
@ -28,7 +30,8 @@ class AdminAntLogistic extends AdminTab {
);
}
private function isoreplace($str) {
private function isoreplace($str)
{
// ISO/CEI 646
return str_replace(array(
'Ç', 'ü', 'é', 'â', 'ä', 'à',
@ -80,39 +83,9 @@ class AdminAntLogistic extends AdminTab {
), $str);
}
private function printLabel($data, $mr=false) {
private function printLabel($data, $mr=false)
{
global $cookie;
echo '<pre>';var_dump($data);echo '</pre>';die();
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Option/OptionInterface.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Option/AbstractOption.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Command/Processor/CommandProcessingInterface.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Command/PrefixableCommandInterface.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Command/CommandInterface.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Command/AbstractCommand.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Command/PrefixableCommand.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Command/PubSubPublish.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Connection/ConnectionInterface.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Connection/SingleConnectionInterface.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Connection/AbstractConnection.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Connection/StreamConnection.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Connection/ConnectionParametersInterface.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Connection/ConnectionParameters.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Connection/ConnectionFactoryInterface.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Connection/ConnectionFactory.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Profile/ServerProfileInterface.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Profile/ServerProfile.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Profile/ServerVersion26.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Option/ClientCluster.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Option/ClientPrefix.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Option/ClientExceptions.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Option/ClientReplication.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Option/ClientConnectionFactory.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Option/ClientProfile.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Option/ClientOptionsInterface.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Option/ClientOptions.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/BasicClientInterface.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/ClientInterface.php';
require_once _PS_ROOT_DIR_.'/modules/logistics/libs/predis/lib/Predis/Client.php';
$redis = new Predis\Client();
@ -144,13 +117,15 @@ class AdminAntLogistic extends AdminTab {
return TRUE;
}
public function postProcess() {
public function postProcess()
{
global $cookie, $logistics_carriers;
if(
((int) $cookie->profile == 1 || (int) $cookie->profile == 9 || (int) $cookie->profile == 7 || (int) $cookie->profile == 14)
&& ($delete_number = Tools::getValue('delete_number'))
){
// 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`
@ -172,7 +147,9 @@ class AdminAntLogistic extends AdminTab {
AND `shipping_number` = "'.pSQL($delete_number).'"
');
}
} elseif($delete = (int) Tools::getValue('delete_exapaq')) {
}
// Suppression EXAPAQ
elseif ($delete = (int) Tools::getValue('delete_exapaq')) {
Db::getInstance()->ExecuteS('
DELETE FROM `'._DB_PREFIX_.'exapaqws`
WHERE `id_order_detail` = '.$delete.'
@ -190,7 +167,9 @@ class AdminAntLogistic extends AdminTab {
AND `shipping_number` = "'.pSQL($delete_number).'"
');
}
} elseif($delete = (int) Tools::getValue('delete_mondialrelay')) {
}
// Suppression MONDIAL RELAY
elseif ($delete = (int) Tools::getValue('delete_mondialrelay')) {
Db::getInstance()->ExecuteS('
DELETE FROM `'._DB_PREFIX_.'mondialrelay_parcel`
WHERE `id_order_detail` = '.$delete.'
@ -209,7 +188,28 @@ class AdminAntLogistic extends AdminTab {
');
}
}
// 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`
@ -250,7 +250,7 @@ class AdminAntLogistic extends AdminTab {
// Generate a new shipping number for product sent with many parcels
if( (Tools::isSubmit('submitReprintShip'))
&& ((int) $cookie->profile == 1 || (int) $cookie->profile == 9 || (int) $cookie->profile == 7 || (int) $cookie->profile == 14)
&& in_array((int)$cookie->profile, array(1,9,7,13,14))
&& (
($id_order = Tools::getValue('id_order_reprint'))
&& ($products = Tools::getValue('products_reprint'))
@ -260,8 +260,8 @@ class AdminAntLogistic extends AdminTab {
$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") {
$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];

View File

@ -89,9 +89,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
AND cl.`id_lang` = 2
');
} elseif(in_array((int) $order->id_carrier, $mr_carriers)) {
/**
* @Override MondialRelay
*/
// MondialRelay
$delivery_infos_mr = Db::getInstance()->getRow('
SELECT mr_s.*, mr_m.*, cl.`name` AS `country_name`
FROM `'._DB_PREFIX_.'mr_selected` mr_s
@ -109,7 +107,6 @@ if(($id_order = (int) Tools::getValue('id_order'))
WHERE s.`id_cart` = '.(int) $order->id_cart.'
');
}
// $delivery_infos_laposte = FALSE;
}
$delivery_infos_exapaq = Db::getInstance()->getRow('
@ -151,41 +148,39 @@ if(($id_order = (int) Tools::getValue('id_order'))
$link = new Link(2);
$products = array();
foreach($order->getProductsDetail() as $p) {
// --- Get quantity sent
// LaPoste
$p['product_quantity_sent'] += (int) Db::getInstance()->getValue('
SELECT IFNULL(SUM(`quantity`), 0)
FROM `'._DB_PREFIX_.'lapostews`
WHERE `id_order_detail` = '.(int) $p['id_order_detail'].'
');
// Exapaq
$p['product_quantity_sent'] += (int) Db::getInstance()->getValue('
SELECT IFNULL(SUM(`quantity`), 0)
FROM `'._DB_PREFIX_.'exapaqws`
WHERE `id_order_detail` = '.(int) $p['id_order_detail'].'
');
/**
* @Override MondialRelay
*/
// MondialRelay
$p['product_quantity_sent'] += (int) Db::getInstance()->getValue('
SELECT IFNULL(SUM(`quantity`), 0)
FROM `'._DB_PREFIX_.'mondialrelay_parcel`
WHERE `id_order_detail` = ' . (int) $p['id_order_detail'] . '
');
/**
* @Override Philea
*/
// Philea
$p['product_quantity_sent'] += (int) Db::getInstance()->getValue('
SELECT IFNULL(SUM(`quantity`), 0)
FROM `'._DB_PREFIX_.'philea_parcel`
WHERE `id_order_detail` = ' . (int) $p['id_order_detail'] . '
');
/**
* @Override Dropshipping
*/
// DropShipping
$p['product_quantity_sent'] += (int) Db::getInstance()->getValue('
SELECT IFNULL(SUM(`quantity`), 0)
FROM `'._DB_PREFIX_.'ant_dropshipping_parcel`
WHERE `id_order_detail` = ' . (int) $p['id_order_detail'] . '
');
// Image
$p['id_image'] = 0;
if((int) $p['product_attribute_id'] != 0) {
@ -237,42 +232,9 @@ if(($id_order = (int) Tools::getValue('id_order'))
$p['carriers'] = $sales_carriers[(int) $p['id_sale']];
$p['location'] = isset($locations[(int) $p['product_id'].'-'.(int) $p['product_attribute_id']])? $locations[(int) $p['product_id'].'-'.(int) $p['product_attribute_id']]: '';
// --- Get Shipping Numbers
$shipping_numbers = array();
foreach(Db::getInstance()->ExecuteS('
SELECT l.`shipping_number`
FROM `'._DB_PREFIX_.'lapostews` l
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`id_order_detail` = l.`id_order_detail`)
LEFT JOIN `'._DB_PREFIX_.'order_history` h ON (h.`id_order` = d.`id_order`)
WHERE h.`id_order` = '.(int) $order->id.'
') as $row) {
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
}
foreach(Db::getInstance()->ExecuteS('
SELECT e.`shipping_number`
FROM `'._DB_PREFIX_.'exapaqws` e
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`id_order_detail` = e.`id_order_detail`)
LEFT JOIN `'._DB_PREFIX_.'order_history` h ON (h.`id_order` = d.`id_order`)
WHERE h.`id_order` = '.(int) $order->id.'
') as $row) {
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
}
/*
* @Override MondialRelay
*/
foreach(Db::getInstance()->ExecuteS('
SELECT l.`shipping_number`
FROM `'._DB_PREFIX_.'mondialrelay_parcel` l
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`id_order_detail` = l.`id_order_detail`)
LEFT JOIN `'._DB_PREFIX_.'order_history` h ON (h.`id_order` = d.`id_order`)
WHERE h.`id_order` = '.(int) $order->id.'
') as $row) {
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
}
/*
* @Override Philea
*/
// Philea
foreach(Db::getInstance()->ExecuteS('
SELECT l.`shipping_number`
FROM `'._DB_PREFIX_.'philea_parcel` l
@ -282,16 +244,46 @@ if(($id_order = (int) Tools::getValue('id_order'))
') as $row) {
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
}
// LaPoste
foreach(Db::getInstance()->ExecuteS('
SELECT l.`shipping_number`
FROM `'._DB_PREFIX_.'lapostews` l
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`id_order_detail` = l.`id_order_detail`)
LEFT JOIN `'._DB_PREFIX_.'order_history` h ON (h.`id_order` = d.`id_order`)
WHERE h.`id_order` = '.(int) $order->id.'
') as $row) {
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
}
// Exapaq
foreach(Db::getInstance()->ExecuteS('
SELECT e.`shipping_number`
FROM `'._DB_PREFIX_.'exapaqws` e
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`id_order_detail` = e.`id_order_detail`)
LEFT JOIN `'._DB_PREFIX_.'order_history` h ON (h.`id_order` = d.`id_order`)
WHERE h.`id_order` = '.(int) $order->id.'
') as $row) {
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
}
// MondialRelay
foreach(Db::getInstance()->ExecuteS('
SELECT l.`shipping_number`
FROM `'._DB_PREFIX_.'mondialrelay_parcel` l
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`id_order_detail` = l.`id_order_detail`)
LEFT JOIN `'._DB_PREFIX_.'order_history` h ON (h.`id_order` = d.`id_order`)
WHERE h.`id_order` = '.(int) $order->id.'
') as $row) {
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
}
if(((int) $p['product_quantity_sent'] === 0)
&& Db::getInstance()->getRow('
if(((int) $p['product_quantity_sent'] === 0) && Db::getInstance()->getRow('
SELECT h.`id_sale`
FROM `'._DB_PREFIX_.'shipping_history` h
WHERE h.`id_sale` = '.((int) $p['id_sale'] === 999999? 0: (int) $p['id_sale']).'
AND h.`id_order` = '.(int) $order->id.'
'.(count($shipping_numbers) > 0? 'AND h.`shipping_number` NOT IN ('.implode(', ', $shipping_numbers).')': '').'
')) {
$p['product_quantity_sent'] = $p['product_quantity'] - ($p['product_quantity_return'] > 0? $p['product_quantity_return']: $p['product_quantity_refunded']);
$p['product_quantity_sent'] = $p['product_quantity'] - ( $p['product_quantity_return'] > 0 ?
$p['product_quantity_return']: $p['product_quantity_refunded'] );
}
/* Pack */
@ -320,62 +312,76 @@ if(($id_order = (int) Tools::getValue('id_order'))
if(count($id_order_details) > 0) {
$logs = array();
// Send by PHILEA
if($l = Db::getInstance()->ExecuteS('
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, e.`firstname`, e.`lastname`, "laposte" AS `carrier`
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, "Philea" as firstname,
(CASE c.`external_module_name` WHEN "soflexibilite" THEN "laposte" ELSE c.`external_module_name` END) as carrier,
"1" as philea
FROM `'._DB_PREFIX_.'philea_parcel` l
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`
LEFT JOIN `'._DB_PREFIX_.'carrier` c ON c.`id_carrier` = o.`id_carrier`
WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).')
AND l.`quantity` > 0
ORDER BY l.`date_add` DESC
')) {
$logs = array_merge($logs, $l);
}
// Send by LAPOSTE
if($l = Db::getInstance()->ExecuteS('
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`,
e.`firstname`, e.`lastname`, "laposte" as carrier, "0" as philea
FROM `'._DB_PREFIX_.'lapostews` l
LEFT JOIN `'._DB_PREFIX_.'employee` e ON l.`id_employee` = e.`id_employee`
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`
LEFT JOIN `ps_carrier` c ON c.`id_carrier` = o.`id_carrier`
WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).')
AND l.`quantity` > 0
ORDER BY l.`date_add` DESC
')) {
$logs = array_merge($logs, $l);
}
// Send by EXAPAQ
if($l = Db::getInstance()->ExecuteS('
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, e.`firstname`, e.`lastname`, "exapaq" AS `carrier`
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`,
e.`firstname`, e.`lastname`, "exapaq" as carrier, "0" as philea
FROM `'._DB_PREFIX_.'exapaqws` l
LEFT JOIN `'._DB_PREFIX_.'employee` e ON l.`id_employee` = e.`id_employee`
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`
LEFT JOIN `'._DB_PREFIX_.'carrier` c ON c.`id_carrier` = o.`id_carrier`
WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).')
AND l.`quantity` > 0
ORDER BY l.`date_add` DESC
')) {
$logs = array_merge($logs, $l);
}
/*
* @Override MondialRelay
*/
// Send by MONDIAL RELAY
if($l = Db::getInstance()->ExecuteS('
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, e.`firstname`, e.`lastname`, "mondialrelay" AS `carrier`
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`,
e.`firstname`, e.`lastname`, "mondialrelay" as carrier, "0" as philea
FROM `'._DB_PREFIX_.'mondialrelay_parcel` l
LEFT JOIN `'._DB_PREFIX_.'employee` e ON l.`id_employee` = e.`id_employee`
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`
LEFT JOIN `ps_carrier` c ON c.`id_carrier` = o.`id_carrier`
WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).')
AND l.`quantity` > 0
ORDER BY l.`date_add` DESC
')) {
$logs = array_merge($logs, $l);
}
/*
* @Override Dropshipping
*/
// Send by DROPSHIPPING
if($l = Db::getInstance()->ExecuteS('
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, "Dropshipping" as firstname
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`,
"Dropshipping" as firstname, "0" as philea
FROM `'._DB_PREFIX_.'ant_dropshipping_parcel` l
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).')
AND l.`quantity` > 0
ORDER BY l.`date_add` DESC
')) {
$logs = array_merge($logs, $l);
}
/*
* @Override Philea
*/
if($l = Db::getInstance()->ExecuteS('
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, "Philea" as firstname, c.`name` as carrier
FROM `'._DB_PREFIX_.'philea_parcel` l
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`
LEFT JOIN `'._DB_PREFIX_.'carrier` c ON c.`id_carrier` = o.`id_carrier`
WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).')
@ -571,7 +577,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
</div>';
echo json_encode(array(
'errors' => FALSE,
'errors' => false,
'html_detail' => (String)$html_detail,
'html_invoice_address' => (String)$html_invoice_address,
'html_delivery_address' => (String)$html_delivery_address,

View File

@ -6,17 +6,13 @@ if(!defined('_PS_VERSION_')) {
global $logistics_carriers;
foreach(array_map(function($value) {
return str_replace('.', '', $value);
},
array_diff(scandir(dirname(__FILE__).'/carriers'), array('.', '..'))) as $lg
) {
}, array_diff(scandir(dirname(__FILE__).'/carriers'), array('.', '..'))) as $lg) {
if(is_dir(dirname(__FILE__).'/carriers/'.$lg)) {
include dirname(__FILE__).'/carriers/'.$lg.'/'.$lg.'.php';
$name = ucfirst($lg).'Carrier';
$logistics_carriers[$lg] = new $name();
}
}
//include dirname(__FILE__).'/carriers/laposte/laposte.php';
//$logistics_carriers['laposte'] = new LaposteCarrier();
include _PS_ROOT_DIR_.'/modules/privatesales/Sale.php';
@ -112,15 +108,6 @@ class AdminLogistics extends AdminTab
$redis->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*/
$data
)))
);
@ -325,24 +312,12 @@ class AdminLogistics extends AdminTab
$logistics_carriers[$parcel_carrier]->addOrderHistory($result[1], $order, $products_sent);
}
} else {
$this->html .= '<p class="error">'.$this->l('An error happened during the label rendering').'</p><br />';
$this->_html .= '<p class="error">'.$this->l('An error happened during the label rendering').'</p><br />';
}
}
// elseif($parcel_carrier=='mondialrelay'
// && (
// ($id_order_detail = Tools::getValue('id_order_detail_reprint'))
// && ($weight = Tools::getValue('weight_reprint'))
// )
// ){
// $result = $logistics_carriers['mondialrelay']->_getRegisteredParcel(new Order($id_order), $id_order_detail, $products, $weight);
// $render = $logistics_carriers['mondialrelay']->renderLabel(new Order($id_order), $weight, $result[1]);
// $this->printLabel($render,true);
// }
}
//$this->printLabel($logistics_carriers['laposte']->renderLabel(new Order((int) $id_order), $weight, $reprint_number));
} elseif(Tools::isSubmit('submitTestLaposte')) {
$this->_html .= '<p class="conf">'.$this->l('Registration complete, label sent to printer').'</p><br />';
//$this->printLabel($logistics_carriers['laposte']->renderLabel(new Order(23336), 0.24, '6A12345123451'));
$this->printLabel($logistics_carriers['laposte']->renderLabel(new Order(223001), 0.24, '6J12345123451'));
} elseif(Tools::isSubmit('submitTestExapaq')) {
$this->_html .= '<p class="conf">'.$this->l('Registration complete, label sent to printer').'</p><br />';
@ -500,10 +475,6 @@ class AdminLogistics extends AdminTab
public function display() {
global $cookie, $logistics_carriers;
/*if(!in_array($cookie->id_employee, array(1, 2, 3, 10, 68, 70, 89, 91))) {
echo 'Fonctionnalité indisponible actuellement'; return;
}*/
$unavailable_carriers = array();
foreach($logistics_carriers as $name => $class) {

View File

@ -1,5 +1,5 @@
<?php
include dirname(__FILE__).'/../../config/config.inc.php';
include_once dirname(__FILE__).'/../../config/config.inc.php';
$laposte_modes = array(
'DOM' => 'SO à domicile',
@ -68,9 +68,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
AND cl.`id_lang` = 2
');
} elseif(in_array((int) $order->id_carrier, $mr_carriers)) {
/**
* @Override MondialRelay
*/
// MondialRelay
$delivery_infos_mr = Db::getInstance()->getRow('
SELECT mr_s.*, mr_m.*, cl.`name` AS `country_name`
FROM `'._DB_PREFIX_.'mr_selected` mr_s
@ -88,7 +86,6 @@ if(($id_order = (int) Tools::getValue('id_order'))
WHERE s.`id_cart` = '.(int) $order->id_cart.'
');
}
// $delivery_infos_laposte = FALSE;
}
$delivery_infos_exapaq = Db::getInstance()->getRow('
@ -387,7 +384,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
);
echo json_encode(array(
'errors' => FALSE,
'errors' => false,
'order' => $order,
'products' => $products,
'status' => $status['name'],