Enhancement Auto and manual calendar. Better separation.

This commit is contained in:
Laurent Destailleur 2021-02-18 11:16:36 +01:00
parent 36e0deba3f
commit fc9d6cef97
6 changed files with 36 additions and 16 deletions

View File

@ -144,7 +144,7 @@ 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, -1=Keep details and add a combined line "All manual"
* @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 per calendar (Default, Auto, BoothConf, ...)
* @param string $morefilter Add more SQL filter
* @param int $shortlabel 1=Get short label instead of long label
* @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode.
@ -166,7 +166,7 @@ class CActionComm
}
if (!empty($excludetype)) $sql .= " AND type <> '".$this->db->escape($excludetype)."'";
if ($morefilter) $sql .= " AND ".$morefilter;
$sql .= " ORDER BY module, position, type";
$sql .= " ORDER BY type, position, module";
dol_syslog(get_class($this)."::liste_array", LOG_DEBUG);
$resql = $this->db->query($sql);
@ -200,8 +200,12 @@ class CActionComm
$keyfortrans = '';
$transcode = '';
$code = $obj->code;
if ($onlyautoornot > 0 && $code == 'AC_OTH') $code = 'AC_MANUAL';
if ($onlyautoornot > 0 && $code == 'AC_OTH_AUTO') $code = 'AC_AUTO';
$typecalendar = $obj->type;
if ($onlyautoornot > 0 && $typecalendar == 'system') $code = 'AC_MANUAL';
elseif ($onlyautoornot > 0 && $typecalendar == 'systemauto') $code = 'AC_AUTO';
elseif ($onlyautoornot > 0) $code = 'AC_'.strtoupper($obj->module);
if ($shortlabel)
{
$keyfortrans = "Action".$code.'Short';
@ -213,11 +217,18 @@ class CActionComm
$transcode = $langs->trans($keyfortrans);
}
$label = (($transcode != $keyfortrans) ? $transcode : $langs->trans($obj->label));
if ($onlyautoornot == -1 && !empty($conf->global->AGENDA_USE_EVENT_TYPE) && !preg_match('/auto/i', $code))
if ($onlyautoornot == -1 && !empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
$label = '&nbsp; '.$label;
$repid[-99] = $langs->trans("ActionAC_MANUAL");
$repcode['AC_NON_AUTO'] = $langs->trans("ActionAC_MANUAL");
if ($typecalendar == 'system') {
$label = '&nbsp; '.$label;
$repid[-99] = $langs->trans("ActionAC_MANUAL");
$repcode['AC_NON_AUTO'] = '-- '.$langs->trans("ActionAC_MANUAL");
}
if ($typecalendar == 'systemauto') {
$label = '&nbsp; '.$label;
$repid[-98] = $langs->trans("ActionAC_AUTO");
$repcode['AC_ALL_AUTO'] = '-- '.$langs->trans("ActionAC_AUTO");
}
}
$repid[$obj->id] = $label;
$repcode[$obj->code] = $label;

View File

@ -541,6 +541,8 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
{
$s = $hookmanager->resPrint;
}
$s .= "\n".'<!-- End div to calendars selectors -->'."\n";
} else // If javascript off
{
$newparam = $param; // newparam is for birthday links
@ -554,6 +556,8 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
$link .= '</a>';
}
// DEFAULT CALENDAR + AUTOEVENT CALENDAR + CONFERENCEBOOTH CALENDAR
// Load events from database into $eventarray
$eventarray = array();
@ -752,6 +756,7 @@ if ($resql)
dol_print_error($db);
}
// BIRTHDATES CALENDAR
// Complete $eventarray with birthdates
if ($showbirthday)
{
@ -817,6 +822,7 @@ if ($showbirthday)
}
}
// HOLIDAYS CALENDAR
if ($conf->global->AGENDA_SHOW_HOLIDAYS)
{
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
@ -900,6 +906,7 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS)
}
}
// EXTERNAL CALENDAR
// Complete $eventarray with external import Ical
if (count($listofextcals))
{
@ -1205,9 +1212,11 @@ if (is_readable($color_file))
}
if (!is_array($theme_datacolor)) $theme_datacolor = array(array(120, 130, 150), array(200, 160, 180), array(190, 190, 220));
$massactionbutton ='';
print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1, 'object_action', 0, $nav.'<span class="marginleftonly"></span>'.$newcardbutton, '', $limit, 1, 0, 1, $viewmode);
// Show div with list of calendars
print $s;

View File

@ -4,7 +4,7 @@ Actions=Events
Agenda=Agenda
TMenuAgenda=Agenda
Agendas=Agendas
LocalAgenda=Internal calendar
LocalAgenda=Default calendar
ActionsOwnedBy=Event owned by
ActionsOwnedByShort=Owner
AffectedTo=Assigned to
@ -20,7 +20,7 @@ MenuToDoActions=All incomplete events
MenuDoneActions=All terminated events
MenuToDoMyActions=My incomplete events
MenuDoneMyActions=My terminated events
ListOfEvents=List of events (internal calendar)
ListOfEvents=List of events (default calendar)
ActionsAskedBy=Events reported by
ActionsToDoBy=Events assigned to
ActionsDoneBy=Events done by
@ -131,7 +131,7 @@ AgendaUrlOptions4=<b>logint=%s</b> to restrict output to actions assigned to use
AgendaUrlOptionsProject=<b>project=__PROJECT_ID__</b> to restrict output to actions linked to project <b>__PROJECT_ID__</b>.
AgendaUrlOptionsNotAutoEvent=<b>notactiontype=systemauto</b> to exclude automatic events.
AgendaUrlOptionsIncludeHolidays=<b>includeholidays=1</b> to include events of holidays.
AgendaShowBirthdayEvents=Show birthdays of contacts
AgendaShowBirthdayEvents=Birthdays of contacts
AgendaHideBirthdayEvents=Hide birthdays of contacts
Busy=Busy
ExportDataset_event1=List of agenda events

View File

@ -64,10 +64,10 @@ ActionAC_SHIP=Send shipping by mail
ActionAC_SUP_ORD=Send purchase order by mail
ActionAC_SUP_INV=Send vendor invoice by mail
ActionAC_OTH=Other
ActionAC_OTH_AUTO=Automatically inserted events
ActionAC_OTH_AUTO=Other auto
ActionAC_MANUAL=Manually inserted events
ActionAC_AUTO=Automatically inserted events
ActionAC_OTH_AUTOShort=Auto
ActionAC_OTH_AUTOShort=Other
Stats=Sales statistics
StatusProsp=Prospect status
DraftPropals=Draft commercial proposals

View File

@ -130,7 +130,7 @@ AgendaUrlOptions4=<b>logint=%s</b>pour limiter l'export aux actions assignées
AgendaUrlOptionsProject=<b>project=__PROJECT_ID__</b> pour restreindre aux événements associés au projet <b>__PROJECT_ID__</b>.
AgendaUrlOptionsNotAutoEvent=<b>notactiontype=systemauto</b> pour exclure les événements automatiques.
AgendaUrlOptionsIncludeHolidays=<b>includeholidays=1</b> pour inclure les événements de type congé.
AgendaShowBirthdayEvents=Afficher les anniversaires de contacts
AgendaShowBirthdayEvents=Anniversaires de contacts
AgendaHideBirthdayEvents=Masquer les anniversaires de contacts
Busy=Occupé
ExportDataset_event1=Liste des événements de l'agenda

View File

@ -64,10 +64,10 @@ ActionAC_SHIP=Envoi bon d'expédition par email
ActionAC_SUP_ORD=Envoi commande fournisseur par email
ActionAC_SUP_INV=Envoi facture fournisseur par email
ActionAC_OTH=Autre
ActionAC_OTH_AUTO=Évènements insérés automatiquement
ActionAC_OTH_AUTO=Autre auto
ActionAC_MANUAL=Événements insérés manuellement
ActionAC_AUTO=Événements insérés automatiquement
ActionAC_OTH_AUTOShort=Auto
ActionAC_OTH_AUTOShort=Autre
Stats=Statistiques de vente
StatusProsp=Status prospection
DraftPropals=Propositions brouillons