diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index ba9f86587847082b373268a73f69793d7baec521..f4ad2f6f078d241d6d27aea9310293c25adb36f6 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -96,13 +96,14 @@ class CActionComm } /** - * Return list of event types + * Return list of event types * - * @param int $active 1 or 0 to filter on event state active or not ('' by default = no filter) - * @param string $idorcode 'id' or 'code' - * @return array Array of all event types if OK, <0 if KO + * @param int $active 1 or 0 to filter on event state active or not ('' by default = no filter) + * @param string $idorcode 'id' or 'code' + * @param string $excludetype Type to exclude + * @return array Array of all event types if OK, <0 if KO */ - function liste_array($active='',$idorcode='id') + function liste_array($active='',$idorcode='id',$excludetype='') { global $langs,$conf; $langs->load("commercial"); @@ -112,10 +113,8 @@ class CActionComm $sql = "SELECT id, code, libelle, module"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; - if ($active != '') - { - $sql.=" WHERE active=".$active; - } + if ($active != '') $sql.=" WHERE active=".$active; + if (! empty($excludetype)) $sql.=($active != ''?" AND":" WHERE")." type <> '".$excludetype."'"; $sql.= " ORDER BY module, position"; dol_syslog(get_class($this)."::liste_array sql=".$sql); diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 6cdb7a7758065ab9dc3500d6475a3df1724af195..be4f27a141c8156a35df00d52917bf179f74a78f 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -450,7 +450,7 @@ if ($action == 'create') } else { - $htmlactions->select_type_actions($actioncomm->type_code, "actioncode"); + $htmlactions->select_type_actions($actioncomm->type_code, "actioncode","systemauto"); } print '</td></tr>'; diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 9435cebb1a4ba5c18fe0d8f9764801e1256a7be5..09213bdd0b997f1a72902731b5b4d76e82260c77 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -191,11 +191,12 @@ class FormActions /** * Output list of type of event * - * @param string $selected Type pre-selectionne - * @param string $htmlname Nom champ formulaire + * @param string $selected Type pre-selectionne + * @param string $htmlname Nom champ formulaire + * @param string $excludetype Type to exclude * @return void */ - function select_type_actions($selected='',$htmlname='actioncode') + function select_type_actions($selected='',$htmlname='actioncode',$excludetype='') { global $langs,$user; @@ -204,7 +205,7 @@ class FormActions $caction=new CActionComm($this->db); $form=new Form($this->db); - $arraylist=$caction->liste_array(1,'code'); + $arraylist=$caction->liste_array(1, 'code', $excludetype); array_unshift($arraylist,' '); // Add empty line at start //asort($arraylist);