From 4df9fb38fbc527ade14e7e9a0176f836f4053e1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Mon, 20 Oct 2014 12:29:35 +0200 Subject: [PATCH] Add option AGENDA_ALWAYS_HIDE_AUTO --- htdocs/comm/action/index.php | 7 +++++++ htdocs/comm/action/listactions.php | 11 +++++++++-- htdocs/comm/action/peruser.php | 7 +++++++ htdocs/core/class/html.formactions.class.php | 2 ++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 2098a07d20b..2a425cf51f9 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -483,6 +483,13 @@ if ($resql) { $obj = $db->fetch_object($resql); + // Discard auto action if option is on + if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->code == 'AC_OTH_AUTO') + { + $i++; + continue; + } + // Create a new object action $event=new ActionComm($db); $event->id=$obj->id; diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 4fc7386157b..4850394e557 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -156,7 +156,7 @@ if ($type) $param.="&type=".$type; $sql = "SELECT s.nom as societe, s.rowid as socid, s.client,"; $sql.= " a.id, a.datep as dp, a.datep2 as dp2,"; $sql.= " a.fk_contact, a.note, a.label, a.percent as percent,"; -$sql.= " c.code as acode, c.libelle,"; +$sql.= " c.code as code, c.libelle,"; $sql.= " ua.login as loginauthor, ua.rowid as useridauthor,"; $sql.= " ut.login as logintodo, ut.rowid as useridtodo,"; //$sql.= " ud.login as logindone, ud.rowid as useriddone,"; @@ -292,6 +292,13 @@ if ($resql) { $obj = $db->fetch_object($resql); + // Discard auto action if option is on + if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->code == 'AC_OTH_AUTO') + { + $i++; + continue; + } + $var=!$var; print "<tr ".$bc[$var].">"; @@ -299,7 +306,7 @@ if ($resql) // Action (type) print '<td>'; $actionstatic->id=$obj->id; - $actionstatic->type_code=$obj->acode; + $actionstatic->type_code=$obj->code; $actionstatic->libelle=$obj->label; print $actionstatic->getNomUrl(1,28); print '</td>'; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index dacc7c5ce00..da34983779a 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -395,6 +395,13 @@ if ($resql) { $obj = $db->fetch_object($resql); + // Discard auto action if option is on + if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->code == 'AC_OTH_AUTO') + { + $i++; + continue; + } + // Create a new object action $event=new ActionComm($db); $event->id=$obj->id; diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 696a70867cf..333969fc3b3 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -266,6 +266,8 @@ class FormActions if ($selected == 'manual') $selected='AC_OTH'; if ($selected == 'auto') $selected='AC_OTH_AUTO'; + if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO)) unset($arraylist['AC_OTH_AUTO']); + print $form->selectarray($htmlname, $arraylist, $selected); if ($user->admin && empty($onlyautoornot) && empty($hideinfohelp)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); } -- GitLab