Remove merged feature with too many pb:

1=Not yet implemented everywhere.
2=Seems a duplicate info with the picto warning when late (so in past
not done)
3=Is also a duplicate with the existing css event-future, event-past,
event-current
4=It overwrites to choice done by the theme
5=Implementation is wrong, it must use css and not #background

Use CSS instead
This commit is contained in:
Laurent Destailleur 2023-01-13 12:14:20 +01:00
parent a074c89960
commit 8eb89e0ad1
7 changed files with 20 additions and 92 deletions

View File

@ -113,33 +113,6 @@ if ($action == 'set') {
} else { } else {
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); 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 } elseif ($action == 'specimen') { // For orders
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@ -226,8 +199,6 @@ print dol_get_fiche_head($head, 'other', $langs->trans("Agenda"), -1, 'action');
* Miscellaneous * Miscellaneous
*/ */
print load_fiche_titre($langs->trans('Miscellaneous'), '', '');
// Define array def of models // Define array def of models
$def = array(); $def = array();
@ -339,8 +310,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
} }
} }
print '</table><br>'; print '</table><br>';
print load_fiche_titre($langs->trans('MiscellaneousOptions'), '', '');
} }
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">'; print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set">'; print '<input type="hidden" name="action" value="set">';
@ -431,56 +405,6 @@ print $form->buttonsSaveCancel("Save", '');
print '</form>'; print '</form>';
/*
* 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 '<form action="'.$_SERVER["PHP_SELF"].'" name="form_colors">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setcolors">';
print '<table class="noborder allwidth">'."\n";
print '<tr class="liste_titre">'."\n";
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'.$langs->trans("Value").'</td>'."\n";
print '</tr>'."\n";
// AGENDA_EVENT_PAST_COLOR
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans('AGENDA_EVENT_PAST_COLOR').'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'."\n";
print $formother->selectColor($conf->global->AGENDA_EVENT_PAST_COLOR, 'event_past_color');
print '</td></tr>'."\n";
// AGENDA_EVENT_CURRENT_COLOR
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans('AGENDA_EVENT_CURRENT_COLOR').'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'."\n";
print $formother->selectColor($conf->global->AGENDA_EVENT_CURRENT_COLOR, 'event_current_color');
print '</td></tr>'."\n";
// AGENDA_EVENT_FUTURE_COLOR
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans('AGENDA_EVENT_FUTURE_COLOR').'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'."\n";
print $formother->selectColor($conf->global->AGENDA_EVENT_FUTURE_COLOR, 'event_future_color');
print '</td></tr>'."\n";
print '</table>';
print $form->buttonsSaveCancel("Save", '');
print '</form>';
print "<br>";
print dol_get_fiche_end(); print dol_get_fiche_end();
// End of page // End of page

View File

@ -150,7 +150,6 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_valu
print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup');
$head = agenda_prepare_head(); $head = agenda_prepare_head();
print dol_get_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action'); print dol_get_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action');

View File

@ -299,6 +299,7 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) {
$enabled = 'AGENDA_EXT_ENABLED_'.$user->id.'_'.$i; $enabled = 'AGENDA_EXT_ENABLED_'.$user->id.'_'.$i;
$default = 'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.'_'.$i; $default = 'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.'_'.$i;
$buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i; $buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i;
if (getDolUserString($source) && getDolUserString($name)) { if (getDolUserString($source) && getDolUserString($name)) {
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight' // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
$listofextcals[] = array( $listofextcals[] = array(

View File

@ -951,14 +951,15 @@ while ($i < $imaxinloop) {
$event_owner_style .= 'border-left: #' . $cache_user_list[$obj->fk_user_action]->color . ' 5px solid;'; $event_owner_style .= 'border-left: #' . $cache_user_list[$obj->fk_user_action]->color . ' 5px solid;';
} }
// get event style for start date // get event style for start and end date
$event_more_class = ''; $event_more_class = '';
$event_start_date_style = ''; $event_start_date_css = '';
$event_end_date_css = '';
$event_start_date_time = $actionstatic->datep; $event_start_date_time = $actionstatic->datep;
if ($event_start_date_time > $now) { if ($event_start_date_time > $now) {
// future event // future event
$event_more_class = 'event-future'; $event_more_class = 'event-future';
$event_start_date_color = $conf->global->AGENDA_EVENT_FUTURE_COLOR; $event_start_date_css = $event_end_date_css = $event_more_class;
} else { } else {
if ($obj->fulldayevent == 1) { if ($obj->fulldayevent == 1) {
$today_start_date_time = $today_start_time; $today_start_date_time = $today_start_time;
@ -971,20 +972,16 @@ while ($i < $imaxinloop) {
if ($event_end_date_time != null && $event_end_date_time < $today_start_date_time) { if ($event_end_date_time != null && $event_end_date_time < $today_start_date_time) {
// past event // past event
$event_more_class = 'event-past'; $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) { } elseif ($event_end_date_time == null && $event_start_date_time < $today_start_date_time) {
// past event // past event
$event_more_class = 'event-past'; $event_more_class = 'event-past';
$event_start_date_color = $conf->global->AGENDA_EVENT_PAST_COLOR;
} else { } else {
// current event // current event
$event_more_class = 'event-current'; $event_more_class = 'event-current';
$event_start_date_color = $conf->global->AGENDA_EVENT_CURRENT_COLOR;
} }
$event_start_date_css = $event_end_date_css = $event_more_class;
} }
if ($event_start_date_color != '') { $event_start_date_css = $event_end_date_css = $event_more_class;
$event_start_date_style .= 'background: #' . $event_start_date_color . ';';
}
print '<tr class="oddeven' . ($event_more_class != '' ? ' '.$event_more_class : '') . '">'; print '<tr class="oddeven' . ($event_more_class != '' ? ' '.$event_more_class : '') . '">';
// Action column // Action column
@ -1065,13 +1062,14 @@ while ($i < $imaxinloop) {
// Start date // Start date
if (!empty($arrayfields['a.datep']['checked'])) { if (!empty($arrayfields['a.datep']['checked'])) {
print '<td class="center nowraponall"' . ($event_start_date_style != '' ? ' style="'.$event_start_date_style.'"' : '') . '>'; print '<td class="center nowraponall'.($event_start_date_css ? ' '.$event_start_date_css : '').'"><span>';
if (empty($obj->fulldayevent)) { if (empty($obj->fulldayevent)) {
print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuserrel'); print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuserrel');
} else { } else {
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
print dol_print_date($db->jdate($obj->dp), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuserrel')); print dol_print_date($db->jdate($obj->dp), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuserrel'));
} }
print '</span>';
$late = 0; $late = 0;
if ($actionstatic->hasDelay() && $actionstatic->percentage >= 0 && $actionstatic->percentage < 100 ) { if ($actionstatic->hasDelay() && $actionstatic->percentage >= 0 && $actionstatic->percentage < 100 ) {
$late = 1; $late = 1;
@ -1084,13 +1082,14 @@ while ($i < $imaxinloop) {
// End date // End date
if (!empty($arrayfields['a.datep2']['checked'])) { if (!empty($arrayfields['a.datep2']['checked'])) {
print '<td class="center nowraponall">'; print '<td class="center nowraponall'.($event_end_date_css ? ' '.$event_end_date_css : '').'"><span>';
if (empty($obj->fulldayevent)) { if (empty($obj->fulldayevent)) {
print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuserrel'); print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuserrel');
} else { } else {
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
print dol_print_date($db->jdate($obj->dp2), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuserrel')); print dol_print_date($db->jdate($obj->dp2), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuserrel'));
} }
print '</span>';
print '</td>'; print '</td>';
} }

View File

@ -116,7 +116,7 @@ function getDolUserString($key, $default = '', $tmpuser = null)
} }
// return $conf->global->$key ?? $default; // return $conf->global->$key ?? $default;
return (string) (empty($tmpuser->conf->$key) ? $default : $$tmpuser->conf->$key); return (string) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key);
} }
/** /**

View File

@ -1272,6 +1272,7 @@ TriggerActiveAsModuleActive=Triggers in this file are active as module <b>%s</b>
GeneratedPasswordDesc=Choose the method to be used for auto-generated passwords. GeneratedPasswordDesc=Choose the method to be used for auto-generated passwords.
DictionaryDesc=Insert all reference data. You can add your values to the default. DictionaryDesc=Insert all reference data. You can add your values to the default.
ConstDesc=This page allows you to edit (override) parameters not available in other pages. These are mostly reserved parameters for developers/advanced troubleshooting only. ConstDesc=This page allows you to edit (override) parameters not available in other pages. These are mostly reserved parameters for developers/advanced troubleshooting only.
MiscellaneousOptions=Miscellaneous options
MiscellaneousDesc=All other security related parameters are defined here. MiscellaneousDesc=All other security related parameters are defined here.
LimitsSetup=Limits/Precision setup LimitsSetup=Limits/Precision setup
LimitsDesc=You can define limits, precisions and optimizations used by Dolibarr here LimitsDesc=You can define limits, precisions and optimizations used by Dolibarr here

View File

@ -5428,6 +5428,10 @@ td.cal_other_month {
opacity: 0.8; opacity: 0.8;
} }
td.event-past span {
opacity: 0.5;
}
/* ============================================================================== */ /* ============================================================================== */