Admin - Keep the result of running the command (eg: how many rows affected, etc)

This commit is contained in:
nathangray 2019-03-21 14:29:33 -06:00
parent 674b63f77b
commit f7abe770bd
2 changed files with 30 additions and 0 deletions

View File

@ -39,6 +39,7 @@ use EGroupware\Api\Acl;
* @property string|NULL $comment comment, eg. reasoning why change was requested
* @property-read int|NULL $errno Numerical error-code or NULL on success
* @property-read string|NULL $error Error message or NULL on success
* @property-read string|NULL $result Result message indicating what happened, or NULL on failure
* @property-read int $id $id of command/row in egw_admin_queue table
* @property-read string $uid uuid of command (necessary if command is send to a remote system to execute)
* @property int|NULL $remote_id id of remote system, if command is not meant to run on local system
@ -248,6 +249,7 @@ abstract class admin_cmd
$this->status = admin_cmd::failed;
}
}
$this->result = $ret;
if (!$dont_save && !$dry_run && !$this->save($set_modifier))
{
throw new Api\Db\Exception(lang('Error saving the command!'));
@ -1431,4 +1433,17 @@ abstract class admin_cmd
}
return $widgets;
}
/**
* Get the result of executing the command.
* Should be some kind of success or results message indicating what was done.
*/
public function get_result()
{
if($this->result)
{
return $this->result;
}
return static::$stati[ $this->status ];
}
}

View File

@ -234,6 +234,21 @@ class admin_cmd_edit_user extends admin_cmd_change_pw
return 'admin.account';
}
/**
* Return (human readable) labels for keys of changes
*
* @return array
*/
function get_change_labels()
{
$labels = parent::get_change_labels();
$labels += array(
'account_lastname' => 'lastname',
'account_firstname' => 'firstname'
);
return $labels;
}
/**
* parse the expired string and return the expired date as timestamp
*