fix from prod adminOrders

This commit is contained in:
root 2017-12-07 10:37:27 +01:00
parent 8014d95932
commit aa2f9b98cf

View File

@ -1298,10 +1298,10 @@ class AdminOrders extends AdminTab
<div class="row">
<div class="col-md-6" style="padding-right:0;">
<div style="background:#efefef;padding:10px;">
'.($order->appli?'<p style="margin-bottom:0px;"><span class="anticon anticon-mobile"></span> '.$this->l('Commande faite via l\'appli').'</p>':'').'
'.($order->appli?'<p style="margin-bottom:0px;"><span class="anticon anticon-mobile"></span> '.$this->l('Commande faite via l\'appli').'</p>':'<p style="margin-bottom:0px;"><span class="anticon anticon-display"></span> '.$this->l('Commande faite via le site').'</p>').'
<p style="margin-bottom:0px;"><span class="anticon anticon-credit-card"></span> '.Tools::substr($order->payment, 0, 32).' '.($order->module ? '('.$order->module.')' : '').'</p>
<p><span class="anticon anticon-cart"></span> <a href="?tab=AdminCarts&id_cart='.$cart->id.'&viewcart&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)($cookie->id_employee)).'">'.$this->l('Cart #').sprintf('%06d', $cart->id).'</a></p>
<p style="margin-bottom:0px;"><span class="anticon anticon-cross '.($order->recyclable ? 'text-green-light' : 'text-rose').'"></span> '.$this->l('Recycled package').'</p>
<p style="margin-bottom:0px;"><span class="anticon anticon-'.($order->recyclable ? 'checkmark text-green-light' : 'cross text-rose').'"></span> '.$this->l('Recycled package').'</p>
<p><span class="anticon anticon-gift '.($order->gift ? 'text-green-light' : 'text-rose').'"></span> '.(!empty($order->gift_message) ? ' <a role="button" data-toggle="collapse" href="#collapseGiftMessage">'.$this->l('Gift wrapping').'</a>':$this->l('Gift wrapping')).'</p>
</div>
</div>
@ -1509,9 +1509,9 @@ class AdminOrders extends AdminTab
'.($order->hasBeenPaid() ? '<td style="vertical-align:middle;color:#444;" align="center" class="productQuantity"><span class="text-rose">'.(int)($product['product_quantity_refunded']).'</span> | <span class="text-rose">'.(int)($product['product_quantity_return']).'</span></td>' : '').'
<td style="vertical-align:middle;color:#444;" align="center" class="productQuantity">'.(int)$stock['quantity'].'</td>
<td style=" width:70px;vertical-align:middle;color:#444;" align="center">'.Tools::displayPrice(Tools::ps_round($product_price, 2) * ((int)($product['product_quantity']) - $product['customizationQuantityTotal']), $currency, false).'</td>
<td width="70" style="vertical-align:middle;color:#444;">
<input class="form-control input-quantity" type="number" data-ean="'.$product['product_ean13'].'" id="cancelQuantity_'.(int)($product['id_order_detail']).'" name="cancelQuantity['.(int)($product['id_order_detail']).']" min="0" max="'.((int)($product['product_quantity']) - (int)($product['product_quantity_return'] + $product['product_quantity_refunded'])).'" value="0" '.(((int)($product['product_quantity_return'] + $product['product_quantity_refunded']) >= (int)($product['product_quantity'])) ? 'disabled="disabled" ' : '').'/>
'.(((int)($product['product_quantity_return'] + $product['product_quantity_refunded']) >= (int)($product['product_quantity'])) ? '' : '<input class="form-control" type="hidden" id="id_order_detail_'.(int)($product['id_order_detail']).'" name="id_order_detail['.(int)($product['id_order_detail']).']" value="'.$product['id_order_detail'].'" />').'
<td width="100" style="vertical-align:middle;color:#444;">
<input style="width: 50px;display: inline;" class="form-control input-quantity" type="number" data-ean="'.$product['product_ean13'].'" onChange="changeCancelQuantity(this,'.(int)($product['id_order_detail']).','.(((int)($product['product_quantity_return'] + $product['product_quantity_refunded']) >= (int)($product['product_quantity'])) ?0:1).');" id="cancelQuantity_'.(int)($product['id_order_detail']).'" name="cancelQuantity['.(int)($product['id_order_detail']).']" min="0" max="'.((int)($product['product_quantity']) - (int)($product['product_quantity_return'] + $product['product_quantity_refunded'])).'" value="0" '.(((int)($product['product_quantity_return'] + $product['product_quantity_refunded']) >= (int)($product['product_quantity'])) ? 'disabled="disabled" ' : '').'/>
<span>('.((int)($product['product_quantity_return'] + $product['product_quantity_refunded'])).'/'.$quantity.')</span>
</td>
</tr>';
}
@ -1615,19 +1615,19 @@ class AdminOrders extends AdminTab
$html .= '<p class="text-center">Pas de remboursement</p>';
}
} elseif($order->module && $order->module=="paypal") {
$messages = Db::getInstance()->ExecuteS('
$paypal_messages = Db::getInstance()->ExecuteS('
SELECT `message`, `date_add`
FROM `ps_message`
WHERE `id_order` = '.$order->id.'
AND (`message` LIKE "%Refund operation%" || `message` LIKE "%Cancel products%")
ORDER BY `date_add` DESC
');
if($messages && !empty($messages)) {
foreach ($messages as $message) {
if($paypal_messages && !empty($paypal_message)) {
foreach ($paypal_message as $message) {
$html .= '<p>('.date('d/m/Y',strtotime($message['message'])).'):<br>'.$message['message'].'</p>';
}
}
if(empty($messages)){
if(empty($paypal_messages)){
$html .= '<p class="text-center">Pas de remboursement</p>';
}
@ -1653,7 +1653,7 @@ class AdminOrders extends AdminTab
<div class="clearfix"></div>
</div>
<div class="panel-content">
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&token='.$this->token.'" method="post" onsubmit="if (getE(\'visibility\').checked == true) return confirm(\''.$this->l('Do you want to send this message to the customer?', __CLASS__, true, false).'\');">
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" onsubmit="if (getE(\'visibility\').checked == true) return confirm(\''.$this->l('Do you want to send this message to the customer?', __CLASS__, true, false).'\');">
<div id="message_m" style="display: '.(Tools::getValue('message') ? 'none' : 'block').'; overflow: auto;">
<a href="#" onclick="$(\'#message\').slideToggle();$(\'#message_m\').slideToggle();return false"><b>'.$this->l('Click here').'</b> '.$this->l('to add a comment or send a message to the customer').'</a>
</div>
@ -1953,6 +1953,21 @@ class AdminOrders extends AdminTab
$helper->_js .= '
<script type="text/javascript">
function changeCancelQuantity(el,id_order_detail,can_change){
console.log(can_change);
console.log($(el).val());
if(can_change == 1){
var input_html = \'\';
if($(el).val()>0){
if($("#id_order_detail_"+id_order_detail).length==0){
input_html+=\'<input class="form-control" type="hidden" id="id_order_detail_\'+id_order_detail+\'" name="id_order_detail[\'+id_order_detail+\']" value="\'+id_order_detail+\'" />\';
$(el).parent().append(input_html);
}
} else {
$("#id_order_detail_"+id_order_detail).remove();
}
}
}
$(function() {
$("#changeAddress").click(function(){
url = $(this).data("url");