When there is an error saving, add the invalidFields() info to the error message. Only restart the daemon on success.
This commit is contained in:
parent
6d0b5fb86f
commit
1503c586d2
|
@ -151,17 +151,9 @@ class MonitorsController extends AppController {
|
|||
throw new UnauthorizedException(__('Insufficient privileges'));
|
||||
return;
|
||||
}
|
||||
if ($this->Monitor->save($this->request->data)) {
|
||||
$message = 'Saved';
|
||||
} else {
|
||||
$message = 'Error';
|
||||
}
|
||||
|
||||
$this->set(array(
|
||||
'message' => $message,
|
||||
'_serialize' => array('message')
|
||||
));
|
||||
|
||||
if ( $this->Monitor->save($this->request->data) ) {
|
||||
$message .= 'Saved';
|
||||
$Monitor = $this->Monitor->find('first', array(
|
||||
'fields' => array('Function','ServerId'),
|
||||
'conditions' => array('Id' => $id)
|
||||
|
@ -174,6 +166,15 @@ class MonitorsController extends AppController {
|
|||
if ( ( $func != 'None' ) and ( (!defined('ZM_SERVER_ID')) or ($Monitor['ServerId']==ZM_SERVER_ID) ) ) {
|
||||
$this->daemonControl( $this->Monitor->id, 'start' );
|
||||
}
|
||||
} else {
|
||||
$message .= 'Error ' . print_r($this->Monitor->invalidFields(), true);
|
||||
}
|
||||
|
||||
$this->set(array(
|
||||
'message' => $message,
|
||||
'_serialize' => array('message')
|
||||
));
|
||||
|
||||
} // end function edit
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue