continuing refunding part
This commit is contained in:
parent
5ff5c296f5
commit
9180ded3e1
@ -52,7 +52,7 @@ class AdminAntReturnprocess extends AdminTab
|
||||
Mail::Send((int)$order->id_lang, 'order_return_state', Mail::l('Your order return state has changed', (int)$order->id_lang),
|
||||
$vars, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, NULL,
|
||||
NULL, _PS_MAIL_DIR_, true);
|
||||
Tools::redirectAdmin($currentIndex.'&id_order_return='.(int)$id_order_return.'&updateorder_return&conf=4&token='.$this->token);
|
||||
Tools::redirectAdmin($currentIndex.'&id_order_return='.(int)$id_order_return.'&updateorder_return&ok=2&token='.$this->token);
|
||||
}
|
||||
} else {
|
||||
HelperFormBootstrap::displayErrors(Tools::displayError('No order return ID.'));
|
||||
@ -104,7 +104,7 @@ class AdminAntReturnprocess extends AdminTab
|
||||
$ct->update();
|
||||
$cm->update();
|
||||
}
|
||||
Tools::redirectAdmin($currentIndex.'&id_order_return='.(int)$id_order_return.'&updateorder_return&conf=4&token='.$this->token);
|
||||
Tools::redirectAdmin($currentIndex.'&id_order_return='.(int)$id_order_return.'&updateorder_return&ok=3&token='.$this->token);
|
||||
} else {
|
||||
HelperFormBootstrap::displayErrors(Tools::displayError('An error occurred, your message was not sent. Please contact your system administrator.'));
|
||||
}
|
||||
@ -154,10 +154,48 @@ class AdminAntReturnprocess extends AdminTab
|
||||
$customer->email,
|
||||
$customer->firstname.' '.$customer->lastname
|
||||
);
|
||||
Tools::redirectAdmin($currentIndex.'&id_order_return='.(int)$id_order_return.'&updateorder_return&conf=4&token='.$this->token);
|
||||
Tools::redirectAdmin($currentIndex.'&id_order_return='.(int)$id_order_return.'&updateorder_return&ok=4&token='.$this->token);
|
||||
} else {
|
||||
HelperFormBootstrap::displayErrors(Tools::displayError('Order ID missing.'));
|
||||
}
|
||||
} elseif (Tools::isSubmit('submitOrderState') && Tools::getValue('id_order_return') && ($id_order = (int)(Tools::getValue('id_order'))) AND Validate::isLoadedObject($order = new Order($id_order))) {
|
||||
|
||||
$id_order_return = (int) Tools::getValue('id_order_return');
|
||||
if (!$newOrderStatusId = (int)(Tools::getValue('id_order_state'))) {
|
||||
HelperFormBootstrap::displayErrors(Tools::displayError('Invalid new order status'));
|
||||
} else {
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = (int)$id_order;
|
||||
$history->id_employee = (int)($cookie->id_employee);
|
||||
$history->changeIdOrderState((int)($newOrderStatusId), (int)($id_order));
|
||||
$order = new Order((int)$order->id);
|
||||
$carrier = new Carrier((int)($order->id_carrier), (int)($order->id_lang));
|
||||
|
||||
$templateVars = array();
|
||||
if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING') AND $order->shipping_number) {
|
||||
$templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url));
|
||||
} elseif ($history->id_order_state == Configuration::get('PS_OS_CHEQUE')) {
|
||||
$templateVars = array(
|
||||
'{cheque_name}' => (Configuration::get('CHEQUE_NAME') ? Configuration::get('CHEQUE_NAME') : ''),
|
||||
'{cheque_address_html}' => (Configuration::get('CHEQUE_ADDRESS') ? nl2br(Configuration::get('CHEQUE_ADDRESS')) : ''));
|
||||
} elseif ($history->id_order_state == Configuration::get('PS_OS_BANKWIRE')) {
|
||||
$templateVars = array(
|
||||
'{bankwire_owner}' => (Configuration::get('BANK_WIRE_OWNER') ? Configuration::get('BANK_WIRE_OWNER') : ''),
|
||||
'{bankwire_details}' => (Configuration::get('BANK_WIRE_DETAILS') ? nl2br(Configuration::get('BANK_WIRE_DETAILS')) : ''),
|
||||
'{bankwire_address}' => (Configuration::get('BANK_WIRE_ADDRESS') ? nl2br(Configuration::get('BANK_WIRE_ADDRESS')) : ''));
|
||||
}
|
||||
|
||||
if (Tools::getValue('noSendMail')) {
|
||||
if ($history->add()) {
|
||||
Tools::redirectAdmin($currentIndex.'&id_order_return='.(int)$id_order_return.'&updateorder_return&ok=5&token='.$this->token);
|
||||
}
|
||||
} else {
|
||||
if ($history->addWithemail(true, $templateVars)) {
|
||||
Tools::redirectAdmin($currentIndex.'&id_order_return='.(int)$id_order_return.'&updateorder_return&ok=5&token='.$this->token);
|
||||
}
|
||||
}
|
||||
HelperFormBootstrap::displayErrors(Tools::displayError('An error occurred while changing the status or was unable to send e-mail to the customer.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,14 +227,31 @@ class AdminAntReturnprocess extends AdminTab
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['updateorder_return']))
|
||||
{
|
||||
if (isset($_GET['updateorder_return'])) {
|
||||
|
||||
if(isset($_GET['ok'])){
|
||||
switch ($_GET['ok']) {
|
||||
case '2':
|
||||
$success_mess = 'Mise à jour enregistrée';
|
||||
break;
|
||||
case '3':
|
||||
$success_mess = 'Votre message a bien été envoyé';
|
||||
break;
|
||||
case '4':
|
||||
$success_mess = 'Les instructions on été renvoyées';
|
||||
break;
|
||||
case '5':
|
||||
$success_mess = 'Le nouveau statut de le commande a bien été enregistré';
|
||||
break;
|
||||
default:
|
||||
$success_mess = 'Mise à jour enregistrée';
|
||||
break;
|
||||
}
|
||||
HelperFormBootstrap::displaySuccess($success_mess);
|
||||
}
|
||||
$this->displayForm();
|
||||
echo '<br /><br /><a href="'.$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to list').'</a><br />';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->displaylist();
|
||||
}
|
||||
}
|
||||
@ -216,7 +271,7 @@ class AdminAntReturnprocess extends AdminTab
|
||||
$customer = new Customer((int)$order->id_customer);
|
||||
$data = $this->getOrderDetail($cart,(int)$cart->id_lang,$order);
|
||||
$currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT')));
|
||||
$currentState = OrderHistory::getLastOrderState((int)$orderReturn->id_order);
|
||||
$orderStates = OrderState::getOrderStates((int)($cookie->id_lang));
|
||||
$shipping_numbers = Db::getInstance()->ExecuteS('
|
||||
SELECT DISTINCT lpws.`shipping_number`, lpws.`date_add`
|
||||
FROM `'._DB_PREFIX_.'lapostews` lpws
|
||||
@ -472,9 +527,9 @@ class AdminAntReturnprocess extends AdminTab
|
||||
<th>'.$this->l('Prix U').'</th>
|
||||
<th>'.$this->l('Qté').'</th>
|
||||
'.($order->hasBeenPaid() ?'<th>'.$this->l('Remb').'</th>':'').'
|
||||
'.($order->hasBeenDelivered() ?'<th>'.$this->l('Retour').'</th>':'').'
|
||||
<th>'.$this->l('Stock').'</th>
|
||||
<th>'.$this->l('Total').'</th>
|
||||
<th>'.($order->module ? ($order->module=="paybox"?'<span class="anticon anticon-credit-card"></span> ':'<span class="anticon anticon-paypal"></span> ') : '').'<span class="anticon anticon-redo2"></span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
@ -500,7 +555,7 @@ class AdminAntReturnprocess extends AdminTab
|
||||
<tr>
|
||||
<td style="vertical-align:middle;color:#444;">
|
||||
<a style="color:#444;" href="index.php?tab=AdminCatalog&id_product='.$product['product_id'].'&updateproduct&token='.$tokenCatalog.'">
|
||||
<span style="font-weight:bold;" class="productName">'.$product['product_name'].'</span><br />
|
||||
<span style="font-weight:bold;font-size:11px" class="productName">'.$product['product_name'].'</span><br />
|
||||
'.($product['product_reference'] ? '<span style="font-size:10px">'.$this->l('Ref:').' '.$product['product_reference'].'</span><br />' : '')
|
||||
.($product['product_supplier_reference'] ? '<span style="font-size:10px">'.$this->l('Ref Supplier:').' '.$product['product_supplier_reference'].'</span>' : '')
|
||||
.'</a>
|
||||
@ -508,9 +563,10 @@ class AdminAntReturnprocess extends AdminTab
|
||||
<td style="vertical-align:middle;color:#444;">'.Tools::displayPrice($product_price,$currency).'</td>
|
||||
<td style="vertical-align:middle;color:#444;">'.$quantity.'</td>
|
||||
'.($order->hasBeenPaid() ? '<td style="vertical-align:middle;color:#444;" align="center" class="productQuantity">'.(int)($product['product_quantity_refunded']).'</td>' : '').'
|
||||
'.($order->hasBeenDelivered() ? '<td style="vertical-align:middle;color:#444;" align="center" class="productQuantity">'.(int)($product['product_quantity_return']).'</td>' : '').'
|
||||
<td style="vertical-align:middle;color:#444;" align="center" class="productQuantity">'.(int)$stock['quantity'].'</td>
|
||||
<td style="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>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
@ -518,6 +574,46 @@ class AdminAntReturnprocess extends AdminTab
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<div class="ln_solid"></div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;">'.$this->l('Changer le statut de la commande').'</h5>
|
||||
<form style="padding:10px 20px;background:#efefef;" class="text-center center" action="'.$currentIndex.'&submitOrderState=1&token='.$this->token.'" method="post">
|
||||
<div class="form-group">
|
||||
<select class="form-control" name="id_order_state">';
|
||||
$currentStateTab = $order->getCurrentStateFull($cookie->id_lang);
|
||||
foreach ($orderStates AS $state){
|
||||
$html .= '<option value="'.$state['id_order_state'].'"'.(($state['id_order_state'] == $currentStateTab['id_order_state']) ? ' selected="selected"' : '').'>'.stripslashes($state['name']).'</option>';
|
||||
}
|
||||
$html .= '
|
||||
</select>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" value="1" name="noSendMail" /> Ne pas envoyer de mail
|
||||
</label>
|
||||
</div>
|
||||
<input type="hidden" name="id_order" value="'.$order->id.'" />
|
||||
<input type="hidden" name="id_order_return" value="'.$orderReturn->id.'" />
|
||||
<input type="submit" name="submitOrderState" value="'.$this->l('Change').'" class="btn btn-primary btn-block" />
|
||||
</form>
|
||||
</div>
|
||||
<!--div class="col-md-6">
|
||||
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;">'.$this->l('Remboursement de la commande').'</h5>
|
||||
<form style="padding:10px 20px;background:#efefef;" class="text-center center" action="'.$currentIndex.'&submitRefund=1&token='.$this->token.'" method="post">
|
||||
<div class="form-group">
|
||||
<select class="form-control" name="refund_type">
|
||||
<option value="1">Paypal</option>
|
||||
<option value="2">CB</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="hidden" name="id_order" value="'.$order->id.'" />
|
||||
<input type="hidden" name="id_order_return" value="'.$orderReturn->id.'" />
|
||||
<input type="submit" name="submitRefund" value="'.$this->l('Rembourser').'" class="btn btn-primary btn-block" />
|
||||
</form>
|
||||
</div-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user