diff --git a/admin-dev/themes/default/template/controllers/supply_orders_change_state/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/supply_orders_change_state/helpers/form/form.tpl
index 85da04575..0c7f9c85e 100644
--- a/admin-dev/themes/default/template/controllers/supply_orders_change_state/helpers/form/form.tpl
+++ b/admin-dev/themes/default/template/controllers/supply_orders_change_state/helpers/form/form.tpl
@@ -28,6 +28,18 @@
{block name="other_input"}
{if isset($supply_order) && $supply_order->id > 0 && isset($supply_order_states)}
+
diff --git a/classes/stock/SupplyOrderState.php b/classes/stock/SupplyOrderState.php
index f7196d572..d95e266dd 100755
--- a/classes/stock/SupplyOrderState.php
+++ b/classes/stock/SupplyOrderState.php
@@ -165,6 +165,7 @@ class SupplyOrderStateCore extends ObjectModel
if ($ids)
$query->where('s.id_supply_order_state NOT IN('.implode(',', array_map('intval', $ids)).')');
+ $query->orderBy('sl.name ASC');
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
}
diff --git a/controllers/admin/AdminSupplyOrdersController.php b/controllers/admin/AdminSupplyOrdersController.php
index 5b4069b57..a6bdea7b0 100644
--- a/controllers/admin/AdminSupplyOrdersController.php
+++ b/controllers/admin/AdminSupplyOrdersController.php
@@ -535,25 +535,17 @@ class AdminSupplyOrdersControllerCore extends AdminController
// overrides parent::initContent();
$this->initToolbar();
- // given the current state, loads available states
- $states = SupplyOrderState::getSupplyOrderStates($supply_order->id_supply_order_state);
+ $states = SupplyOrderState::getStates();
+ $allowed_states = SupplyOrderState::getSupplyOrderStates($supply_order->id_supply_order_state);
- // gets the state that are not allowed
- $allowed_states = array();
foreach ($states as &$state)
{
- $allowed_states[] = $state['id_supply_order_state'];
- $state['allowed'] = 1;
- }
- $not_allowed_states = SupplyOrderState::getStates($allowed_states);
-
- // generates the final list of states
- $index = count($allowed_states);
- foreach ($not_allowed_states as &$not_allowed_state)
- {
- $not_allowed_state['allowed'] = 0;
- $states[$index] = $not_allowed_state;
- ++$index;
+ $state['allowed'] = 0;
+ foreach ($allowed_states as $allowed_state)
+ {
+ if ($state['id_supply_order_state'] == $allowed_state['id_supply_order_state'])
+ $state['allowed'] = 1;
+ }
}
// loads languages
@@ -808,6 +800,10 @@ class AdminSupplyOrdersControllerCore extends AdminController
$helper->currentIndex = self::$currentIndex.$action;
+ $helper->ajax_params = array(
+ 'display_product_history' => 1,
+ );
+
// display these global order informations
$this->displayInformation($this->l('This interface allows you to update the quantities of this on-going order.').'
');
$this->displayInformation($this->l('Be careful : once you update, you cannot go back unless you add new negative stock movements.').'
');
@@ -1452,7 +1448,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
public function ajaxProcess()
{
// tests if an id is submit
- if (Tools::isSubmit('id'))
+ if (Tools::isSubmit('id') && !Tools::isSubmit('display_product_history'))
{
// overrides attributes
$this->identifier = 'id_supply_order_history';
@@ -1525,14 +1521,14 @@ class AdminSupplyOrdersControllerCore extends AdminController
echo Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content));
}
- else if (Tools::isSubmit('id_supply_order_detail'))
+ else if (Tools::isSubmit('id') && Tools::isSubmit('display_product_history'))
{
$this->identifier = 'id_supply_order_receipt_history';
$this->table = 'supply_order_receipt_history';
$this->display = 'list';
$this->lang = false;
$lang_id = (int)$this->context->language->id;
- $id_supply_order_detail = (int)Tools::getValue('id_supply_order_detail');
+ $id_supply_order_detail = (int)Tools::getValue('id');
unset($this->fieldsDisplay);
$this->fieldsDisplay = array(