From bbd7c3af7768d620583fe6e9df47eb86260600aa Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sun, 27 Apr 2014 13:41:41 +0000 Subject: [PATCH] CliEdit.php: - execute(): call __handle_params() also if empty args[0] is given - __interactive(): only ask for id if $id_field is editable This fixes two issues with a non-editable auto_increment id field git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1661 a1433add-5e2c-0410-b055-b7f2511e0802 --- model/CliEdit.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/model/CliEdit.php b/model/CliEdit.php index 2fc040f4..5989709b 100644 --- a/model/CliEdit.php +++ b/model/CliEdit.php @@ -17,9 +17,7 @@ class CliEdit extends Shell { public function execute() { if (empty($this->args)) { $this->__interactive(); - } - - if (!empty($this->args[0])) { + } else { $this->__handle_params(); } } @@ -76,7 +74,8 @@ class CliEdit extends Shell { $form_fields = $handler->getStruct(); $id_field = $handler->getId_field(); - while(0==0) { # endlees loop - except if input is valid + $values[$id_field] = ''; + while($form_fields[$id_field]['editable'] != 0) { # endlees loop - except if input is valid or id_field is not editable (like auto_increment) $question = $form_fields[$id_field]['label'] . ":"; if ( $form_fields[$id_field]['desc'] != '') { $question .= "\n(" . $form_fields[$id_field]['desc'] . ')';