diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php
index 5003593905e..8916433707d 100644
--- a/htdocs/admin/agenda_other.php
+++ b/htdocs/admin/agenda_other.php
@@ -54,6 +54,9 @@ $type = 'action';
* Actions
*/
+$error = 0;
+$errors = array();
+
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$reg = array();
@@ -110,6 +113,33 @@ if ($action == 'set') {
} else {
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
}
+} elseif ($action == 'setcolors') {
+ $event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_past_color', 'alphanohtml'));
+ $res = dolibarr_set_const($db, 'AGENDA_EVENT_PAST_COLOR', $event_color, 'chaine', 0, '', $conf->entity);
+ if (!$res > 0) {
+ $error++;
+ $errors[] = $db->lasterror();
+ }
+
+ $event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_current_color', 'alphanohtml'));
+ $res = dolibarr_set_const($db, 'AGENDA_EVENT_CURRENT_COLOR', $event_color, 'chaine', 0, '', $conf->entity);
+ if (!$res > 0) {
+ $error++;
+ $errors[] = $db->lasterror();
+ }
+
+ $event_color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('event_future_color', 'alphanohtml'));
+ $res = dolibarr_set_const($db, 'AGENDA_EVENT_FUTURE_COLOR', $event_color, 'chaine', 0, '', $conf->entity);
+ if (!$res > 0) {
+ $error++;
+ $errors[] = $db->lasterror();
+ }
+
+ if ($error) {
+ setEventMessages('', $errors, 'errors');
+ } else {
+ setEventMessage($langs->trans('SetupSaved'));
+ }
} elseif ($action == 'specimen') { // For orders
$modele = GETPOST('module', 'alpha');
@@ -193,9 +223,10 @@ print dol_get_fiche_head($head, 'other', $langs->trans("Agenda"), -1, 'action');
/*
- * Documents models for supplier orders
+ * Miscellaneous
*/
+print load_fiche_titre($langs->trans('Miscellaneous'), '', '');
// Define array def of models
$def = array();
@@ -395,7 +426,54 @@ print ''."\n";
print '';
-print dol_get_fiche_end();
+print $form->buttonsSaveCancel("Save", '');
+
+print '';
+
+
+/*
+ * User interface (colors)
+ */
+
+print load_fiche_titre($langs->trans('UserInterface'), '', '');
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
+$formother = new FormOther($db);
+
+print '
';
print "
";
+print dol_get_fiche_end();
+
// End of page
llxFooter();
$db->close();
diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index 4be3195561e..dd137690e47 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -887,6 +887,7 @@ print "\n";
$now = dol_now();
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
+$today_start_time = dol_mktime(0, 0, 0, date('m', $now), date('d', $now), date('Y', $now));
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
$caction = new CActionComm($db);
@@ -899,6 +900,7 @@ $i = 0;
//$savnbfield = $totalarray['nbfield'];
//$totalarray['nbfield'] = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num);
+$cache_user_list = array();
while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql);
if (empty($obj)) {
@@ -933,7 +935,58 @@ while ($i < $imaxinloop) {
$actionstatic->fetchResources();
}
- print '';
+ // cache of user list (owners)
+ if ($obj->fk_user_action > 0 && !isset($cache_user_list[$obj->fk_user_action])) {
+ $userstatic = new User($db);
+ $res = $userstatic->fetch($obj->fk_user_action);
+ if ($res > 0) {
+ $cache_user_list[$obj->fk_user_action] = $userstatic;
+ }
+ }
+
+ // get event style for user owner
+ $event_owner_style = '';
+ // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
+ if ($cache_user_list[$obj->fk_user_action]->color != '') {
+ $event_owner_style .= 'border-left: #' . $cache_user_list[$obj->fk_user_action]->color . ' 5px solid;';
+ }
+
+ // get event style for start date
+ $event_more_class = '';
+ $event_start_date_style = '';
+ $event_start_date_time = $actionstatic->datep;
+ if ($event_start_date_time > $now) {
+ // future event
+ $event_more_class = 'event-future';
+ $event_start_date_color = $conf->global->AGENDA_EVENT_FUTURE_COLOR;
+ } else {
+ if ($obj->fulldayevent == 1) {
+ $today_start_date_time = $today_start_time;
+ } else {
+ $today_start_date_time = $now;
+ }
+
+ // check event end date
+ $event_end_date_time = $db->jdate($obj->dp2);
+ if ($event_end_date_time != null && $event_end_date_time < $today_start_date_time) {
+ // past event
+ $event_more_class = 'event-past';
+ $event_start_date_color = $conf->global->AGENDA_EVENT_PAST_COLOR;
+ } elseif ($event_end_date_time == null && $event_start_date_time < $today_start_date_time) {
+ // past event
+ $event_more_class = 'event-past';
+ $event_start_date_color = $conf->global->AGENDA_EVENT_PAST_COLOR;
+ } else {
+ // current event
+ $event_more_class = 'event-current';
+ $event_start_date_color = $conf->global->AGENDA_EVENT_CURRENT_COLOR;
+ }
+ }
+ if ($event_start_date_color != '') {
+ $event_start_date_style .= 'background: #' . $event_start_date_color . ';';
+ }
+
+ print '
';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '| ';
@@ -955,10 +1008,16 @@ while ($i < $imaxinloop) {
// User owner
if (!empty($arrayfields['owner']['checked'])) {
- print ' | '; // With edge and chrome the td overflow is not supported correctly when content is not full text.
- if ($obj->fk_user_action > 0) {
- $userstatic->fetch($obj->fk_user_action);
- print $userstatic->getNomUrl(-1);
+ print ' | '; // With edge and chrome the td overflow is not supported correctly when content is not full text.
+ if ($obj->fk_user_action > 0 && !isset($cache_user_list[$obj->fk_user_action])) {
+ $userstatic = new User($db);
+ $res = $userstatic->fetch($obj->fk_user_action);
+ if ($res > 0) {
+ $cache_user_list[$obj->fk_user_action] = $userstatic;
+ }
+ }
+ if (isset($cache_user_list[$obj->fk_user_action])) {
+ print $cache_user_list[$obj->fk_user_action]->getNomUrl(-1);
} else {
print ' ';
}
@@ -1006,7 +1065,7 @@ while ($i < $imaxinloop) {
// Start date
if (!empty($arrayfields['a.datep']['checked'])) {
- print ' | ';
+ print ' | ';
if (empty($obj->fulldayevent)) {
print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuserrel');
} else {
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 421ba4f6fa2..6cc135e3b2c 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1828,6 +1828,9 @@ AGENDA_USE_EVENT_TYPE=Use events types (managed in menu Setup -> Dictionaries ->
AGENDA_USE_EVENT_TYPE_DEFAULT=Automatically set this default value for type of event in event create form
AGENDA_DEFAULT_FILTER_TYPE=Automatically set this type of event in search filter of agenda view
AGENDA_DEFAULT_FILTER_STATUS=Automatically set this status for events in search filter of agenda view
+AGENDA_EVENT_PAST_COLOR=Past event color
+AGENDA_EVENT_CURRENT_COLOR=Current event color
+AGENDA_EVENT_FUTURE_COLOR=Future event color
AGENDA_DEFAULT_VIEW=Which view do you want to open by default when selecting menu Agenda
AGENDA_REMINDER_BROWSER=Enable event reminder on user's browser (When remind date is reached, a popup is shown by the browser. Each user can disable such notifications from its browser notification setup).
AGENDA_REMINDER_BROWSER_SOUND=Enable sound notification
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 7bc99f56b19..0a4bd7e5623 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -1826,6 +1826,9 @@ AGENDA_USE_EVENT_TYPE=Utiliser les types d'événements (gérés dans le menu Co
AGENDA_USE_EVENT_TYPE_DEFAULT=Configurez automatiquement cette valeur par défaut pour le type d'événement dans le formulaire de création d'événement.
AGENDA_DEFAULT_FILTER_TYPE=Positionner automatiquement ce type d'événement dans le filtre de recherche de la vue agenda
AGENDA_DEFAULT_FILTER_STATUS=Positionner automatiquement ce statut d'événement dans le filtre de recherche de la vue agenda
+AGENDA_EVENT_PAST_COLOR=Couleur de l'événement passé
+AGENDA_EVENT_CURRENT_COLOR=Couleur de l'événement en cours
+AGENDA_EVENT_FUTURE_COLOR=Couleur de l'événement futur
AGENDA_DEFAULT_VIEW=Quel onglet voulez-vous voir ouvrir par défaut quand on choisit le menu Agenda
AGENDA_REMINDER_BROWSER=Activer le rappel d'événement sur le navigateur de l'utilisateur (lorsque la date de l'événement est atteinte, une popup est affichée sur la navigateur. Chaque utilisateur peut désactiver de telles notification depuis la configuration des notifications de son navigateur)
AGENDA_REMINDER_BROWSER_SOUND=Activer les notifications sonores.
|