|
@@ -105,9 +105,9 @@ class CActionComm
|
|
|
* @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 ('system' or 'systemauto')
|
|
|
- * @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type
|
|
|
+ * @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual"
|
|
|
* @param string $morefilter Add more SQL filter
|
|
|
- * @return mixed Array of all event types if OK, <0 if KO
|
|
|
+ * @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode.
|
|
|
*/
|
|
|
function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0, $morefilter='')
|
|
|
{
|
|
@@ -123,7 +123,7 @@ class CActionComm
|
|
|
if ($active != '') $sql.=" AND active=".$active;
|
|
|
if (! empty($excludetype)) $sql.=" AND type <> '".$excludetype."'";
|
|
|
if ($morefilter) $sql.=" AND ".$morefilter;
|
|
|
- $sql.= " ORDER BY module, position";
|
|
|
+ $sql.= " ORDER BY module, position, type";
|
|
|
|
|
|
dol_syslog(get_class($this)."::liste_array", LOG_DEBUG);
|
|
|
$resql=$this->db->query($sql);
|
|
@@ -140,7 +140,7 @@ class CActionComm
|
|
|
$qualified=1;
|
|
|
|
|
|
// $obj->type can be system, systemauto, module, moduleauto, xxx, xxxauto
|
|
|
- if ($qualified && $onlyautoornot && preg_match('/^system/',$obj->type) && ! preg_match('/^AC_OTH/',$obj->code)) $qualified=0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
|
|
|
+ if ($qualified && $onlyautoornot > 0 && preg_match('/^system/',$obj->type) && ! preg_match('/^AC_OTH/',$obj->code)) $qualified=0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
|
|
|
|
|
|
if ($qualified && $obj->module)
|
|
|
{
|
|
@@ -155,12 +155,19 @@ class CActionComm
|
|
|
if ($qualified)
|
|
|
{
|
|
|
$code=$obj->code;
|
|
|
- if ($onlyautoornot && $code == 'AC_OTH') $code='AC_MANUAL';
|
|
|
- if ($onlyautoornot && $code == 'AC_OTH_AUTO') $code='AC_AUTO';
|
|
|
+ if ($onlyautoornot > 0 && $code == 'AC_OTH') $code='AC_MANUAL';
|
|
|
+ if ($onlyautoornot > 0 && $code == 'AC_OTH_AUTO') $code='AC_AUTO';
|
|
|
$transcode=$langs->trans("Action".$code);
|
|
|
- $repid[$obj->id] = ($transcode!="Action".$code?$transcode:$langs->trans($obj->label));
|
|
|
- $repcode[$obj->code] = ($transcode!="Action".$code?$transcode:$langs->trans($obj->label));
|
|
|
- if ($onlyautoornot && preg_match('/^module/',$obj->type) && $obj->module) $repcode[$obj->code].=' ('.$langs->trans("Module").': '.$obj->module.')';
|
|
|
+ $label = ($transcode!="Action".$code?$transcode:$langs->trans($obj->label));
|
|
|
+ if ($onlyautoornot == -1 && ! empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! preg_match('/auto/i', $code))
|
|
|
+ {
|
|
|
+ $label=' '.$label;
|
|
|
+ $repid[-99]=$langs->trans("ActionAC_MANUAL");
|
|
|
+ $repcode['AC_NON_AUTO']=$langs->trans("ActionAC_MANUAL");
|
|
|
+ }
|
|
|
+ $repid[$obj->id] = $label;
|
|
|
+ $repcode[$obj->code] = $label;
|
|
|
+ if ($onlyautoornot > 0 && preg_match('/^module/',$obj->type) && $obj->module) $repcode[$obj->code].=' ('.$langs->trans("Module").': '.$obj->module.')';
|
|
|
}
|
|
|
$i++;
|
|
|
}
|