part 2 of inte

This commit is contained in:
Marion Muszynski 2017-11-13 17:13:07 +01:00
parent 6330105f81
commit 3a9f7ef77c
3 changed files with 130 additions and 71 deletions

View File

@ -1066,7 +1066,8 @@ class AdminOrders extends AdminTab
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)$order->id
WHERE `id_order` ='. (int)$order->id.'
GROUP BY lpws.`shipping_number`'
) as $row){
$shipping_numbers[$row['shipping_number']] = $row;
}
@ -1074,7 +1075,8 @@ class AdminOrders extends AdminTab
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)$order->id
WHERE od.`id_order` ='. (int)$order->id.'
GROUP BY ppp.`shipping_number`'
) as $row){
$shipping_numbers[$row['shipping_number']] = $row;
}
@ -1082,7 +1084,8 @@ class AdminOrders extends AdminTab
SELECT DISTINCT mrp.`shipping_number`, mrp.`date_add`
FROM `'._DB_PREFIX_.'mondialrelay_parcel` mrp
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = mrp.`id_order_detail`)
WHERE od.`id_order` ='. (int)$order->id
WHERE od.`id_order` ='. (int)$order->id.'
GROUP BY mrp.`shipping_number`'
) as $row){
$shipping_numbers[$row['shipping_number']] = $row;
}
@ -1345,8 +1348,9 @@ class AdminOrders extends AdminTab
// shipping numbers
$html.='
<div class="col-md-7">
<table class="table table-condensed th-grey" style="width:100%;margin-bottom:5px;">
<div class="col-md-7">';
if(!empty($shipping_numbers)){
$html .= '<table class="table table-condensed th-grey" style="width:100%;margin-bottom:5px;">
<tbody>
<tr>
<th style="font-size:12px;">'.$this->l('Date').'</th>
@ -1365,8 +1369,10 @@ class AdminOrders extends AdminTab
<td style="font-size:11px;"><a target="_blank" href="'.$link.'">'.$number['shipping_number'].'</a></td>
</tr>';
}
$html .= '</tbody>
$html .= '
</tbody>
</table>';
}
/* Display shipping number field */
if ($carrier->url && $order->hasBeenShipped()){
@ -1410,7 +1416,7 @@ class AdminOrders extends AdminTab
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;">
'.$order->printCarrier($order->id_carrier,array()).' Adresse Livraison
'.($cart->id_carrier!=(int)Configuration::get('ANT_CARRIER_DOM') && in_array($cart->id_carrier,$carriers_socol)?'<a style="color:#fff;cursor:pointer;" class="pull-right" id="changeAddress" data-url="scaddressedit.php?id_cart='.(int)$order->id_cart.'"><i class="glyphicon glyphicon-edit"></i></a>':'').'
'.(in_array($cart->id_carrier,$carriers_mr)?'<a style="color:#fff;" class="pull-right" id="changeAddress" data-url="mraddressedit.php?id_cart='.(int)$order->id_cart.'"><i class="glyphicon glyphicon-edit"></i></a>':'').'
'.(in_array($cart->id_carrier,$carriers_mr)?'<a style="color:#fff;cursor:pointer" class="pull-right" id="changeAddress" data-url="mraddressedit.php?id_cart='.(int)$order->id_cart.'"><i class="glyphicon glyphicon-edit"></i></a>':'').'
</h5>
<p style="padding:5px 20px;background:#efefef;">'.$data['order_address'].'</p>
</div>
@ -1496,7 +1502,8 @@ class AdminOrders extends AdminTab
<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" 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" ' : '').'/>
<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>
</tr>';
}
@ -1532,7 +1539,7 @@ class AdminOrders extends AdminTab
$html .= '<div style="margin-top:5px;"><input class="btn btn-primary pull-right" type="submit" name="cancelProduct" value="'.($order->hasBeenDelivered() ? $this->l('Return products') : ($order->hasBeenPaid() ? $this->l('Refund products') : $this->l('Cancel products'))).'"/></div>';
}
$html .= '
$html .= '<input type="hidden" name="id_order" value="'.(int)($order->id).'" />
</div>';
$html .= '
</div>
@ -1555,12 +1562,31 @@ class AdminOrders extends AdminTab
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;">'.($order->module ? ($order->module=="paybox"?'<span class="anticon anticon-credit-card"></span> ':'<span class="anticon anticon-paypal"></span> ') : '').' Info Remboursement</h5>';
$slips = OrderSlip::getOrdersSlip($order->id_customer, $order->id);
if (sizeof($slips)){
$html .= '<div style="padding:10px 20px;font-size: 12px;" class="col-md-4">';
foreach ($slips as $slip){
$html .= '<b>'.Tools::displayDate($slip['date_upd'], $cookie->id_lang).'</b> : <b><a href="pdf.php?id_order_slip='.$slip['id_order_slip'].'">'.$this->l('#').sprintf('%06d', $slip['id_order_slip']).'</a></b><br />';
$html .= '';
}
$html .= '</div>';
$html .= '<div style="padding:0px 20px 10px;font-size: 12px;" class="col-md-4">
<table class="table table-condensed th-grey" width="100%">
<tbody>
<tr>
<th>Date</th>
<th>ID</th>
<th>Raison</th>
</tr>';
foreach ($slips as $slip){
$reason = Db::getInstance()->getRow('
SELECT *
FROM `'._DB_PREFIX_.'order_slip` s
LEFT JOIN `'._DB_PREFIX_.'refundreason` r ON s.`id_order_slip` = r.`id_order_slip`
WHERE s.`id_order_slip` ='.(int)$slip['id_order_slip']
);
$html .= '
<tr>
<td><b>'.Tools::displayDate($slip['date_upd'], $cookie->id_lang).'</b></td>
<td><b><a href="pdf.php?id_order_slip='.$slip['id_order_slip'].'">'.$this->l('#').sprintf('%06d', $slip['id_order_slip']).'</a></b></td>
<td>'.($reason?$this->l('#'.$reason['id_reason']):'').'</td>
</tr>';
}
$html .= '</tbody>
</table>
</div>';
}
$html .= '<div style="padding:10px 20px;background:#efefef;font-size: 12px;" '.(sizeof($slips)?'class="col-md-8"':'').'>';
if($order->module && $order->module=="paybox"){
@ -1613,7 +1639,7 @@ class AdminOrders extends AdminTab
$html.= '
<div class="row">
<div class="col-md-6">
<div class="panel" style="min-height:150px;">
<div class="panel">
<div class="panel-title">
<h2><span style="cursor: pointer;" onclick="$(\'#message\').slideToggle();$(\'#message_m\').slideToggle();return false"><span class="anticon anticon-bubbles"></span> Nouveau Message</span></h2>
<div class="clearfix"></div>
@ -1646,47 +1672,38 @@ class AdminOrders extends AdminTab
</div>
</form>
</div>
</div>
</div>';
/* Display list of messages */
$html.='
<div class="col-md-6">
<div class="panel">
<div class="panel-title">
<h2><span class="anticon anticon-bubble2"></span> '.$this->l('Messages').'</h2>
<div class="clearfix"></div>
</div>
<div class="panel-content">';
if (sizeof($messages)) {
foreach ($messages as $message)
{
$html.= '<div style="background:#efefef;padding:5px;margin-bottom:10px;overflow:auto;" '.($message['is_new_for_me'] ?'class="new_message"':'').'>';
if ($message['is_new_for_me']){
$html.= '<a class="new_message" title="'.$this->l('Mark this message as \'viewed\'').'" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&token='.$this->token.'&messageReaded='.(int)($message['id_message']).'"><img src="../img/admin/enabled.gif" alt="" /></a>';
}
$html.= '
<a href="#collaspeMessage_'.$message['id_message'].'" data-toggle="collapse">
<span class="anticon anticon-bubble"></span> '.$this->l('At').' <i>'.Tools::displayDate($message['date_add'], (int)($cookie->id_lang), true)
.'</i> '.$this->l('from').' <b>'.(($message['elastname']) ? ($message['efirstname'].' '.$message['elastname']) : ($message['cfirstname'].' '.$message['clastname'])).'</b> '
.((int)($message['private']) == 1 ? '<span style="color:red; font-weight:bold;">'.$this->l('Private:').'</span>' : '');
$html.= '
</a>
<p class="collapse" id="collaspeMessage_'.$message['id_message'].'">'.nl2br2($message['message']).'</p>';
$html.= '</div>';
<div class="panel">
<div class="panel-title">
<h2><span class="anticon anticon-bubble2"></span> '.$this->l('Messages').'</h2>
<div class="clearfix"></div>
</div>
<div class="panel-content">';
if (sizeof($messages)) {
foreach ($messages as $message)
{
$html.= '<div style="background:#efefef;padding:5px;margin-bottom:10px;overflow:auto;" '.($message['is_new_for_me'] ?'class="new_message"':'').'>';
if ($message['is_new_for_me']){
$html.= '<a class="new_message" title="'.$this->l('Mark this message as \'viewed\'').'" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&token='.$this->token.'&messageReaded='.(int)($message['id_message']).'"><img src="../img/admin/enabled.gif" alt="" /></a>';
}
$html.= '
<a href="#collaspeMessage_'.$message['id_message'].'" data-toggle="collapse">
<span class="anticon anticon-bubble"></span> '.$this->l('At').' <i>'.Tools::displayDate($message['date_add'], (int)($cookie->id_lang), true)
.'</i> '.$this->l('from').' <b>'.(($message['elastname']) ? ($message['efirstname'].' '.$message['elastname']) : ($message['cfirstname'].' '.$message['clastname'])).'</b> '
.((int)($message['private']) == 1 ? '<span style="color:red; font-weight:bold;">'.$this->l('Private:').'</span>' : '');
$html.= '
</a>
<p class="collapse" id="collaspeMessage_'.$message['id_message'].'">'.nl2br2($message['message']).'</p>';
$html.= '</div>';
}
$html.= '<p class="text-info">'.$this->l('When you read a message, please click on the green check.').'</p>';
} else {
$html.= '<div class="alert alert-info">'.$this->l('No Message for this order.').'</div>';
}
$html.= '<p class="text-info">'.$this->l('When you read a message, please click on the green check.').'</p>';
} else {
$html.= '<div class="alert alert-info">'.$this->l('No Message for this order.').'</div>';
}
$html.= '</div>
$html.= '</div>
</div>
</div>
</div>';
$html.= '
</div>'; // </row>
$html.= '
<div class="row">
<div class="col-md-6">
<div class="panel">
<div class="panel-title">
@ -1696,8 +1713,8 @@ class AdminOrders extends AdminTab
<div class="panel-content">';
if (!sizeof($returns)){
$html.= '
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;"">'.$this->l('Create a product return').'</h5>
<div class="alert alert-info">'.$this->l('No merchandise return for this order.').'</div>';
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;cursor:pointer" data-toggle="collapse" href="#div_returns">'.$this->l('Create a product return').'</h5>
<div class="alert alert-info collapse" id="div_returns">'.$this->l('No merchandise return for this order.').'</div>';
} else {
$html.='
<table class="table table-condensed th-grey" width="100%" >
@ -1725,8 +1742,8 @@ class AdminOrders extends AdminTab
<td style="font-size:12px;">'.Tools::displayDate($return['date_upd'], $cookie->id_lang).'</td>
<td style="font-size:12px;"><b><a class="text-purple-dark" href="index.php?tab=AdminAntReturnprocess&id_order_return='.$return['id_order_return'].'&updateorder_return&token='.Tools::getAdminToken('AdminAntReturnprocess'.(int)(Tab::getIdFromClassName('AdminAntReturnprocess')).(int)($cookie->id_employee)).'">'.$this->l('#').sprintf('%06d', $return['id_order_return']).'</a></b></td>
<td style="font-size:12px;">'.$state->name[$cookie->id_lang].'</td>
<td style="font-size:12px;">'.($return_link?'<a class="text-purple-dark" href="'.$return_link['link'].'" onclick="window.open(this.href); return false;">'.$return_link['return_number'].'</a>': '').'</td>
<td style="font-size:14px;text-align:center">'.($return_link?'<a class="text-purple-dark" href="'.$currentIndex.'&send_return_instruction=1&id_order_return='.$return['id_order_return'].'&id_order='.(int)($order->id).'&vieworder&token='.$this->token.'" title="'.$this->l('Renvoyer les instructions retour').'"><i class="glyphicon glyphicon-send"></i></a>': '').'</td>
<td style="font-size:12px;">'.($return_link?'<a class="text-purple-dark" href="'.$return_link['link'].'" onclick="window.open(this.href); return false;">'.$return_link['return_number'].'</a>': '/').'</td>
<td style="font-size:14px;text-align:center">'.($return_link?'<a class="text-purple-dark" href="'.$currentIndex.'&send_return_instruction=1&id_order_return='.$return['id_order_return'].'&id_order='.(int)($order->id).'&vieworder&token='.$this->token.'" title="'.$this->l('Renvoyer les instructions retour').'"><i class="glyphicon glyphicon-send"></i></a>': '/').'</td>
</tr>';
}
$html.='</tbody>
@ -1788,8 +1805,8 @@ class AdminOrders extends AdminTab
$html.= '
<div>
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;"">'.$this->l('Create a product return').'</h5>
<form id="new_product_return" action="" method="post">
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;cursor:pointer" data-toggle="collapse" href="#new_product_return">'.$this->l('Create a product return').'</h5>
<form id="new_product_return" class="collapse" action="" method="post">
<ul style="list-style: outside none; margin: 0; padding: 0;">';
foreach($returnable as $id_order_detail => $product) {
$html.= '
@ -1836,14 +1853,14 @@ class AdminOrders extends AdminTab
</div>';
} else {
$html.= '
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;"">'.$this->l('Create a product return').'</h5>
<div class="alert alert-warning-light">'.$this->l('No product can currently be returned on this order').'</div>';
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;cursor:pointer" data-toggle="collapse" href="#div_returns">'.$this->l('Create a product return').'</h5>
<div class="alert alert-warning-light collapse" id="div_returns">'.$this->l('No product can currently be returned on this order').'</div>';
}
}
}
$html.= '</div>
</div>
</div>';
';
if(!class_exists('SupplierDemand')){
require_once(_PS_MODULE_DIR_.'ant_supplierdemand/models/SupplierDemand.php');
@ -1851,17 +1868,14 @@ class AdminOrders extends AdminTab
$supplierDemands = SupplierDemand::getDemands(array(),'sd.id_order='.$order->id);
$alreadyDemand = array();
$html .= '
<div class="col-md-6">
<div class="panel">
<div class="panel-title">
<h2>'.$this->l('Supplier demands').'</h2>
<h2><span class="anticon anticon-folder-open"></span> '.$this->l('Supplier demands').'</h2>
<div class="clearfix"></div>
</div>
<div class="panel-content">';
$demand_product = 0;
if (!sizeof($supplierDemands)) {
$html .= '<div class="alert alert-info">'.$this->l('No Supplier demands for this order.').'</div>';
} else {
if(sizeof($supplierDemands)) {
$html .= '
<table class="table table-condensed th-grey" width="100%">
<tbody>
@ -1878,7 +1892,7 @@ class AdminOrders extends AdminTab
$html .= '
<tr>
<td>'.Tools::displayDate($demand['date_upd'], $cookie->id_lang).'</td>
<td><a href="index.php?tab=AdminAntSupplierDemand&id='.$demand['id_supplier_demand'].'&updateSupplierDemand=1&token='.Tools::getAdminToken('AdminAntSupplierDemand'.(int)(Tab::getIdFromClassName('AdminAntSupplierDemand')).(int)($cookie->id_employee)).'">'.$this->l('#').sprintf('%06d', $demand['id_supplier_demand']).'</a></td>
<td><b><a class="text-purple-dark" href="index.php?tab=AdminAntSupplierDemand&id='.$demand['id_supplier_demand'].'&updateSupplierDemand=1&token='.Tools::getAdminToken('AdminAntSupplierDemand'.(int)(Tab::getIdFromClassName('AdminAntSupplierDemand')).(int)($cookie->id_employee)).'">'.$this->l('#').sprintf('%06d', $demand['id_supplier_demand']).'</a></b></td>
<td>'.$demandStates[$demand['id_state']]['name'].'</td>
<td>'.$demandProduct['product_name'].'</td>
</tr>';
@ -1888,8 +1902,8 @@ class AdminOrders extends AdminTab
}
$html .= '
<div>
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;"">'.$this->l('Make a supplier demand').'</h5>
<form id="new_supplier_demand" action="" method="post">
<h5 style="background:#504D8B;color:#fff;padding:5px;text-align:center;cursor:pointer" data-toggle="collapse" href="#new_supplier_demand">'.$this->l('Make a supplier demand').'</h5>
<form class="collapse" id="new_supplier_demand" action="" method="post">
<p>
<label style="width: auto; margin-bottom: 5px;">'.$this->l('Product').'</label>
<select class="form-control" name="id_order_detail">';
@ -1938,6 +1952,12 @@ class AdminOrders extends AdminTab
return false;
});
$(".input-quantity").change(function(){
if($(this).val()==0){
}
});
$("#generateDiscount, #generateDiscount2, #generateCreditSlip").click(function(){
if($(this).is(":checked")){
$("#spanShippingBack").css("display", "block");
@ -1955,7 +1975,9 @@ class AdminOrders extends AdminTab
public function viewDetails()
{
return $this->_viewDetails();
if((int)Configuration::get('ANT_BOOTSTRAP_TPL') == 1){
return $this->_viewDetails();
}
global $currentIndex, $cookie, $link;
$irow = 0;

View File

@ -13,6 +13,7 @@ class AdminAntConfigurations extends AdminTab
global $cookie;
if(Tools::isSubmit('submitUpdateConfigurations')) {
Configuration::updateValue('ANT_BOOTSTRAP_TPL', Tools::getValue('bootstrap_tpl'));
Configuration::updateValue('ANT_CARRIER_DROP', Tools::getValue('carrier_dropshipping'));
Configuration::updateValue('ANT_CARRIER_DOM', Tools::getValue('carrier_domicile'));
Configuration::updateValue('ANT_CARRIERS_SOCOL', Tools::getValue('carriers_socol'));
@ -361,6 +362,7 @@ class AdminAntConfigurations extends AdminTab
$helperForm = new HelperFormBootstrap();
$helperForm->_select2 = true;
$helperForm->_inputMask = true;
$helperForm->_inputSwitch = true;
$form .= $helperForm->renderStyle();
$form .= '
@ -559,6 +561,15 @@ class AdminAntConfigurations extends AdminTab
'label' => $this->l('Cache Meilleures ventes :'),
'value' => $this->l('Vider le cache'),
),
array(
'type' => 'switch',
'name' => 'bootstrap_tpl',
'label-class' => 'col-md-6',
'input-class' => 'col-md-4',
'label' => $this->l('Bootstrap TPL (BO) :'),
'default' => Configuration::get('ANT_BOOTSTRAP_TPL'),
'checked' => Configuration::get('ANT_BOOTSTRAP_TPL'),
),
array(
'type' => 'simpleText',
'name' => 'carrier_dropshipping',

View File

@ -101,6 +101,32 @@ class RefundReason extends Module {
return $output;
}
public function hookAdminOrderNew($params) {
global $cookie;
$output .= '
<script type="text/javascript">
<!--
$(document).ready(function() {
$(\'<select id=\"typeReason\" class="form-control" name=\"typeReason\" style=\"display:none; margin-top: 5px;\"><option value=\"0\" style="color: #999999;">'.$this->l('Refund reason').'</option><option value=\"1\">'.$this->l('Cancelled (before shipping)').'</option><option value=\"2\">'.$this->l('Cancelled (received, -7d)').'</option><option value=\"11\">'.$this->l('ZZZZZ4').'</option><option value=\"4\">'.$this->l('Product default').'</option><option value=\"5\">'.$this->l('Missing product (supplier)').'</option><option value=\"3\">'.$this->l('Return (received +7d)').'</option><option value=\"6\">'.$this->l('Logistics error').'</option><option value=\"8\">'.$this->l('ZZZZZ1').'</option><option value=\"12\">'.$this->l('ZZZZZ5').'</option><option value=\"9\">'.$this->l('ZZZZZ2').'</option><option value=\"10\">'.$this->l('ZZZZZ3').'</option><option value=\"7\">'.$this->l('Other').'</option></select>\').insertAfter(\'#spanShippingBack\');
$(\'<p class="center"><select id=\"typeReasonTotal\" class="form-control" name=\"typeReason\"><option value=\"0\" style="color: #999999;">'.$this->l('Refund reason').'</option><option value=\"1\">'.$this->l('Cancelled (before shipping)').'</option><option value=\"2\">'.$this->l('Cancelled (received, -7d)').'</option><option value=\"11\">'.$this->l('ZZZZZ4').'</option><option value=\"4\">'.$this->l('Product default').'</option><option value=\"5\">'.$this->l('Missing product (supplier)').'</option><option value=\"3\">'.$this->l('Return (received +7d)').'</option><option value=\"6\">'.$this->l('Logistics error').'</option><option value=\"8\">'.$this->l('ZZZZZ1').'</option><option value=\"12\">'.$this->l('ZZZZZ5').'</option><option value=\"9\">'.$this->l('ZZZZZ2').'</option><option value=\"10\">'.$this->l('ZZZZZ3').'</option><option value=\"7\">'.$this->l('Other').'</option></select></p>\').insertBefore(\'form.refundform p\');
$("#generateCreditSlip").click(function() {
if($("#generateCreditSlip:checked").length == 1) {
$("#typeReason").show();
} else {
$("#typeReason").hide();
}
});
});
-->
</script>
';
return $output;
}
public function hookOrderSlip($params) {
global $cookie;