diff --git a/admin-dev/themes/default/template/controllers/orders/_product_line.tpl b/admin-dev/themes/default/template/controllers/orders/_product_line.tpl index 493123c86..3a9e87aa8 100644 --- a/admin-dev/themes/default/template/controllers/orders/_product_line.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_product_line.tpl @@ -147,7 +147,7 @@ {if ($can_edit)}
'.$this->getTerminalStatusLabel($this->object->is_terminal).'
', + ); + } $this->fields_form = array( 'legend' => array( @@ -119,25 +167,7 @@ class AdminRoomStatusesController extends ModuleAdminController 'name' => 'color', 'required' => true, ), - array( - 'type' => 'switch', - 'label' => $this->l('Terminal (final) status'), - 'name' => 'is_terminal_display', - 'hint' => $this->l('If set to Yes, a room with this status cannot be edited, only deleted. If No, the room can still be edited. This setting is fixed for each status, so it is disabled here.'), - 'disabled' => true, - 'values' => array( - array( - 'id' => 'is_terminal_on', - 'value' => 1, - 'label' => $this->l('Yes'), - ), - array( - 'id' => 'is_terminal_off', - 'value' => 0, - 'label' => $this->l('No'), - ), - ), - ), + $terminalInput, ), 'submit' => array( 'title' => $this->l('Save'), @@ -159,6 +189,22 @@ class AdminRoomStatusesController extends ModuleAdminController $this->errors[] = $this->l('Status name is required at least in ').$objDefaultLanguage['name']; } + if (Tools::getIsset('is_terminal')) { + $isTerminal = Tools::getValue('is_terminal'); + if (!$this->isTerminalEditable($this->object->id)) { + if ((int) $isTerminal != (int) $this->object->is_terminal) { + $this->errors[] = $this->l('Terminal (final) status can not be changed for this room status.'); + } + } elseif (!Validate::isBool($isTerminal)) { + $this->errors[] = $this->l('Invalid value for terminal (final) status.'); + } + } + + if (!empty($this->errors)) { + $this->display = 'edit'; + return false; + } + return parent::processSave(); } }