New: Can exclude some type of events

This commit is contained in:
Laurent Destailleur 2012-09-20 00:42:51 +02:00
parent 44591bd756
commit 05e20b8f30
3 changed files with 14 additions and 14 deletions

View File

@ -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 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'
* @return array Array of all event types if OK, <0 if KO * @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; global $langs,$conf;
$langs->load("commercial"); $langs->load("commercial");
@ -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);

View File

@ -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>';

View File

@ -191,11 +191,12 @@ class FormActions
/** /**
* Output list of type of event * Output list of type of event
* *
* @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
$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);