Merge branch 'ticket-AideContact-SAV' into develop

This commit is contained in:
Marion Muszynski 2016-11-04 12:50:55 +01:00
commit 985eab5cb7

View File

@ -166,16 +166,59 @@ class BlockOrderSummary extends Module {
</style>"; </style>";
$status = array(
2 => array('anticon-credit-card','text-green-light'),
4 => array('anticon-truck','text-purple-light'),
5 => array('anticon-home3','text-purple'),
6 => array('anticon-blocked','text-rose'),
8 => array('anticon-blocked','text-rose'),
17 => array('anticon-truck','text-orange'),
18 => array('anticon-warning','text-orange'),
19 => array('anticon-pause','text-orange'),
);
$currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT'))); $currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT')));
$currentState = OrderHistory::getLastOrderState((int)$params['order']->id); $currentState = OrderHistory::getLastOrderState((int)$params['order']->id);
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)); $tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee));
echo '<div id="blockordersummary"> $addressDelivery = new Address($params['order']->id_address_delivery, (int)($cookie->id_lang));
$addressInvoice = new Address($params['order']->id_address_invoice, (int)($cookie->id_lang));
$shipping_numbers = Db::getInstance()->ExecuteS('
SELECT DISTINCT lpws.`shipping_number`, lpws.`date_add`
FROM `'._DB_PREFIX_.'lapostews` lpws
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = lpws.`id_order_detail`)
WHERE `id_order` ='. (int)$params['order']->id
);
$shipping_numbers2 = Db::getInstance()->ExecuteS('
SELECT DISTINCT ppp.`shipping_number`, ppp.`date_add`
FROM `'._DB_PREFIX_.'philea_parcel` ppp
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = ppp.`id_order_detail`)
WHERE od.`id_order` ='. (int)$params['order']->id
);
//$carrier_socol = array(38,40,45);// local
$carrier_socol = array(45,47,48);// dev
//$carrier_socol = array();// prod
echo '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<div id="blockordersummary">
<div class="content"> <div class="content">
<h4>'.$this->l('Summary of my order' ).' <a target="_blank" href="?tab=AdminOrders&id_order='.(int)$params['order']->id.'&vieworder&token='.$tokenOrders.'">(#'.(int)$params['order']->id.')</a></h4> <h4>'.$this->l('Summary of my order' ).' <a target="_blank" href="?tab=AdminOrders&id_order='.(int)$params['order']->id.'&vieworder&token='.$tokenOrders.'">(#'.(int)$params['order']->id.')</a></h4>
<div class="order-info"> <div class="order-info">
<h5>'.$this->l('Order Status').'</h5> <h5>'.$this->l('Order Status').'</h5>
<p>'.($currentState->id == 8?'<span class="anticon anticon-blocked"></span>':($currentState->id == 18?'<span class="anticon anticon-warning"></span>':'')).' <b>'.$currentState->name.'</b></p> <p class="'.$status[$currentState->id][1].'"><span class="anticon '.$status[$currentState->id][0].'"></span> <b>'.$currentState->name.'</b></p>';
</div> if(count($shipping_numbers) > 0 || count($shipping_numbers2) > 0) {
echo '<h5>'.$this->l('Shipping numbers').'</h5>';
if(count($shipping_numbers) > 0){
foreach ($shipping_numbers as $key => $number) {
$date = new DateTime($number['date_add']);
echo '<p>'. $number['shipping_number'] .' ajouté le '. $date->format('d/m/Y') .'</p>';
}
}
if(count($shipping_numbers2) > 0){
foreach ($shipping_numbers2 as $key => $number) {
$date = new DateTime($number['date_add']);
echo '<p>'. $number['shipping_number'] .' ajouté le '. $date->format('d/m/Y') .'</p>';
}
}
}
echo '</div>
<div class="my-cart"> <div class="my-cart">
<h5>'.$this->l('My Cart').'</h5> <h5>'.$this->l('My Cart').'</h5>
<ul>'; <ul>';
@ -208,7 +251,17 @@ class BlockOrderSummary extends Module {
} }
echo '</div> echo '</div>
<div> <div>
<h5>'.$this->l('My shipping address').'</h5> <h5>'.$this->l('My shipping address').' '.
(
($currentState->id != 8 && $currentState->id != 18 && in_array((int)$cart->id_carrier, $carrier_socol))
?'<a id="modif_address" data-url="scaddressedit.php?id_cart='.(int)$params['order']->id_cart.'"><span class="anticon anticon-pencil" style="font-size: 16px; vertical-align: baseline;cursor:pointer;"></span></a>'
:(
($currentState->id != 8 && $currentState->id != 18 && !in_array((int)$cart->id_carrier, $carrier_socol))
?'<a href="?tab=AdminAddresses&id_address='.$addressDelivery->id.'&addaddress&realedit=1&id_order='.$params['order']->id.($addressDelivery->id == $addressInvoice->id ? '&address_type=1' : '').'&token='.Tools::getAdminToken('AdminAddresses'.(int)(Tab::getIdFromClassName('AdminAddresses')).(int)($cookie->id_employee)).'&back='.urlencode($_SERVER['REQUEST_URI']).'"><span class="anticon anticon-pencil" style="font-size: 16px; vertical-align: baseline;cursor:pointer;"></span></a>'
:''
)
).
'</h5>
<p class="address">'.$data['order_address'].'</p> <p class="address">'.$data['order_address'].'</p>
</div> </div>
<div> <div>
@ -216,7 +269,16 @@ class BlockOrderSummary extends Module {
<p class="order_total">'.$this->l('Total to pay').' <span class="price price_total">'.Tools::displayPrice($cart->getOrderTotal(TRUE),$currency).'</span></p> <p class="order_total">'.$this->l('Total to pay').' <span class="price price_total">'.Tools::displayPrice($cart->getOrderTotal(TRUE),$currency).'</span></p>
</div> </div>
</div> </div>
</div>'; </div>
<script>
$(document).ready(function () {
$("#modif_address").click(function(){
url = $(this).data("url");
var p = window.open(url, "Modification SoColissimo", "width=720, height=360, resizable=1, scrollbars=1");
return false;
});
});
</script>';
} }
} }
@ -225,7 +287,7 @@ class BlockOrderSummary extends Module {
SELECT `id_carrier` SELECT `id_carrier`
FROM `'._DB_PREFIX_.'carrier` FROM `'._DB_PREFIX_.'carrier`
WHERE `id_carrier` = '.(int) $cart->id_carrier.' WHERE `id_carrier` = '.(int) $cart->id_carrier.'
AND `name` LIKE "%so colissimo%" AND `name` LIKE "%colissimo%"
')) { ')) {
$socol = Db::getInstance()->getRow(' $socol = Db::getInstance()->getRow('
SELECT * SELECT *