// 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:
@@ -56,7 +56,7 @@
|
|||||||
{l s='Made on:'} {dateFormat date=$order->date_add}<br /><br /><br /><br />
|
{l s='Made on:'} {dateFormat date=$order->date_add}<br /><br /><br /><br />
|
||||||
{else}
|
{else}
|
||||||
{l s='No order created from this cart'}</span>
|
{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}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<br style="clear:both;" />
|
<br style="clear:both;" />
|
||||||
|
|||||||
@@ -151,14 +151,20 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
public function renderForm()
|
public function renderForm()
|
||||||
{
|
{
|
||||||
if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP && Shop::isFeatureActive())
|
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.');
|
$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;
|
return false;
|
||||||
}
|
|
||||||
parent::renderForm();
|
parent::renderForm();
|
||||||
unset($this->toolbar_btn['save']);
|
unset($this->toolbar_btn['save']);
|
||||||
$this->addJqueryPlugin(array('autocomplete', 'fancybox', 'typewatch'));
|
$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'),
|
$defaults_order_state = array('cheque' => (int)Configuration::get('PS_OS_CHEQUE'),
|
||||||
'bankwire' => (int)Configuration::get('PS_OS_BANKWIRE'),
|
'bankwire' => (int)Configuration::get('PS_OS_BANKWIRE'),
|
||||||
@@ -176,7 +182,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
'show_toolbar' => $this->show_toolbar,
|
'show_toolbar' => $this->show_toolbar,
|
||||||
'toolbar_btn' => $this->toolbar_btn,
|
'toolbar_btn' => $this->toolbar_btn,
|
||||||
'toolbar_scroll' => $this->toolbar_scroll,
|
'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();
|
$this->content .= $this->createTemplate('form.tpl')->fetch();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user