fix and add shipping number list in order

This commit is contained in:
Marion Muszynski 2017-06-07 15:07:19 +02:00
parent e5266e5bbf
commit bed6683539
3 changed files with 24 additions and 6 deletions

View File

@ -1165,13 +1165,18 @@ class AdminOrders extends AdminTab
echo '</fieldset><br />';
/* Display shipping infos */
$sql = "SELECT `shipping_number`, `date_add` FROM `ps_lapostews` WHERE `id_order` =". $order->id;
$sql = "SELECT `shipping_number`, `date_add` FROM `"._DB_PREFIX_."lapostews` WHERE `id_order` =". $order->id;
$sql2 = "SELECT DISTINCT ppp.`shipping_number`, ppp.`date_add`
FROM `ps_philea_parcel` ppp
LEFT JOIN `ps_order_detail` od ON (od.`id_order_detail` = ppp.`id_order_detail`)
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` =". $order->id;
$sql3 = 'SELECT lpr.`shipping_number`, lpr.`date_add`
FROM '._DB_PREFIX_.'lapostews_return lpr
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = lpr.`id_order_detail`)
WHERE od.`id_order` ='. $order->id;
$numbers = Db::getInstance()->ExecuteS($sql);
$numbers2 = Db::getInstance()->ExecuteS($sql2);
$numbers3 = Db::getInstance()->ExecuteS($sql3);
echo '
<fieldset style="width:400px">';
if(count($numbers) > 0){
@ -1186,6 +1191,12 @@ class AdminOrders extends AdminTab
echo '<p><b>Numéro de suivi </b> : '. $number['shipping_number'] .' ajouté le '. $date->format('d m Y') .'</p>';
}
}
if(count($numbers3) > 0){
foreach ($numbers3 as $key => $number) {
$date = new DateTime($number['date_add']);
echo '<p><b>Numéro de suivi </b> : '. $number['shipping_number'] .' ajouté le '. $date->format('d m Y') .'</p>';
}
}
echo '<legend><img src="../img/admin/delivery.gif" /> '.$this->l('Shipping information').'</legend>
'.$this->l('Total weight:').' <b>'.number_format($order->getTotalWeight(), 3).' '.Configuration::get('PS_WEIGHT_UNIT').'</b><br />
'.$this->l('Carrier:').' <b>'.($carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name).'</b><br />

View File

@ -674,6 +674,7 @@ class AdminAntReturnprocess extends AdminTab
$products_names[(int) $p['id_order_detail']] = $p['product_name'];
}
$id_order_return = (int) Tools::getValue('id_order_return');
$logistics_carriers[$parcel_carrier]->logParcel($result[1], $products, $id_order_return);
foreach($products as $k => $v) {
@ -686,7 +687,6 @@ class AdminAntReturnprocess extends AdminTab
HelperFormBootstrap::displaySuccess('Etiquette envoyée à l\'imprimante');
$id_order_return = (int) Tools::getValue('id_order_return');
$orderReturn = new OrderReturn($id_order_return);
$orderReturn->state = 5; // return is ended
if ($orderReturn->save())
@ -809,6 +809,7 @@ class AdminAntReturnprocess extends AdminTab
$carriers_mr = explode(',', Configuration::get('ANT_CARRIERS_MR'));
$order = new Order($orderReturn->id_order);
$cart = new Cart((int)$order->id_cart);
$carrier = new Carrier((int)($order->id_carrier));
$addressDelivery = new Address((int)$order->id_address_delivery);
$addressInvoice = new Address((int)$order->id_address_invoice);
$customer = new Customer((int)$order->id_customer);
@ -1097,6 +1098,12 @@ class AdminAntReturnprocess extends AdminTab
$html .= '<li><strong>'. $number['shipping_number'] .'</strong> ajouté le '. $date->format('d/m/Y') .'</li>';
}
}
if(count($parcel_sent) > 0){
foreach ($parcel_sent as $key => $number) {
$date = new DateTime($number['date_add']);
$html .= '<li><strong>'. $number['shipping_number'] .'</strong> ajouté le '. $date->format('d/m/Y') .'</li>';
}
}
$html .= '</ul>
</div>
</div>
@ -1321,7 +1328,7 @@ class AdminAntReturnprocess extends AdminTab
<tr>
<td>'.$parcel['product_name'].'</td>
<td style="text-align:center;">'.$parcel['quantity'].'</td>
<td style="text-align:center;">'.$parcel['shipping_number'].'</td>
<td style="text-align:center;">'.(!empty($carrier->url) ? '<a href="'.str_replace('@', $parcel['shipping_number'], $carrier->url).'" target="_blank">'.$parcel['shipping_number'].'</a>':$parcel['shipping_number']).'</td>
<td style="text-align:center;">'.date('d/m/Y H:i',strtotime($parcel['date_add'])).'</td>
</tr>';
}

View File

@ -714,7 +714,7 @@ class LaposteCarrier {
* @Override laposte WSU return
*/
foreach($products as $id_order_detail => $qty) {
if($v > 0) {
if($qty > 0) {
Db::getInstance()->ExecuteS('
INSERT `'._DB_PREFIX_.'lapostews_return` VALUES (
'.(int) $id_order_return.',