diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 56465d45fdb..5e14b45665b 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -99,13 +99,14 @@ class CActionComm /** * Return list of event types: array(id=>label) or array(code=>label) * - * @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter) + * @param string|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 - * @param int $onlyautoornot Group list by auto events or not + * @param string $excludetype Type to exclude ('system' or 'systemauto') + * @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type + * @param string $morefilter Add more SQL filter * @return mixed Array of all event types if OK, <0 if KO */ - function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0) + function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0, $morefilter='') { global $langs,$conf; $langs->load("commercial"); @@ -115,8 +116,10 @@ class CActionComm $sql = "SELECT id, code, libelle, module, type, color"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; - if ($active != '') $sql.=" WHERE active=".$active; - if (! empty($excludetype)) $sql.=($active != ''?" AND":" WHERE")." type <> '".$excludetype."'"; + $sql.= " WHERE 1=1"; + if ($active != '') $sql.=" AND active=".$active; + if (! empty($excludetype)) $sql.=" AND type <> '".$excludetype."'"; + if ($morefilter) $sql.=" AND ".$morefilter; $sql.= " ORDER BY module, position"; dol_syslog(get_class($this)."::liste_array", LOG_DEBUG); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 9b466e3d9b7..2324b6ee799 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -902,7 +902,7 @@ if (count($listofextcals)) $daykey=dol_mktime(0,0,0,$mois,$jour,$annee); $daykeygmt=dol_mktime(0,0,0,$mois,$jour,$annee,true,0); do - { + { //if ($event->fulldayevent) print dol_print_date($daykeygmt,'dayhour','gmt').'-'.dol_print_date($daykey,'dayhour','gmt').'-'.dol_print_date($event->date_end_in_calendar,'dayhour','gmt').' '; $eventarray[$daykey][]=$event; $daykey+=60*60*24; $daykeygmt+=60*60*24; // Add one day @@ -951,7 +951,7 @@ if (empty($action) || $action == 'show_month') // View by month $newparam=preg_replace('/viewcal=[0-9]+&?/i','',$newparam); $newparam=preg_replace('/showbirthday_=/i','showbirthday=',$newparam); // Restore correct parameter $newparam.='&viewcal=1'; - echo '
| '.$langs->trans("Day".$arraytimestamp['wday'])." | \n"; echo "