Merge branch 'ticket-11985-MondialRelay_part2' into develop
This commit is contained in:
commit
0347a73068
@ -18,6 +18,7 @@ class AdminAntConfigurations extends AdminTab
|
||||
Configuration::updateValue('ANT_CARRIERS_SOCOL', Tools::getValue('carriers_socol'));
|
||||
Configuration::updateValue('ANT_CARRIERS_MR', Tools::getValue('carriers_mr'));
|
||||
Configuration::updateValue('ANT_CARRIERS_OOH', Tools::getValue('carriers_ooh'));
|
||||
Configuration::updateValue('ANT_CARRIERS_SPECIAL', Tools::getValue('carriers_special'));
|
||||
|
||||
HelperFormBootstrap::echoConfirmation($this->l('Configurations mises à jour'));
|
||||
|
||||
@ -327,6 +328,14 @@ class AdminAntConfigurations extends AdminTab
|
||||
'label' => $this->l('Transporteur OOH :'),
|
||||
'default' => Configuration::get('ANT_CARRIERS_OOH')
|
||||
),
|
||||
array(
|
||||
'type' => 'simpleText',
|
||||
'name' => 'carriers_special',
|
||||
'label-class' => 'col-md-6',
|
||||
'input-class' => 'col-md-4',
|
||||
'label' => $this->l('Transporteur speciaux :'),
|
||||
'default' => Configuration::get('ANT_CARRIERS_SPECIAL')
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
|
@ -122,7 +122,7 @@ 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).'n'."\n" // Inch mode
|
||||
.chr(2).'O0100'."\n" // Start position
|
||||
.chr(2).'L'."\n"
|
||||
.'C0000'."\n"
|
||||
@ -130,7 +130,8 @@ class AdminLogistics extends AdminTab {
|
||||
.chr(2).'L'."\n"
|
||||
.$this->isoreplace($data)
|
||||
.'Q0001'."\n" // Number of labels to print
|
||||
.'E'."\n" // End
|
||||
.'E'."\n" // End*/
|
||||
$data
|
||||
)))
|
||||
);
|
||||
|
||||
@ -509,7 +510,7 @@ class AdminLogistics extends AdminTab {
|
||||
|
||||
var carriers_laposte = $.parseJSON("'.addslashes(json_encode(unserialize(Configuration::get('LAPOSTEWS_CARRIERS')))).'");
|
||||
var carriers_exapaq = $.parseJSON("'.addslashes(json_encode(unserialize(Configuration::get('EXAPAQWS_CARRIERS')))).'");
|
||||
var mondialrelayws_carriers = $.parseJSON("'.addslashes(json_encode(unserialize(Configuration::get('MONDIALRELAYWS_CARRIERS')))).'");
|
||||
var carriers_mondialrelay = $.parseJSON("'.addslashes(json_encode(unserialize(Configuration::get('MONDIALRELAYWS_CARRIERS')))).'");
|
||||
|
||||
var locked_products = $.parseJSON("'.addslashes(json_encode($locked_products)).'");
|
||||
var sales_list = $.parseJSON("'.addslashes(json_encode($sales_list)).'");
|
||||
|
@ -21,6 +21,14 @@ $laposte_modes = array(
|
||||
'COP' => 'Colissimo Expert Interne',
|
||||
);
|
||||
|
||||
$mr_modes = array(
|
||||
'24R' => '24R : Livraison dans un Point Relais',
|
||||
'DRI' => 'DRI : Livraison Colis Drive',
|
||||
'LD1' => 'LD1 : Livraison à domicile RDC (1 personne)',
|
||||
'LDS' => 'LDS : Livraison à domicile spécialisée (2 personnes)',
|
||||
'HOM' => 'HOM : Livraison à domicile spécialisée',
|
||||
);
|
||||
|
||||
function stripaccents($str) {
|
||||
return preg_replace(
|
||||
'~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);~i',
|
||||
@ -29,6 +37,7 @@ function stripaccents($str) {
|
||||
);
|
||||
}
|
||||
|
||||
$mr_carriers = array_map('intval',explode(',', Configuration::get('ANT_CARRIERS_MR')));
|
||||
|
||||
if(($id_order = (int) Tools::getValue('id_order'))
|
||||
&& (Tools::getValue('token') === Tools::getAdminToken('AdminLogistics'.(int) Tab::getIdFromClassName('AdminLogistics').(int) Tools::getValue('id_employee')))) {
|
||||
@ -41,6 +50,10 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
WHERE `id_customer` = '.(int) $order->id_customer.'
|
||||
');
|
||||
|
||||
$delivery_infos_laposte = FALSE;
|
||||
$delivery_infos_exapaq = FALSE;
|
||||
$delivery_infos_mr = FALSE;
|
||||
|
||||
if($order->id_carrier == Configuration::get('SOCOLISSIMO_CARRIER_ID')) {
|
||||
$delivery_infos_laposte = Db::getInstance()->getRow('
|
||||
SELECT i.*, cl.`name` AS `country_name`
|
||||
@ -52,8 +65,23 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
WHERE i.`id_cart` = '.(int) $order->id_cart.'
|
||||
AND cl.`id_lang` = 2
|
||||
');
|
||||
} else {
|
||||
$delivery_infos_laposte = FALSE;
|
||||
} elseif(in_array((int) $order->id_carrier, $mr_carriers)) {
|
||||
/**
|
||||
* @Override MondialRelay
|
||||
*/
|
||||
$delivery_infos_mr = Db::getInstance()->getRow('
|
||||
SELECT mr_s.*, mr_m.*, cl.`name` AS `country_name`
|
||||
FROM `'._DB_PREFIX_.'mr_selected` mr_s
|
||||
LEFT JOIN `'._DB_PREFIX_.'country` c
|
||||
ON mr_s.`MR_Selected_Pays` = c.`iso_code`
|
||||
LEFT JOIN `'._DB_PREFIX_.'mr_method` mr_m
|
||||
ON mr_m.`id_mr_method` = mr_s.`id_method`
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl
|
||||
ON c.`id_country` = cl.`id_country`
|
||||
WHERE mr_s.`id_cart` = '.(int) $order->id_cart.'
|
||||
AND cl.`id_lang` = 2
|
||||
');
|
||||
// $delivery_infos_laposte = FALSE;
|
||||
}
|
||||
|
||||
$delivery_infos_exapaq = Db::getInstance()->getRow('
|
||||
@ -202,6 +230,15 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
WHERE `id_order_detail` = '.(int) $p['id_order_detail'].'
|
||||
');
|
||||
|
||||
/**
|
||||
* @Override MondialRelay
|
||||
*/
|
||||
$p['product_quantity_sent'] += (int) Db::getInstance()->getValue('
|
||||
SELECT IFNULL(SUM(`quantity`), 0) AS `total`
|
||||
FROM `'._DB_PREFIX_.'mondialrelay_parcel`
|
||||
WHERE `id_order_detail` = ' . (int) $p['id_order_detail'] . '
|
||||
');
|
||||
|
||||
$p['id_image'] = 0;
|
||||
|
||||
if((int) $p['product_attribute_id'] != 0) {
|
||||
@ -274,21 +311,29 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
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`
|
||||
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 l.`shipping_number`
|
||||
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`
|
||||
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']).'"';
|
||||
@ -348,31 +393,52 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
')) {
|
||||
$logs = array_merge($logs, $l);
|
||||
}
|
||||
/*
|
||||
* @Override MondialRelay
|
||||
*/
|
||||
if($l = Db::getInstance()->ExecuteS('
|
||||
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, e.`firstname`, e.`lastname`, "mondialrelay" AS `carrier`
|
||||
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`
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
$logs = array();
|
||||
}
|
||||
|
||||
echo json_encode(array(
|
||||
'errors' => FALSE,
|
||||
'order' => $order,
|
||||
'products' => $products,
|
||||
'status' => $status['name'],
|
||||
'carrier' => $carriers[$order->id_carrier].($delivery_infos_laposte
|
||||
// Carriers
|
||||
$_carriers = $carriers[$order->id_carrier].($delivery_infos_laposte
|
||||
? ' ('.$laposte_modes[$delivery_infos_laposte['delivery_mode']].')'
|
||||
: ($delivery_infos_exapaq
|
||||
? ' (ICI Relais)'
|
||||
: ''
|
||||
: ($delivery_infos_mr
|
||||
? ' ('.$mr_modes[$delivery_infos_mr['dlv_mode']].')'
|
||||
: ''
|
||||
)
|
||||
)
|
||||
),
|
||||
'carriers' => $carriers,
|
||||
'customer' => $customer['firstname'].' '.$customer['lastname'].' ('.$customer['email'].')',
|
||||
'invoice_address' => $invoice_address,
|
||||
'delivery_address' => $delivery_address,
|
||||
'delivery_infos_laposte' => $delivery_infos_laposte,
|
||||
'delivery_infos_exapaq' => $delivery_infos_exapaq,
|
||||
'weight' => $order->getTotalWeight(),
|
||||
'logs' => $logs,
|
||||
'france_address_error' => $france_address_error,
|
||||
);
|
||||
|
||||
echo json_encode(array(
|
||||
'errors' => FALSE,
|
||||
'order' => $order,
|
||||
'products' => $products,
|
||||
'status' => $status['name'],
|
||||
'carrier' => $_carriers,
|
||||
'carriers' => $carriers,
|
||||
'customer' => $customer['firstname'].' '.$customer['lastname'].' ('.$customer['email'].')',
|
||||
'invoice_address' => $invoice_address,
|
||||
'delivery_address' => $delivery_address,
|
||||
'delivery_infos_laposte' => $delivery_infos_laposte,
|
||||
'delivery_infos_exapaq' => $delivery_infos_exapaq,
|
||||
'delivery_infos_mr' => $delivery_infos_mr,
|
||||
'weight' => $order->getTotalWeight(),
|
||||
'logs' => $logs,
|
||||
'france_address_error' => $france_address_error,
|
||||
'france_address_suggestions' => $france_address_suggestions,
|
||||
));
|
||||
} else {
|
||||
|
@ -741,7 +741,7 @@ class LaposteCarrier {
|
||||
* @Override laposte WSU
|
||||
*/
|
||||
if((int)Configuration::get('LAPOSTEWS_WSU_ENABLE') == 1) {
|
||||
return $shipping_date['label'];
|
||||
return $shipping_data['label'];
|
||||
}
|
||||
|
||||
$id_order = (int) $order->id;
|
||||
|
@ -325,8 +325,8 @@ class Parcel {
|
||||
$carrier_config = array(
|
||||
'api' => array(
|
||||
'wsu' => array(
|
||||
'contract' => (int) Configuration::get('LAPOSTEWS_API_CONTRACT_WSU');,
|
||||
'password' => Configuration::get('LAPOSTEWS_API_PASSWORD_WSU');,
|
||||
'contract' => (int) Configuration::get('LAPOSTEWS_API_CONTRACT_WSU'),
|
||||
'password' => Configuration::get('LAPOSTEWS_API_PASSWORD_WSU'),
|
||||
)
|
||||
),
|
||||
'exp_commercial_name' => Configuration::get('LAPOSTEWS_COMMERCIALNAME'),
|
||||
|
@ -5,8 +5,7 @@ include_once dirname(__FILE__).'/../../modules/privatesales/Sale.php';
|
||||
|
||||
class Cart extends CartCore {
|
||||
|
||||
//public static $carrier_special = array(51, 52, 58);
|
||||
public static $carrier_special = array(29, 30, 36,37);
|
||||
public static $carrier_special = array(51, 52, 58);
|
||||
protected static $_cache_getSimpleQuantities = NULL;
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,7 @@ class ParentOrderController extends ParentOrderControllerCore {
|
||||
$address = new Address((int)(self::$cart->id_address_delivery));
|
||||
$id_zone = Address::getZoneById((int)($address->id));
|
||||
$carriers = Carrier::getCarriersForOrder($id_zone, $customer->getGroups());
|
||||
$carriers_special = Cart::$carrier_special;
|
||||
$carriers_special = array_map('intval',explode(',', Configuration::get('ANT_CARRIERS_SPECIAL')));
|
||||
|
||||
$only_gifts = TRUE;
|
||||
foreach(self::$cart->getProducts() as $p) {
|
||||
|
Loading…
Reference in New Issue
Block a user