// don't allow carts without customer to create a new BackOffice orders

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17122 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2012-08-31 09:12:30 +00:00
parent 324c0a556d
commit 554e2f240a
2 changed files with 11 additions and 5 deletions
@@ -56,7 +56,7 @@
{l s='Made on:'} {dateFormat date=$order->date_add}<br /><br /><br /><br />
{else}
{l s='No order created from this cart'}</span>
<p><a class="button" href="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&id_cart={$cart->id}&addorder">{l s='Create an order with from cart'}</a></p>
{if $customer->id}<p><a class="button" href="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&id_cart={$cart->id}&addorder">{l s='Create an order with from cart'}</a></p>{/if}
{/if}
</div>
<br style="clear:both;" />
+10 -4
View File
@@ -151,14 +151,20 @@ class AdminOrdersControllerCore extends AdminController
public function renderForm()
{
if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP && Shop::isFeatureActive())
{
$this->errors[] = $this->l('You have to select a shop in order to create new orders.');
$id_cart = (int)Tools::getValue('id_cart');
$cart = new Cart((int)$id_cart);
if ($id_cart && !Validate::isLoadedObject($cart))
$this->errors[] = $this->l('This cart does not exists');
if ($id_cart && Validate::isLoadedObject($cart) && !$cart->id_customer)
$this->errors[] = $this->l('The cart must have a customer');
if (count($this->errors))
return false;
}
parent::renderForm();
unset($this->toolbar_btn['save']);
$this->addJqueryPlugin(array('autocomplete', 'fancybox', 'typewatch'));
$cart = new Cart((int)Tools::getValue('id_cart'));
$defaults_order_state = array('cheque' => (int)Configuration::get('PS_OS_CHEQUE'),
'bankwire' => (int)Configuration::get('PS_OS_BANKWIRE'),
@@ -176,7 +182,7 @@ class AdminOrdersControllerCore extends AdminController
'show_toolbar' => $this->show_toolbar,
'toolbar_btn' => $this->toolbar_btn,
'toolbar_scroll' => $this->toolbar_scroll,
'title' => array($this->l('Orders'), $this->l('create order')),
'title' => array($this->l('Orders'), $this->l('create order'))
));
$this->content .= $this->createTemplate('form.tpl')->fetch();
}