From fc9d6cef97acd604258f6b06895d0b1ff531b634 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Feb 2021 11:16:36 +0100 Subject: [PATCH 01/11] Enhancement Auto and manual calendar. Better separation. --- .../comm/action/class/cactioncomm.class.php | 27 +++++++++++++------ htdocs/comm/action/index.php | 9 +++++++ htdocs/langs/en_US/agenda.lang | 6 ++--- htdocs/langs/en_US/commercial.lang | 4 +-- htdocs/langs/fr_FR/agenda.lang | 2 +- htdocs/langs/fr_FR/commercial.lang | 4 +-- 6 files changed, 36 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 3b932b2f59c..870bb8c109e 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -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 = '  '.$label; - $repid[-99] = $langs->trans("ActionAC_MANUAL"); - $repcode['AC_NON_AUTO'] = $langs->trans("ActionAC_MANUAL"); + if ($typecalendar == 'system') { + $label = '  '.$label; + $repid[-99] = $langs->trans("ActionAC_MANUAL"); + $repcode['AC_NON_AUTO'] = '-- '.$langs->trans("ActionAC_MANUAL"); + } + if ($typecalendar == 'systemauto') { + $label = '  '.$label; + $repid[-98] = $langs->trans("ActionAC_AUTO"); + $repcode['AC_ALL_AUTO'] = '-- '.$langs->trans("ActionAC_AUTO"); + } } $repid[$obj->id] = $label; $repcode[$obj->code] = $label; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index d5f5edbb143..10c95f0b64b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -541,6 +541,8 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on { $s = $hookmanager->resPrint; } + + $s .= "\n".''."\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 .= ''; } + +// 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.''.$newcardbutton, '', $limit, 1, 0, 1, $viewmode); +// Show div with list of calendars print $s; diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 33e0c01aad6..d16188d40d4 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -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=logint=%s to restrict output to actions assigned to use AgendaUrlOptionsProject=project=__PROJECT_ID__ to restrict output to actions linked to project __PROJECT_ID__. AgendaUrlOptionsNotAutoEvent=notactiontype=systemauto to exclude automatic events. AgendaUrlOptionsIncludeHolidays=includeholidays=1 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 diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 10c536e0d48..2181b48ecb4 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -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 diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index 072fd057dbf..7ecd5800861 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -130,7 +130,7 @@ AgendaUrlOptions4=logint=%spour limiter l'export aux actions assignées AgendaUrlOptionsProject=project=__PROJECT_ID__ pour restreindre aux événements associés au projet __PROJECT_ID__. AgendaUrlOptionsNotAutoEvent=notactiontype=systemauto pour exclure les événements automatiques. AgendaUrlOptionsIncludeHolidays=includeholidays=1 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 diff --git a/htdocs/langs/fr_FR/commercial.lang b/htdocs/langs/fr_FR/commercial.lang index 9b5721326d1..badec05e8c2 100644 --- a/htdocs/langs/fr_FR/commercial.lang +++ b/htdocs/langs/fr_FR/commercial.lang @@ -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 From 56d2ac274a25cb12c4556805d0fbac470ab117ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Feb 2021 12:46:42 +0100 Subject: [PATCH 02/11] NEW Support color of type of event --- htdocs/comm/action/class/actioncomm.class.php | 46 +++++++++++-------- .../comm/action/class/cactioncomm.class.php | 27 +++++++++-- htdocs/comm/action/index.php | 45 ++++++++++++------ htdocs/comm/action/list.php | 2 +- htdocs/comm/action/pertype.php | 4 +- htdocs/comm/action/peruser.php | 5 +- htdocs/core/class/html.formactions.class.php | 2 +- 7 files changed, 89 insertions(+), 42 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c2dc7f6b2a6..615ebd24f01 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -85,6 +85,11 @@ class ActionComm extends CommonObject */ public $type_id; + /** + * @var string Calendar of event (Type of type of event). 'system'=Default calendar, 'systemauto'=Auto calendar, 'birthdate', 'holiday', 'module'=Calendar specific to a module + */ + public $type; + /** * @var string Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH. */ @@ -95,16 +100,16 @@ class ActionComm extends CommonObject */ public $type_label; - /** - * @var string Label into parent table llx_c_actioncomm (used only if option to use type is set) - */ - public $type; - /** * @var string Color into parent table llx_c_actioncomm (used only if option to use type is set) */ public $type_color; + /** + * @var string Picto for type of event (used only if option to use type is set) + */ + public $type_picto; + /** * @var string Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...) */ @@ -1376,7 +1381,7 @@ class ActionComm extends CommonObject * @param int $maxlength Max number of charaters into label. If negative, use the ref as label. * @param string $classname Force style class on a link * @param string $option '' = Link to action, 'birthday'= Link to contact, 'holiday' = Link to leave - * @param int $overwritepicto 1 = Overwrite picto + * @param int $overwritepicto 1 = Overwrite picto with this one * @param int $notooltip 1 = Disable tooltip * @param int $save_lastsearch_value -1 = Auto, 0 = No save of lastsearch_values when clicking, 1 = Save lastsearch_values whenclicking * @return string Chaine avec URL @@ -1426,8 +1431,8 @@ class ActionComm extends CommonObject if (!empty($this->note_private)) $tooltip .= '
'.$langs->trans('Note').': '.(dol_textishtml($this->note_private) ? str_replace(array("\r", "\n"), "", $this->note_private) : str_replace(array("\r", "\n"), '
', $this->note_private)); $linkclose = ''; - if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) - $linkclose = ' style="background-color:#'.$this->type_color.'"'; + //if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) + // $linkclose = ' style="background-color:#'.$this->type_color.'"'; if (empty($notooltip)) { @@ -1453,6 +1458,7 @@ class ActionComm extends CommonObject elseif ($option == 'holiday') $url = DOL_URL_ROOT.'/holiday/card.php?id='.$this->id; else $url = DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id; + if ($option !== 'nolink') { // Add param to save lastsearch_values or not @@ -1494,7 +1500,7 @@ class ActionComm extends CommonObject } $result .= $linkstart; - if ($withpicto) $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$libelle), ($overwritepicto ? $overwritepicto : 'action'), ($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto) $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$libelle), ($overwritepicto ? $overwritepicto : 'action'), ($this->type_color ? 'style="color: #'.$this->type_color.' !important;" ' : '').($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); $result .= $libelleshort; $result .= $linkend; @@ -1520,21 +1526,25 @@ class ActionComm extends CommonObject $imgpicto = ''; if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + $color = ''; + if ($this->type_color) { + $color = 'style="color: #'.$this->type_color.' !important;"'; + } if ($this->type_picto) { $imgpicto = img_picto('', $this->type_picto, 'class="paddingright"'); } else { - if ($this->type_code == 'AC_RDV') $imgpicto = img_picto('', 'meeting', '', false, 0, 0, '', 'paddingright'); - elseif ($this->type_code == 'AC_TEL') $imgpicto = img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright'); - elseif ($this->type_code == 'AC_FAX') $imgpicto = img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright'); - elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN') $imgpicto = img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright'); - elseif ($this->type_code == 'AC_INT') $imgpicto = img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright'); - elseif ($this->type_code == 'AC_OTH' && $this->code == 'TICKET_MSG') $imgpicto = img_picto('', 'object_conversation', '', false, 0, 0, '', 'paddingright'); - elseif (!preg_match('/_AUTO/', $this->type_code)) $imgpicto = img_picto('', 'user-cog', '', false, 0, 0, '', 'paddingright'); - else $imgpicto = img_picto('', 'cog', '', false, 0, 0, '', 'paddingright'); + if ($this->type_code == 'AC_RDV') $imgpicto = img_picto('', 'meeting', $color, false, 0, 0, '', 'paddingright'); + elseif ($this->type_code == 'AC_TEL') $imgpicto = img_picto('', 'object_phoning', $color, false, 0, 0, '', 'paddingright'); + elseif ($this->type_code == 'AC_FAX') $imgpicto = img_picto('', 'object_phoning_fax', $color, false, 0, 0, '', 'paddingright'); + elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN') $imgpicto = img_picto('', 'object_email', $color, false, 0, 0, '', 'paddingright'); + elseif ($this->type_code == 'AC_INT') $imgpicto = img_picto('', 'object_intervention', $color, false, 0, 0, '', 'paddingright'); + elseif ($this->type_code == 'AC_OTH' && $this->code == 'TICKET_MSG') $imgpicto = img_picto('', 'object_conversation', $color, false, 0, 0, '', 'paddingright'); + elseif ($this->type != 'systemauto') $imgpicto = img_picto('', 'user-cog', $color, false, 0, 0, '', 'paddingright'); + else $imgpicto = img_picto('', 'cog', $color, false, 0, 0, '', 'paddingright'); } } else { // 2 picto: 1 for auto, 1 for manual - if (!preg_match('/_AUTO/', $this->type_code)) $imgpicto = img_picto('', 'user-cog', '', false, 0, 0, '', 'paddingright'); + if ($this->type != 'systemauto') $imgpicto = img_picto('', 'user-cog', '', false, 0, 0, '', 'paddingright'); else $imgpicto = img_picto('', 'cog', '', false, 0, 0, '', 'paddingright'); } return $imgpicto; diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 870bb8c109e..6b02c026575 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -142,7 +142,7 @@ 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 $idorcode 'id' or 'code' + * @param string $idorcode 'id' or 'code' or 'all' * @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 per calendar (Default, Auto, BoothConf, ...) * @param string $morefilter Add more SQL filter @@ -157,6 +157,7 @@ class CActionComm $repid = array(); $repcode = array(); + $repall = array(); $sql = "SELECT id, code, libelle as label, module, type, color, picto"; $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; @@ -175,6 +176,7 @@ class CActionComm $nump = $this->db->num_rows($resql); if ($nump) { + $idforallfornewmodule = 97; $i = 0; while ($i < $nump) { @@ -220,25 +222,40 @@ class CActionComm if ($onlyautoornot == -1 && !empty($conf->global->AGENDA_USE_EVENT_TYPE)) { if ($typecalendar == 'system') { - $label = '  '.$label; + $label = '   '.$label; $repid[-99] = $langs->trans("ActionAC_MANUAL"); $repcode['AC_NON_AUTO'] = '-- '.$langs->trans("ActionAC_MANUAL"); } if ($typecalendar == 'systemauto') { - $label = '  '.$label; + $label = '   '.$label; $repid[-98] = $langs->trans("ActionAC_AUTO"); $repcode['AC_ALL_AUTO'] = '-- '.$langs->trans("ActionAC_AUTO"); } + if ($typecalendar == 'module') { + $label = '   '.$label; + if (!isset($repcode['AC_ALL_'.strtoupper($obj->module)])) { // If first time for this module + $idforallfornewmodule--; + } + $repid[$idforallfornewmodule] = $langs->trans("ActionAC_ALL_".strtoupper($obj->module)); + $repcode['AC_ALL_'.strtoupper($obj->module)] = '-- '.$langs->trans("Module").' '.ucfirst($obj->module); + } } $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.')'; + $repall[$obj->code] = array('id' => $label, 'label' => $label, 'type' => $typecalendar, 'color' => $obj->color, 'picto' => $obj->picto); + if ($onlyautoornot > 0 && preg_match('/^module/', $obj->type) && $obj->module) { + $repcode[$obj->code] .= ' ('.$langs->trans("Module").': '.$obj->module.')'; + $repall[$obj->code]['label'] .= ' ('.$langs->trans("Module").': '.$obj->module.')'; + } } $i++; } } + if ($idorcode == 'id') $this->liste_array = $repid; - if ($idorcode == 'code') $this->liste_array = $repcode; + elseif ($idorcode == 'code') $this->liste_array = $repcode; + else $this->liste_array = $repall; + return $this->liste_array; } else { $this->error = $this->db->lasterror(); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 10c95f0b64b..0b3e2f7223a 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -557,10 +557,11 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on } -// DEFAULT CALENDAR + AUTOEVENT CALENDAR + CONFERENCEBOOTH CALENDAR // Load events from database into $eventarray $eventarray = array(); + +// DEFAULT CALENDAR + AUTOEVENT CALENDAR + CONFERENCEBOOTH CALENDAR $sql = 'SELECT '; if ($usergroup > 0) $sql .= " DISTINCT"; $sql .= ' a.id, a.label,'; @@ -571,7 +572,7 @@ $sql .= ' a.fk_user_author,a.fk_user_action,'; $sql .= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql .= ' a.fk_soc, a.fk_contact, a.fk_project,'; $sql .= ' a.fk_element, a.elementtype,'; -$sql .= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color'; +$sql .= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color, ca.type as type_type, ca.picto as type_picto'; $sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; // We must filter on resource table @@ -689,13 +690,17 @@ if ($resql) $event->type_code = $obj->type_code; $event->type_label = $obj->type_label; $event->type_color = $obj->type_color; + $event->type = $obj->type_type; + $event->type_picto = $obj->type_picto; $event->libelle = $obj->label; // deprecated $event->label = $obj->label; $event->percentage = $obj->percent; + $event->authorid = $obj->fk_user_author; // user id of creator $event->userownerid = $obj->fk_user_action; // user id of owner $event->fetch_userassigned(); // This load $event->userassigned + $event->priority = $obj->priority; $event->fulldayevent = $obj->fulldayevent; $event->location = $obj->location; @@ -793,7 +798,13 @@ if ($showbirthday) $datearray = dol_getdate($datebirth, true); $event->datep = dol_mktime(0, 0, 0, $datearray['mon'], $datearray['mday'], $year, true); // For full day events, date are also GMT but they wont but converted during output $event->datef = $event->datep; + $event->type_code = 'BIRTHDAY'; + $event->type_label = ''; + $event->type_color = ''; + $event->type = 'birthdate'; + $event->type_picto = 'birthdate'; + $event->label = $langs->trans("Birthday").' '.dolGetFirstLastname($obj->firstname, $obj->lastname); $event->percentage = 100; $event->fulldayevent = 1; @@ -862,7 +873,12 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS) $event->id = $obj->rowid; $event->ref = $event->id; - $event->type_code = 'HOLIDAY'; + $event->type_code = 'HOLIDAY'; + $event->type_label = ''; + $event->type_color = ''; + $event->type = 'holiday'; + $event->type_picto = 'holiday'; + $event->datep = dol_mktime(0, 0, 0, $dateStartArray['mon'], $dateStartArray['mday'], $dateStartArray['year'], true); $event->datef = dol_mktime(0, 0, 0, $dateEndArray['mon'], $dateEndArray['mday'], $dateEndArray['year'], true); $event->date_start_in_calendar = $event->datep; @@ -1095,9 +1111,12 @@ if (count($listofextcals)) $event->userassigned[$userId] = $userId; $event->percentage = -1; } - else { - $event->type_code = "ICALEVENT"; - } + + $event->type_code = "ICALEVENT"; + $event->type_label = $namecal; + $event->type_color = $colorcal; + $event->type = 'icalevent'; + $event->type_picto = 'rss'; $event->icalname = $namecal; $event->icalcolor = $colorcal; @@ -1660,7 +1679,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa // Show rect of event print "\n"; print ''."\n"; - print '
type_code == 'BIRTHDAY') // It's a birthday - { + if ($event->type_code == 'BIRTHDAY') { // It's birthday calendar print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact'); - } elseif ($event->type_code == 'HOLIDAY') - { + } elseif ($event->type_code == 'HOLIDAY') { // It's holiday calendar print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'holiday', 'user'); - } elseif ($event->type_code != 'BIRTHDAY' && $event->type_code != 'HOLIDAY') - { + } else { // Other calendar // Picto if (empty($event->fulldayevent)) { @@ -1761,7 +1777,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $event->label = $titletoshow; $event->libelle = $titletoshow; // Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user. - $titletoshow = $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title', '', 0, 0); + $titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : ''); + $titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title', '', 0, 0); $event->label = $savlabel; $event->libelle = $savlabel; } diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 03dc3b4881c..072f39736e2 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -308,7 +308,7 @@ $sql .= " a.id, a.code, a.label, a.note, a.datep as dp, a.datep2 as dp2, a.fulld $sql .= ' a.fk_user_author,a.fk_user_action,'; $sql .= " a.fk_contact, a.note, a.percent as percent,"; $sql .= " a.fk_element, a.elementtype, a.datec, a.tms as datem,"; -$sql .= " c.code as type_code, c.libelle as type_label,"; +$sql .= " c.code as type_code, c.libelle as type_label, c.color as type_color, c.type as type_type, c.picto as type_picto,"; $sql .= " sp.lastname, sp.firstname, sp.email, sp.phone, sp.address, sp.phone as phone_pro, sp.phone_mobile, sp.phone_perso, sp.fk_pays as country_id"; // Add fields from extrafields diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index a399ee3d580..b1ce13eb17f 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -430,6 +430,8 @@ print '
'; // Get event in an array $eventarray = array(); + +// DEFAULT CALENDAR + AUTOEVENT CALENDAR + CONFERENCEBOOTH CALENDAR $sql = 'SELECT'; if ($usergroup > 0) $sql .= " DISTINCT"; $sql .= ' a.id, a.label,'; @@ -439,7 +441,7 @@ $sql .= ' a.percent,'; $sql .= ' a.fk_user_author,a.fk_user_action,'; $sql .= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql .= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,'; -$sql .= ' ca.code, ca.color'; +$sql .= ' ca.code, ca.libelle as type_label, ca.color, ca.type as type_type, ca.picto as type_picto'; $sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; // We must filter on resource table diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 6b54a327705..19b4cca2fc6 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -435,10 +435,11 @@ print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $show print ''; - // Get event in an array $eventarray = array(); + +// DEFAULT CALENDAR + AUTOEVENT CALENDAR + CONFERENCEBOOTH CALENDAR $sql = 'SELECT'; if ($usergroup > 0) $sql .= " DISTINCT"; $sql .= ' a.id, a.label,'; @@ -448,7 +449,7 @@ $sql .= ' a.percent,'; $sql .= ' a.fk_user_author,a.fk_user_action,'; $sql .= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql .= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,'; -$sql .= ' ca.code, ca.color'; +$sql .= ' ca.code, ca.libelle as type_label, ca.color, ca.type as type_type, ca.picto as type_picto'; $sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; // We must filter on resource table diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index bfd5a6f64f7..f12b16211ae 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -355,7 +355,7 @@ class FormActions if (!is_array($selected) && !empty($selected)) $selected = explode(',', $selected); $out .= $form->multiselectarray($htmlname, $arraylist, $selected, 0, 0, 'centpercent', 0, 0); } else { - $out .= $form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth200'.($morecss ? ' '.$morecss : ''), 1); + $out .= $form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth300'.($morecss ? ' '.$morecss : ''), 1); } if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0) From 2904cc803f30cd4dc8178ae6adfa6b79d13c972d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Feb 2021 13:56:13 +0100 Subject: [PATCH 03/11] Fix selection in combo --- htdocs/admin/pdf.php | 3 +- htdocs/comm/action/index.php | 43 +++++++++++++++------- htdocs/core/class/html.formadmin.class.php | 6 +-- htdocs/core/lib/functions.lib.php | 2 +- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 6 files changed, 37 insertions(+), 21 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 008e5277bc3..ec93c95b045 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -326,7 +326,8 @@ print ''; print ''.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").''; //if (! empty($conf->global->MAIN_MULTILANGS)) //{ -print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0), 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1); +$selected = GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0); +print $formadmin->select_language($selected, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1); //} else { // print ''.$langs->trans("MultiLangNotEnabled").''; //} diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 0b3e2f7223a..50d10c9a4c9 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -834,8 +834,8 @@ if ($showbirthday) } // HOLIDAYS CALENDAR -if ($conf->global->AGENDA_SHOW_HOLIDAYS) -{ +//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"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = x.fk_user"; @@ -920,7 +920,7 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS) $i++; } } -} +//} // EXTERNAL CALENDAR // Complete $eventarray with external import Ical @@ -1514,6 +1514,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa global $theme_datacolor; global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused; + if ($conf->use_javascript_ajax) { // Enable the "Show more button..." + $conf->global->MAIN_JS_SWITCH_AGENDA = 1; + } + $dateint = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day); print "\n"; @@ -1645,7 +1649,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa // Define color $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); } - $cssclass = $cssclass.' '.$cssclass.'_day_'.$ymd; + $cssclass = $cssclass.' eventday_'.$ymd; // Defined style to disable drag and drop feature if ($event->type_code == 'AC_OTH_AUTO') @@ -1676,10 +1680,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($action == 'show_day') { $h = 'height: 100%; '; $nowrapontd = 0; } if ($action == 'show_week') { $h = 'height: 100%; '; $nowrapontd = 0; } - // Show rect of event + // Show event box print "\n"; print ''."\n"; - print '
= $maxprint) { + $morecss = 'showifmore'; + } + if ($event->type == 'holiday' && !GETPOST('check_birthday')) { + $morecss = 'hidden'; + } + print '
global->MAIN_JS_SWITCH_AGENDA) && $i > $maxprint && $maxprint) { - print '
'.img_picto("all", "1downarrow_selected.png").' +'.$langs->trans("More").'...
'; + print '
'.img_picto("All", "angle-double-down", 'class="warning"').' +'.($i - $maxprint).'
'; //print ' +'.(count($eventarray[$daykey])-$maxprint); print '