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
248ca9a5f9
commit
a311455526
|
@ -66,19 +66,13 @@ if (isset($_REQUEST['object']) and ($_REQUEST['object'] == 'filter')) {
|
||||||
$changes = $filter->changes($_REQUEST['filter']);
|
$changes = $filter->changes($_REQUEST['filter']);
|
||||||
ZM\Debug('Changes: ' . print_r($changes, true));
|
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 (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->Name('_TempFilter'.time());
|
||||||
$filter->Id(null);
|
$filter->Id(null);
|
||||||
}
|
|
||||||
} else if ($action == 'SaveAs') {
|
} else if ($action == 'SaveAs') {
|
||||||
$filter->Id(null);
|
$filter->Id(null);
|
||||||
}
|
}
|
||||||
|
@ -86,10 +80,9 @@ if (isset($_REQUEST['object']) and ($_REQUEST['object'] == 'filter')) {
|
||||||
$error_message = $filter->get_last_error();
|
$error_message = $filter->get_last_error();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We update the request id so that the newly saved filter is auto-selected
|
// We update the request id so that the newly saved filter is auto-selected
|
||||||
$_REQUEST['Id'] = $filter->Id();
|
$_REQUEST['Id'] = $filter->Id();
|
||||||
}
|
} # end if changes
|
||||||
|
|
||||||
if ($action == 'execute') {
|
if ($action == 'execute') {
|
||||||
$filter->execute();
|
$filter->execute();
|
||||||
|
|
Loading…
Reference in New Issue