enable reporting saving errors back to web ui.
This commit is contained in:
parent
3fdd2bff7f
commit
be0841832e
|
@ -18,9 +18,11 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
|
||||
global $error_message;
|
||||
// Event scope actions, view permissions only required
|
||||
if ( !canView('Events') ) {
|
||||
ZM\Warning('You do not have permission to view Events.');
|
||||
$error_message = 'You do not have permission to view Events.';
|
||||
ZM\Warning($error_message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -65,12 +67,13 @@ if ( isset($_REQUEST['object']) and ( $_REQUEST['object'] == 'filter' ) ) {
|
|||
$changes = $filter->changes($_REQUEST['filter']);
|
||||
ZM\Debug('Changes: ' . print_r($changes,true));
|
||||
|
||||
if ( $_REQUEST['Id'] and ( $action == 'Save' ) ) {
|
||||
if ( $filter->Background() )
|
||||
$filter->control('stop');
|
||||
$filter->save($changes);
|
||||
if ($filter->Id() and ($action == 'Save')) {
|
||||
if ($filter->Background()) $filter->control('stop');
|
||||
if (!$filter->save($changes)) {
|
||||
$error_message = $filter->get_last_error();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
if ( $action == 'execute' ) {
|
||||
if ( count($changes) ) {
|
||||
$filter->Name('_TempFilter'.time());
|
||||
|
@ -79,7 +82,10 @@ if ( isset($_REQUEST['object']) and ( $_REQUEST['object'] == 'filter' ) ) {
|
|||
} else if ( $action == 'SaveAs' ) {
|
||||
$filter->Id(null);
|
||||
}
|
||||
$filter->save($changes);
|
||||
if (!$filter->save($changes)) {
|
||||
$error_message = $filter->get_last_error();
|
||||
return;
|
||||
}
|
||||
|
||||
// We update the request id so that the newly saved filter is auto-selected
|
||||
$_REQUEST['Id'] = $filter->Id();
|
||||
|
|
Loading…
Reference in New Issue