diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index cd07b4db587..57edea39a32 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -38,6 +38,7 @@ $langs->load("agenda"); $action = GETPOST('action','alpha'); $cancel = GETPOST('cancel','alpha'); +$search_event = GETPOST('search_event', 'alpha'); // Get list of triggers available $sql = "SELECT a.rowid, a.code, a.label, a.elementtype"; @@ -70,6 +71,12 @@ else * Actions */ +// Purge search criteria +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers +{ + $search_event = ''; +} + if ($action == "save" && empty($cancel)) { $i=0; @@ -78,10 +85,13 @@ if ($action == "save" && empty($cancel)) foreach ($triggers as $trigger) { - $param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code']; + $keyparam='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code']; //print "param=".$param." - ".$_POST[$param]; - $res = dolibarr_set_const($db,$param,(GETPOST($param,'alpha')?GETPOST($param,'alpha'):''),'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; + if ($search_event === '' || preg_match('/'.preg_quote($search_event,'/').'/i', $keyparam)) + { + $res = dolibarr_set_const($db,$keyparam,(GETPOST($keyparam,'alpha')?GETPOST($keyparam,'alpha'):''),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } } if (! $error) @@ -140,6 +150,8 @@ print '