Merge branch 'ticket-12462-returnMR' into develop

This commit is contained in:
Marion Muszynski 2017-03-03 10:59:12 +01:00
commit b988870c40

View File

@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@ -42,20 +42,20 @@ class AdminReturn extends AdminTab
'id_order' => array('title' => $this->l('Order ID'), 'width' => 75, 'align' => 'center'),
'name' => array('title' => $this->l('Status'), 'width' => 150, 'align' => 'center'),
'date_add' => array('title' => $this->l('Date issued'), 'width' => 60, 'type' => 'date', 'align' => 'right'));
$this->optionTitle = $this->l('Merchandise return (RMA) options');
$this->_fieldsOptions = array(
'PS_ORDER_RETURN' => array('title' => $this->l('Enable returns:'), 'desc' => $this->l('Select whether or not to activate merchandise return for your shop'), 'cast' => 'intval', 'type' => 'bool'),
'PS_ORDER_RETURN_NB_DAYS' => array('title' => $this->l('Time limit of validity:'), 'desc' => $this->l('Number of days the customer can make a return after the delivery date'), 'cast' => 'intval', 'type' => 'text', 'size' => '2'),
);
parent::__construct();
}
public function postProcess()
{
global $currentIndex, $cookie;
if (Tools::isSubmit('deleteorder_return_detail'))
{
if ($this->tabAccess['delete'] === '1')
@ -118,11 +118,22 @@ class AdminReturn extends AdminTab
}
parent::postProcess();
}
public function display()
{
global $currentIndex, $cookie;
if($return_number = Tools::getValue('return_number')) {
if($return = Db::getInstance()->getRow('
SELECT *
FROM `'._DB_PREFIX_.'order_return_link`
WHERE `return_number` = "'.pSQL($return_number).'"
')) {
header('Location: /adm/index.php?tab=AdminReturn&id_order_return='.(int) $return['id_order_return'].'&updateorder_return&token='.Tools::getValue('token'));
exit;
}
}
// Include current tab
if (isset($_GET['update'.$this->table]))
{
@ -137,13 +148,40 @@ class AdminReturn extends AdminTab
else
{
$this->getList((int)($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
echo '
<fieldset style="display: inline-block; margin-bottom: 20px;">
<legend><img src="/img/admin/search.gif" alt="" style="float: right; margin-left: 20px;" /> '.$this->l('Find order return by return number').'</legend>
<p style="padding-top: 20px;">
<input type="text" id="return_number_input" value="" autocomplete="off" />
<a class="button" onclick="getReturnByNumber();" style="cursor: pointer;">'.$this->l('Submit').'</a>
</p>
<br style="display: table; clear: both;" />
</fieldset>
<script type="text/javascript">
function getReturnByNumber() {
var val = $("#return_number_input").val().trim();
if(val != "" && val.length == 15) {
document.location.href = "/adm/index.php?tab=AdminReturn&token='.Tools::getValue('token').'&return_number=" + val;
}
}
$(function() {
$("#return_number_input").bind("keydown", function(e) {
if(e.which == 13) {
getReturnByNumber();
return false;
}
});
});
</script>
';
$this->displayList();
$this->displayOptionsList();
$this->includeSubTab('display');
}
}
public function displayListContent($token = NULL)
{
global $currentIndex, $cookie;
@ -159,12 +197,12 @@ class AdminReturn extends AdminTab
echo '</tr>';
}
}
public function displayForm($isMainTab = true)
{
global $currentIndex, $cookie;
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;