From d07623cbc2f926afd46520f86a0ef0dd3d5c5455 Mon Sep 17 00:00:00 2001 From: rGaillard Date: Tue, 17 Apr 2012 15:56:38 +0000 Subject: [PATCH] [*] BO: Set defaults payment order state on BackOffice order git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14694 b9a71923-0436-4b27-9f14-aed3839534dd --- .../default/template/controllers/orders/form.tpl | 11 +++++++++++ controllers/admin/AdminOrdersController.php | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/admin-dev/themes/default/template/controllers/orders/form.tpl b/admin-dev/themes/default/template/controllers/orders/form.tpl index bf78bbb83..4997baaf2 100755 --- a/admin-dev/themes/default/template/controllers/orders/form.tpl +++ b/admin-dev/themes/default/template/controllers/orders/form.tpl @@ -35,6 +35,10 @@ var id_lang = ''; var txt_show_carts = '{l s='Show carts and orders for this customer'}'; var txt_hide_carts = '{l s='Hide carts and orders for this customer'}'; + var defaults_order_state = new Array(); + {foreach from=$defaults_order_state key='module' item='id_order_state'} + defaults_order_state['{$module}'] = '{$id_order_state}'; + {/foreach} $(document).ready(function() { $('#customer').typeWatch({ captureLength: 1, @@ -48,6 +52,12 @@ wait: 100, callback: function(){ searchProducts(); } }); + $('#payment_module_name').change(function() { + var id_order_state = defaults_order_state[this.value]; + if (typeof(id_order_state) == 'undefined') + id_order_state = defaults_order_state['other']; + $('#id_order_state').val(id_order_state); + }); $("#id_address_delivery").change(function() { updateAddresses(); }); @@ -85,6 +95,7 @@ return false; }); $('#show_old_carts').click(); + $('#payment_module_name').change(); $.ajaxSetup({ type:"post" }); $("#voucher").autocomplete('{$link->getAdminLink('AdminCartRules')}', { minChars: 3, diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 265d94b2a..54336eae2 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -155,6 +155,11 @@ class AdminOrdersControllerCore extends AdminController 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'), + 'cashondelivery' => (int)Configuration::get('PS_OS_PREPARATION'), + 'other' => (int)Configuration::get('PS_OS_PAYMENT')); $this->context->smarty->assign(array( 'recyclable_pack' => (int)Configuration::get('PS_RECYCLABLE_PACK'), 'gift_wrapping' => (int)Configuration::get('PS_GIFT_WRAPPING'), @@ -163,6 +168,7 @@ class AdminOrdersControllerCore extends AdminController 'langs' => Language::getLanguages(true, Context::getContext()->shop->id), 'payment_modules' => PaymentModule::getInstalledPaymentModules(), 'order_states' => OrderState::getOrderStates((int)Context::getContext()->language->id), + 'defaults_order_state' => $defaults_order_state, 'show_toolbar' => $this->show_toolbar, 'toolbar_btn' => $this->toolbar_btn, 'toolbar_scroll' => $this->toolbar_scroll,