Skip to content
Snippets Groups Projects
Commit 05e20b8f authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

New: Can exclude some type of events

parent 44591bd7
Branches
Tags
No related merge requests found
...@@ -100,9 +100,10 @@ class CActionComm ...@@ -100,9 +100,10 @@ class CActionComm
* *
* @param int $active 1 or 0 to filter on event state active or not ('' by default = no filter) * @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 $idorcode 'id' or 'code'
* @param string $excludetype Type to exclude
* @return array Array of all event types if OK, <0 if KO * @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; global $langs,$conf;
$langs->load("commercial"); $langs->load("commercial");
...@@ -112,10 +113,8 @@ class CActionComm ...@@ -112,10 +113,8 @@ class CActionComm
$sql = "SELECT id, code, libelle, module"; $sql = "SELECT id, code, libelle, module";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm";
if ($active != '') if ($active != '') $sql.=" WHERE active=".$active;
{ if (! empty($excludetype)) $sql.=($active != ''?" AND":" WHERE")." type <> '".$excludetype."'";
$sql.=" WHERE active=".$active;
}
$sql.= " ORDER BY module, position"; $sql.= " ORDER BY module, position";
dol_syslog(get_class($this)."::liste_array sql=".$sql); dol_syslog(get_class($this)."::liste_array sql=".$sql);
......
...@@ -450,7 +450,7 @@ if ($action == 'create') ...@@ -450,7 +450,7 @@ if ($action == 'create')
} }
else else
{ {
$htmlactions->select_type_actions($actioncomm->type_code, "actioncode"); $htmlactions->select_type_actions($actioncomm->type_code, "actioncode","systemauto");
} }
print '</td></tr>'; print '</td></tr>';
......
...@@ -193,9 +193,10 @@ class FormActions ...@@ -193,9 +193,10 @@ class FormActions
* *
* @param string $selected Type pre-selectionne * @param string $selected Type pre-selectionne
* @param string $htmlname Nom champ formulaire * @param string $htmlname Nom champ formulaire
* @param string $excludetype Type to exclude
* @return void * @return void
*/ */
function select_type_actions($selected='',$htmlname='actioncode') function select_type_actions($selected='',$htmlname='actioncode',$excludetype='')
{ {
global $langs,$user; global $langs,$user;
...@@ -204,7 +205,7 @@ class FormActions ...@@ -204,7 +205,7 @@ class FormActions
$caction=new CActionComm($this->db); $caction=new CActionComm($this->db);
$form=new Form($this->db); $form=new Form($this->db);
$arraylist=$caction->liste_array(1,'code'); $arraylist=$caction->liste_array(1, 'code', $excludetype);
array_unshift($arraylist,'&nbsp;'); // Add empty line at start array_unshift($arraylist,'&nbsp;'); // Add empty line at start
//asort($arraylist); //asort($arraylist);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment