Not an ajax admin

This commit is contained in:
Michael RICOIS 2018-01-30 11:57:37 +01:00
parent 04399b0f6b
commit 12507d60c3

View File

@ -1,5 +1,5 @@
<?php <?php
include_once dirname(__FILE__).'/../../config/config.inc.php'; require_once dirname(__FILE__).'/../../config/config.inc.php';
$laposte_modes = array( $laposte_modes = array(
'DOM' => 'SO à domicile', 'DOM' => 'SO à domicile',
@ -45,11 +45,9 @@ $ooh = array_map('intval',explode(',', Configuration::get('ANT_CARRIERS_OOH')));
if(($id_order = (int) Tools::getValue('id_order')) if(($id_order = (int) Tools::getValue('id_order'))
&& (Tools::getValue('token') === Tools::getAdminToken('AdminAntLogistic'.(int) Tab::getIdFromClassName('AdminAntLogistic').(int) Tools::getValue('id_employee')))) { && (Tools::getValue('token') === Tools::getAdminToken('AdminAntLogistic'.(int) Tab::getIdFromClassName('AdminAntLogistic').(int) Tools::getValue('id_employee')))) {
global $cookie; $profile = Tools::getValue('id_profile');
$order = new Order($id_order); $order = new Order($id_order);
$profile = Tools::getValue('id_profil');
if(Validate::isLoadedObject($order)) { if(Validate::isLoadedObject($order)) {
$locked_products = array(); $locked_products = array();
$_locked_products = Configuration::get('LOGISTICS_LOCK'); $_locked_products = Configuration::get('LOGISTICS_LOCK');
@ -485,7 +483,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
<td class="shipped text-center">'; <td class="shipped text-center">';
if ($products[$key]['id_shipping'] != 2 if ($products[$key]['id_shipping'] != 2
|| ($products[$key]['id_shipping'] == 2 && ($profile == 1 || $profile == 7)) || ($products[$key]['id_shipping'] == 2 && in_array((int)$profile, array(1,7)))
) { ) {
if(isset($p['items_pack'])){ if(isset($p['items_pack'])){
$html_products.='<input class="input_quantity" readonly="true" onchange="checkParcelCarrier($(this));" name="shipped['.$products[$key]['id_order_detail'].']" type="text" value="0" autocomplete="off" />'; $html_products.='<input class="input_quantity" readonly="true" onchange="checkParcelCarrier($(this));" name="shipped['.$products[$key]['id_order_detail'].']" type="text" value="0" autocomplete="off" />';
@ -523,7 +521,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
<td></td> <td></td>
<td class="shipped text-center">'; <td class="shipped text-center">';
if ($products[$key]['id_shipping'] != 2 if ($products[$key]['id_shipping'] != 2
|| ($products[$key]['id_shipping'] == 2 && ($profile == 1 || $profile == 7)) || ($products[$key]['id_shipping'] == 2 && in_array((int)$profile, array(1,7)))
) { ) {
$html_products.='<input data-item="'.$item['id_product'].'" class="input_quantity" readonly="true" onchange="checkQuantityPack($(this),'.$item['id_product'].','.$p['id_order_detail'].','.$item['pack_quantity'].','.(in_array($products[$key]['product_id'], $locked_products)? 0: max(($products[$key]['product_quantity']*$item['pack_quantity'] - ($products[$key]['product_quantity_refunded']*$item['pack_quantity'] > 0? $products[$key]['product_quantity_refunded']*$item['pack_quantity']: $products[$key]['product_quantity_return']*$item['pack_quantity']) - $products[$key]['product_quantity_sent']*$item['pack_quantity']), 0)).');" type="text" value="0" autocomplete="off" /><span class="qtyblock"><a onclick="qtyUp($(this), '.(in_array($products[$key]['product_id'], $locked_products)? 0: max(($products[$key]['product_quantity']*$item['pack_quantity'] - ($products[$key]['product_quantity_refunded']*$item['pack_quantity'] > 0? $products[$key]['product_quantity_refunded']*$item['pack_quantity']: $products[$key]['product_quantity_return']*$item['pack_quantity']) - $products[$key]['product_quantity_sent']*$item['pack_quantity']), 0)).'); return false;">+</a><a class="qty_down" onclick="qtyDown($(this)); return false;">-</a></span>'; $html_products.='<input data-item="'.$item['id_product'].'" class="input_quantity" readonly="true" onchange="checkQuantityPack($(this),'.$item['id_product'].','.$p['id_order_detail'].','.$item['pack_quantity'].','.(in_array($products[$key]['product_id'], $locked_products)? 0: max(($products[$key]['product_quantity']*$item['pack_quantity'] - ($products[$key]['product_quantity_refunded']*$item['pack_quantity'] > 0? $products[$key]['product_quantity_refunded']*$item['pack_quantity']: $products[$key]['product_quantity_return']*$item['pack_quantity']) - $products[$key]['product_quantity_sent']*$item['pack_quantity']), 0)).');" type="text" value="0" autocomplete="off" /><span class="qtyblock"><a onclick="qtyUp($(this), '.(in_array($products[$key]['product_id'], $locked_products)? 0: max(($products[$key]['product_quantity']*$item['pack_quantity'] - ($products[$key]['product_quantity_refunded']*$item['pack_quantity'] > 0? $products[$key]['product_quantity_refunded']*$item['pack_quantity']: $products[$key]['product_quantity_return']*$item['pack_quantity']) - $products[$key]['product_quantity_sent']*$item['pack_quantity']), 0)).'); return false;">+</a><a class="qty_down" onclick="qtyDown($(this)); return false;">-</a></span>';
} }
@ -547,18 +545,18 @@ if(($id_order = (int) Tools::getValue('id_order'))
<td>'.$logs[$key]['product_supplier_reference'].'</td> <td>'.$logs[$key]['product_supplier_reference'].'</td>
<td>'.$logs[$key]['shipping_number'].'</td> <td>'.$logs[$key]['shipping_number'].'</td>
<td>'.(($logs[$key]['carrier'] == "laposte" || $logs[$key]['carrier'] == "mondialrelay") ? $carrier_names[$logs[$key]['carrier']] : $logs[$key]['carrier']) .'</td> <td>'.(($logs[$key]['carrier'] == "laposte" || $logs[$key]['carrier'] == "mondialrelay") ? $carrier_names[$logs[$key]['carrier']] : $logs[$key]['carrier']) .'</td>
'.(( in_array((int)$cookie->profile, array(1,9,7,13,14)) ) ? '.(( in_array((int)$profile, array(1,9,7,13,14)) ) ?
(($logs[$key]['carrier'] == "laposte" || $logs[$key]['carrier'] == "mondialrelay") ? '<td><a class="need_token" href="/adm/index.php?tab=AdminAntLogistic&id_order='.$order->id.'&delete_'.$logs[$key]['carrier'].'='.$logs[$key]['id_order_detail'].'&delete_number='.$logs[$key]['shipping_number'].'"><span class="anticon anticon-bin"></span></a></td>': '<td></td>'):'<td></td>').' (($logs[$key]['carrier'] == "laposte" || $logs[$key]['carrier'] == "mondialrelay") ? '<td><a class="need_token" href="/adm/index.php?tab=AdminAntLogistic&id_order='.$order->id.'&delete_'.$logs[$key]['carrier'].'='.$logs[$key]['id_order_detail'].'&delete_number='.$logs[$key]['shipping_number'].'"><span class="anticon anticon-bin"></span></a></td>': '<td></td>'):'<td></td>').'
'.(( in_array((int)$cookie->profile, array(1,9,7,13,14)) )? '.(( in_array((int)$profile, array(1,9,7,13,14)) )?
(($logs[$key]['carrier'] == "laposte" || $logs[$key]['carrier'] == "mondialrelay") ? '<td><a title="Re print" data-toggle="modal" data-target="#modalRePrint" class="reprint" data-product="'.str_replace(" - ", "<br />",$logs[$key]['product_name']).'" data-weight="'.((float)$logs[$key]['weight']>0?(float)$logs[$key]['weight']:0.24).'" data-ref="'.$logs[$key]['product_reference'] .'" data-id_order="'.$order->id.'" data-carrier="'.$logs[$key]['carrier'].'" data-id_order_detail="'.$logs[$key]['id_order_detail'].'"><span class="anticon anticon-printer"></span></a></td>': '<td></td>'):'<td></td>').' (($logs[$key]['carrier'] == "laposte" || $logs[$key]['carrier'] == "mondialrelay") ? '<td><a title="Re print" data-toggle="modal" data-target="#modalRePrint" class="reprint" data-product="'.str_replace(" - ", "<br />",$logs[$key]['product_name']).'" data-weight="'.((float)$logs[$key]['weight']>0?(float)$logs[$key]['weight']:0.24).'" data-ref="'.$logs[$key]['product_reference'] .'" data-id_order="'.$order->id.'" data-carrier="'.$logs[$key]['carrier'].'" data-id_order_detail="'.$logs[$key]['id_order_detail'].'"><span class="anticon anticon-printer"></span></a></td>': '<td></td>'):'<td></td>').'
</tr>'; </tr>';
} }
$html_form ='<div class="form-inline">'; $html_form ='<div class="form-inline">';
if( if((in_array($order->id_carrier, $laposte_carriers)
(in_array($order->id_carrier, $laposte_carriers) || in_array($order->id_carrier, $mr_carriers)) || in_array($order->id_carrier, $mr_carriers))
&& in_array((int)($delivery_address->id_country), array(1, 2, 3, 6, 8, 10, 12, 13, 15, 17, 26, 40, 148, 245)) && in_array((int)($delivery_address->id_country),
){ array(1, 2, 3, 6, 8, 10, 12, 13, 15, 17, 26, 40, 148, 245)) ){
$html_form.= $html_form.=
'<div class="form-group"> '<div class="form-group">
<label for="parcel_carrier">Transporteur :</label> <label for="parcel_carrier">Transporteur :</label>
@ -581,12 +579,12 @@ if(($id_order = (int) Tools::getValue('id_order'))
echo json_encode(array( echo json_encode(array(
'errors' => false, 'errors' => false,
'html_detail' => (String)$html_detail, 'html_detail' => (string)$html_detail,
'html_invoice_address' => (String)$html_invoice_address, 'html_invoice_address' => (string)$html_invoice_address,
'html_delivery_address' => (String)$html_delivery_address, 'html_delivery_address' => (string)$html_delivery_address,
'html_products' => (String)$html_products, 'html_products' => (string)$html_products,
'html_logs' => (String)$html_logs, 'html_logs' => (string)$html_logs,
'html_form' => (String)$html_form, 'html_form' => (string)$html_form,
'order' => $order, 'order' => $order,
'products' => $products, 'products' => $products,
'status' => $status['name'], 'status' => $status['name'],