clean up code logic so that if we are executing an unchanged filter we don't do the unecessary save.
This commit is contained in:
parent
3ca920f1a9
commit
809183716a
|
@ -66,19 +66,13 @@ if (isset($_REQUEST['object']) and ($_REQUEST['object'] == 'filter')) {
|
|||
$changes = $filter->changes($_REQUEST['filter']);
|
||||
ZM\Debug('Changes: ' . print_r($changes, true));
|
||||
|
||||
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 there are changes use a temp filter to do the execute
|
||||
if (count($changes)) {
|
||||
if ($filter->Id() and ($action == 'Save') and $filter->Background()) {
|
||||
$filter->control('stop');
|
||||
} else if ($action == 'execute') {
|
||||
# If there are changes use a temp filter to do the execute
|
||||
$filter->Name('_TempFilter'.time());
|
||||
$filter->Id(null);
|
||||
}
|
||||
} else if ($action == 'SaveAs') {
|
||||
$filter->Id(null);
|
||||
}
|
||||
|
@ -86,10 +80,9 @@ if (isset($_REQUEST['object']) and ($_REQUEST['object'] == 'filter')) {
|
|||
$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();
|
||||
}
|
||||
} # end if changes
|
||||
|
||||
if ($action == 'execute') {
|
||||
$filter->execute();
|
||||
|
|
Loading…
Reference in New Issue