// Improve and debug backoffice order

This commit is contained in:
rGaillard
2012-02-20 13:25:55 +00:00
parent dff5720afc
commit 67d478fa39
7 changed files with 76 additions and 8 deletions
@@ -0,0 +1,34 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 10891 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{extends file="helpers/list/list_header.tpl"}
{block name='override_header'}
{if $submit_form_ajax}
<script type="text/javascript">
parent.getSummary();
parent.$.fancybox.close();
</script>
{/if}
{/block}
@@ -25,7 +25,15 @@
*}
{extends file="helpers/list/list_header.tpl"}
{block name='override_header'}
{if $submit_form_ajax}
<script type="text/javascript">
$('#customer', window.parent.document).val('{$new_customer_email}');
parent.setupCustomer({$new_customer->id|intval});
parent.$.fancybox.close();
</script>
{/if}
{/block}
{block name=leadin}
{if isset($delete_customer) && $delete_customer}
<form action="{$REQUEST_URI}" method="post">
@@ -212,7 +212,7 @@
{
$('.fancybox').fancybox({
'type': 'iframe',
'width': '50%',
'width': '60%',
'height': '100%'
});
/*$("#new_address").fancybox({
@@ -304,7 +304,12 @@
}
});
}
function getSummary()
{
useCart(id_cart);
}
function deleteVoucher(id_cart_rule)
{
$.ajax({
@@ -30,6 +30,7 @@
e.preventDefault();
var form_datas = new Object;
form_datas['liteDisplaying'] = 1;
form_datas['submitFormAjax'] = 1;
var form_inputs = $('#{$table}_form input, #{$table}_form textarea, #{$table}_form button');
var form_selects = $('#{$table}_form select');
$.each(form_inputs, function() {
@@ -39,7 +40,8 @@
form_datas[this.name] = this.value;
});
$.each(form_selects, function() {
form_datas[this.name] = this[this.options.selectedIndex].value;
if (this.options != undefined && this.options.selectedIndex != undefined && this[this.options.selectedIndex] != undefined)
form_datas[this.name] = this[this.options.selectedIndex].value;
});
$.ajax({
type: this.method,
+5 -3
View File
@@ -624,13 +624,13 @@ class AdminControllerCore extends Controller
$this->afterAdd($object);
$this->updateAssoShop($object->id);
// Save and stay on same form
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
if (empty($this->redirect_after) && $this->redirect_after !== false && Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$token;
// Save and back to parent
if (Tools::isSubmit('submitAdd'.$this->table.'AndBackToParent'))
if (empty($this->redirect_after) && $this->redirect_after !== false && Tools::isSubmit('submitAdd'.$this->table.'AndBackToParent'))
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=3&token='.$token;
// Default behavior (save and back)
if (empty($this->redirect_after))
if (empty($this->redirect_after) && $this->redirect_after !== false)
$this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token;
}
}
@@ -1693,6 +1693,8 @@ class AdminControllerCore extends Controller
'current' => self::$currentIndex,
'token' => $this->token,
));
$this->context->smarty->assign('submit_form_ajax', (int)Tools::getValue('submitFormAjax'));
$this->initProcess();
}
@@ -370,6 +370,13 @@ class AdminAddressesControllerCore extends AdminController
Tools::redirectAdmin(Tools::getValue('back').'&conf=4');
}
}
public function processAdd($token)
{
if (Tools::getValue('submitFormAjax'))
$this->redirect_after = false;
return parent::processAdd($token);
}
/**
* Get Address formats used by the country where the address id retrieved from POST/GET is.
+11 -1
View File
@@ -719,6 +719,8 @@ class AdminCustomersControllerCore extends AdminController
public function processAdd($token)
{
if (Tools::getValue('submitFormAjax'))
$this->redirect_after = false;
// Check that the new email is not already in use
$customer_email = strval(Tools::getValue('email'));
$customer = new Customer();
@@ -727,7 +729,15 @@ class AdminCustomersControllerCore extends AdminController
if ($customer->id)
$this->errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$customer_email;
else
return parent::processAdd($token);
{
if ($customer = parent::processAdd($token))
{
$this->context->smarty->assign('new_customer', $customer);
return true;
}
else
return false;
}
}