diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6eb05106686..d198de99b1a 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1883,7 +1883,7 @@ class ActionComm extends CommonObject $color = 'style="color: #'.$this->type_color.' !important;"'; } if ($this->type_picto) { - $imgpicto = img_picto($titlealt.'rr', $this->type_picto, '', 0, 0, 0, '', ($morecss ? ' '.$morecss : '')); + $imgpicto = img_picto($titlealt, $this->type_picto, '', 0, 0, 0, '', ($morecss ? ' '.$morecss : '')); } else { if ($this->type_code == 'AC_RDV') { $imgpicto = img_picto($titlealt, 'meeting', $color, 0, 0, 0, '', ($morecss ? ' '.$morecss : '')); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 93ae98884a3..02737de7db2 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -33,14 +33,13 @@ // Load Dolibarr environment require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -if (isModEnabled('project')) { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; -} +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; /** * @var Conf $conf @@ -50,14 +49,7 @@ if (isModEnabled('project')) { * @var User $user */ -if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) { - $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW = 3; -} - -if (!getDolGlobalString('AGENDA_EXT_NB')) { - $conf->global->AGENDA_EXT_NB = 5; -} -$MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB'); +$MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB', 5); $DELAYFORCACHE = 300; // 300 seconds $disabledefaultvalues = GETPOSTINT('disabledefaultvalues'); @@ -122,10 +114,10 @@ $year = GETPOSTINT("year") ? GETPOSTINT("year") : date("Y"); $month = GETPOSTINT("month") ? GETPOSTINT("month") : date("m"); $week = GETPOSTINT("week") ? GETPOSTINT("week") : date("W"); $day = GETPOSTINT("day") ? GETPOSTINT("day") : date("d"); -$pid = GETPOSTINT("search_projectid", 3) ? GETPOSTINT("search_projectid", 3) : GETPOSTINT("projectid", 3); +$pid = GETPOSTISSET("search_projectid") ? GETPOSTINT("search_projectid", 3) : GETPOSTINT("projectid", 3); $status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo', 'na' or -1 $type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09'); -$maxprint = GETPOSTISSET("maxprint") ? GETPOSTINT("maxprint") : getDolGlobalInt('AGENDA_MAX_EVENTS_DAY_VIEW'); +$maxprint = GETPOSTISSET("maxprint") ? GETPOSTINT("maxprint") : getDolGlobalInt('AGENDA_MAX_EVENTS_DAY_VIEW', 3); $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $dateselect = dol_mktime(0, 0, 0, GETPOSTINT('dateselectmonth'), GETPOSTINT('dateselectday'), GETPOSTINT('dateselectyear')); @@ -149,7 +141,7 @@ if (is_scalar($actioncode) && $actioncode == '-1') { } if ($status == '' && !GETPOSTISSET('search_status')) { - $status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); + $status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS')); } $defaultview = getDolGlobalString('AGENDA_DEFAULT_VIEW', 'show_month'); // default for app @@ -253,14 +245,14 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } -$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung'; -llxHeader('', $langs->trans("Agenda"), $help_url); - $form = new Form($db); $companystatic = new Societe($db); $contactstatic = new Contact($db); $userstatic = new User($db); +$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung'; +llxHeader('', $langs->trans("Agenda"), $help_url); + $now = dol_now(); $nowarray = dol_getdate($now); $nowyear = $nowarray['year']; @@ -407,9 +399,13 @@ if ($mode == 'show_day') { //print dol_print_date($firstdaytoshow,'dayhour').' '.dol_print_date($lastdaytoshow,'dayhour'); /*$title = $langs->trans("DoneAndToDoActions"); - if ($status == 'done') $title = $langs->trans("DoneActions"); - if ($status == 'todo') $title = $langs->trans("ToDoActions"); - */ +if ($status == 'done') { + $title = $langs->trans("DoneActions"); +} +if ($status == 'todo') { + $title = $langs->trans("ToDoActions"); +} +*/ $param = ''; if ($actioncode || GETPOSTISSET('search_actioncode')) { @@ -428,10 +424,10 @@ if ($status || GETPOSTISSET('status') || GETPOSTISSET('search_status')) { $param .= "&search_status=".urlencode($status); } if ($filter) { - $param .= "&search_filter=".urlencode($filter); + $param .= "&search_filter=".urlencode((string) $filter); } if ($filtert) { - $param .= "&search_filtert=".urlencode($filtert); + $param .= "&search_filtert=".urlencode((string) $filtert); } if ($usergroup > 0) { $param .= "&search_usergroup=".urlencode((string) ($usergroup)); @@ -771,10 +767,14 @@ if ($resourceid > 0) { } // We must filter on assignment table if ($filtert > 0 || $usergroup > 0) { - $sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; -} -if ($usergroup > 0) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar"; + $sql .= " ON ar.fk_actioncomm = a.id AND ar.element_type='user'"; + if ($filtert > 0) { + $sql .= " AND ar.fk_element = ".((int) $filtert); + } + if ($usergroup > 0) { + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element AND ugu.fk_usergroup = ".((int) $usergroup); + } } $sql .= ' WHERE a.fk_action = ca.id'; $sql .= ' AND a.entity IN ('.getEntity('agenda').')'; // bookcal is a "virtual view" of agenda @@ -830,10 +830,6 @@ if ($search_sale && $search_sale != '-1') { if ($socid) { $sql .= " AND a.fk_soc = ".((int) $socid); } -// We must filter on assignment table -if ($filtert > 0 || $usergroup > 0) { - $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; -} //var_dump($day.' '.$month.' '.$year); if ($mode == 'show_day') { $sql .= " AND ("; @@ -866,7 +862,7 @@ if ($status == '0') { // To do (not started) $sql .= " AND a.percent = 0"; } -if ($status == 'na') { +if ($status === 'na') { // Not applicable $sql .= " AND a.percent = -1"; } @@ -902,7 +898,7 @@ if ($search_categ_cus != -1) { } // Sort on date -$sql .= ' ORDER BY datep'; +$sql .= $db->order("datep"); //print $sql; dol_syslog("comm/action/index.php", LOG_DEBUG); @@ -1170,8 +1166,8 @@ if ($user->hasRight("holiday", "read")) { $event->type = 'holiday'; $event->type_picto = 'holiday'; - $event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1); - $event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1; + $event->datep = $db->jdate($obj->date_start) + (empty($obj->halfday) || $obj->halfday == 1 ? 0 : 12 * 60 * 60 - 1); + $event->datef = $db->jdate($obj->date_end) + (empty($obj->halfday) || $obj->halfday == -1 ? 24 : 12) * 60 * 60 - 1; $event->date_start_in_calendar = $event->datep; $event->date_end_in_calendar = $event->datef; @@ -1183,24 +1179,50 @@ if ($user->hasRight("holiday", "read")) { $event->percentage = 0; } - if ($obj->halfday == 1) { - $event->label = $obj->lastname.' ('.$langs->trans("Morning").')'; - } elseif ($obj->halfday == -1) { - $event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')'; - } else { - $event->label = $obj->lastname; - } + $event->label = $langs->trans("Holiday"); $daycursor = $event->date_start_in_calendar; $annee = (int) dol_print_date($daycursor, '%Y', 'tzuserrel'); $mois = (int) dol_print_date($daycursor, '%m', 'tzuserrel'); $jour = (int) dol_print_date($daycursor, '%d', 'tzuserrel'); + $daycursorend = $event->date_end_in_calendar; + $anneeend = (int) dol_print_date($daycursorend, '%Y', 'tzuserrel'); + $moisend = (int) dol_print_date($daycursorend, '%m', 'tzuserrel'); + $jourend = (int) dol_print_date($daycursorend, '%d', 'tzuserrel'); + + // daykey must be date that represent day box in calendar so must be a user time $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); + $daykeygmt = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); + $ifornbofdays = 0; do { - $eventarray[$daykey][] = $event; + $ifornbofdays++; + + $firstdayofholiday = ($ifornbofdays == 1); + $lastdayofholiday = ($daykeygmt == dol_get_first_hour($event->date_end_in_calendar, 'gmt')); + + /* + var_dump(dol_print_date($daykeygmt, 'dayhour', 'gmt')); + var_dump(dol_print_date(dol_get_first_hour($event->date_end_in_calendar, 'gmt'), 'dayhour', 'gmt')); + var_dump($lastdayofholiday); + var_dump($obj->halfday); + */ + + if ((in_array($obj->halfday, array(1, 2)) == 1 && $lastdayofholiday) || (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday)) { + // We create a copy of event because we want tochange the label + $newevent = dol_clone($event, 1); + if (in_array($obj->halfday, array(1, 2)) && $lastdayofholiday) { + $newevent->label .= ' ('.$langs->trans("Morning").')'; + } elseif (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday) { + $newevent->label .= ' ('.$langs->trans("Afternoon").')'; + } + $eventarray[$daykey][] = $newevent; // We need to use ->gtTypePicto, getXXXon object, so clone must be PHP clone. + } else { + $eventarray[$daykey][] = $event; // We can use the event unchanged + } $daykey += 60 * 60 * 24; + $daykeygmt += 60 * 60 * 24; } while ($daykey <= $event->date_end_in_calendar); $i++; @@ -1951,6 +1973,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if (!empty($cacheusers[$event->userownerid]->color)) { $color = $cacheusers[$event->userownerid]->color; } + + /* May be we need this: if (getDolGlobalString('AGENDA_USE_COLOR_PER_EVENT_TYPE')) { + $color = $event->type_color; + }*/ } elseif ($event->type_code == 'ICALEVENT') { // Event come from external ical file $numical++; if (!empty($event->icalname)) { @@ -2092,7 +2118,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa //var_dump($event->userassigned); //var_dump($event->transparency); print '
| ';
print '';
$daterange = '';
- if ($event->type_code == 'BIRTHDAY') {
- // It's birthday calendar
- $picb = '';
- //$pice = '';
- //$typea = ($objp->typea == 'birth') ? $picb : $pice;
- //var_dump($event);
- print $picb.' '.$langs->trans("Birthday").' '; - //print img_picto($langs->trans("Birthday"), 'birthday-cake').' '; - - $tmpid = $event->id; - - if (empty($cachecontacts[$tmpid])) { - $newcontact = new Contact($db); - $newcontact->fetch($tmpid); - $cachecontacts[$tmpid] = $newcontact; - } - print $cachecontacts[$tmpid]->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline-block'); - - //$event->picto = 'birthday-cake'; - //print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact'); - /*$listofcontacttoshow = ''; - $listofcontacttoshow .= ' '.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle'); - print $listofcontacttoshow; - */ - } elseif ($event->type_code == 'HOLIDAY') { - // It's holiday calendar - $tmpholiday->fetch($event->id); - - print $tmpholiday->getNomUrl(1, -1, 0, 'valignmiddle inline-block'); - - $tmpid = $tmpholiday->fk_user; - if (empty($cacheusers[$tmpid])) { - $newuser = new User($db); - $newuser->fetch($tmpid); - $cacheusers[$tmpid] = $newuser; - } - - $listofusertoshow = ''; - $listofusertoshow .= ' '.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle inline-block'); - print $listofusertoshow; - } - $parameters = array(); $reshook = $hookmanager->executeHooks('eventOptions', $parameters, $event, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -2174,41 +2160,49 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } */ - // Date - if (empty($event->fulldayevent)) { - // Show hours (start ... end) - $tmpyearstart = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel'); - $tmpmonthstart = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel'); - $tmpdaystart = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel'); - $tmpyearend = dol_print_date($event->date_end_in_calendar, '%Y', 'tzuserrel'); - $tmpmonthend = dol_print_date($event->date_end_in_calendar, '%m', 'tzuserrel'); - $tmpdayend = dol_print_date($event->date_end_in_calendar, '%d', 'tzuserrel'); + if ($event->type_code == 'BIRTHDAY') { + // It's birthday calendar + $picb = img_picto('', 'birthday-cake', 'class="pictofixedwidth"'); + print $picb.$langs->trans("Birthday").' '; + } - // Hour start - if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour) { - $daterange .= dol_print_date($event->date_start_in_calendar, 'hour', 'tzuserrel'); - if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) { - if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend) { - $daterange .= '-'; + // Date + if ($event->type_code != 'HOLIDAY' && $event->type_code != 'BIRTHDAY') { + if (empty($event->fulldayevent)) { + // Show hours (start ... end) + $tmpyearstart = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel'); + $tmpmonthstart = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel'); + $tmpdaystart = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel'); + $tmpyearend = dol_print_date($event->date_end_in_calendar, '%Y', 'tzuserrel'); + $tmpmonthend = dol_print_date($event->date_end_in_calendar, '%m', 'tzuserrel'); + $tmpdayend = dol_print_date($event->date_end_in_calendar, '%d', 'tzuserrel'); + + // Hour start + if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour) { + $daterange .= dol_print_date($event->date_start_in_calendar, 'hour', 'tzuserrel'); + if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) { + if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend) { + $daterange .= '-'; + } + //else + //print '...'; } - //else - //print '...'; } - } - if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) { - if ($tmpyearstart != $tmpyearend || $tmpmonthstart != $tmpmonthend || $tmpdaystart != $tmpdayend) { - $daterange .= '...'; + if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) { + if ($tmpyearstart != $tmpyearend || $tmpmonthstart != $tmpmonthend || $tmpdaystart != $tmpdayend) { + $daterange .= '...'; + } } - } - // Hour end - if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) { - if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) { - $daterange .= dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel'); + // Hour end + if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) { + if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) { + $daterange .= dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel'); + } + } + } else { + if ($showinfo) { + print $langs->trans("EventOnFullDay")." \n"; } - } - } else { - if ($showinfo) { - print $langs->trans("EventOnFullDay")." \n"; } } @@ -2216,7 +2210,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $titletoshow = $daterange; $titletoshow .= ($titletoshow ? ' ' : '').dol_escape_htmltag($event->label); - if ($event->type_code != 'ICALEVENT') { + if ($event->type_code != 'ICALEVENT' && $event->type_code != 'BIRTHDAY') { $savlabel = $event->label; $event->label = $titletoshow; // Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user. @@ -2242,8 +2236,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'valignmiddle inline-block'); } - print $titletoshow; - print $listofusertoshow.' '; + if ($event->type_code != 'BIRTHDAY') { + print $titletoshow; + print $listofusertoshow.' '; + } if ($event->type_code == 'ICALEVENT') { print ' ('.dol_trunc($event->icalname, $maxnbofchar).')'; @@ -2263,7 +2259,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $thirdparty = $cachethirdparties[$thirdparty_id]; } if (!empty($thirdparty->id)) { - $linerelatedto .= $thirdparty->getNomUrl(1, '', 0, 0, -1, 0, '', 'valignmiddle inline-block'); + $linerelatedto .= $thirdparty->getNomUrl(1, '', 0, 0, -1, 0, '', 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large } } if (!empty($contact_id) && $contact_id > 0) { @@ -2278,7 +2274,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $linerelatedto .= ' '; } if (!empty($contact->id)) { - $linerelatedto .= $contact->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline-block'); + $linerelatedto .= $contact->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large } } if (!empty($event->fk_element) && $event->fk_element > 0 && !empty($event->elementtype) && getDolGlobalString('AGENDA_SHOW_LINKED_OBJECT')) { @@ -2296,6 +2292,24 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } } + if ($event->type_code == 'HOLIDAY') { + // It's holiday calendar + $tmpholiday->fetch($event->id); + + //print $tmpholiday->getNomUrl(1, -1, 0, 'valignmiddle inline-block'); + + $tmpid = $tmpholiday->fk_user; + if (empty($cacheusers[$tmpid])) { + $newuser = new User($db); + $newuser->fetch($tmpid); + $cacheusers[$tmpid] = $newuser; + } + + $listofusertoshow = ''; + $listofusertoshow .= "\n".' '.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle inline-block')."\n"; + print $listofusertoshow; + } + // Show location if ($showinfo) { if ($event->location) { @@ -2305,9 +2319,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } print ' | ';
+
// Status - Percent
$withstatus = 0;
- if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') {
+ if ($event->type_code != 'HOLIDAY' && $event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') {
$withstatus = 1;
if ($event->percentage >= 0) {
$withstatus = 2;
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index bab2ff5916c..915094db599 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -49,14 +49,12 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
* @var User $user
*/
-if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
- $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW = 3;
-}
-
-$action = GETPOST('action', 'aZ09');
+$MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB', 5);
+$DELAYFORCACHE = 300; // 300 seconds
$disabledefaultvalues = GETPOSTINT('disabledefaultvalues');
+$check_holiday = GETPOSTINT('check_holiday');
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
$filtert = GETPOSTINT("search_filtert", 3) ? GETPOSTINT("search_filtert", 3) : GETPOSTINT("filtert", 3);
$usergroup = GETPOSTINT("search_usergroup", 3) ? GETPOSTINT("search_usergroup", 3) : GETPOSTINT("usergroup", 3);
@@ -64,10 +62,9 @@ $usergroup = GETPOSTINT("search_usergroup", 3) ? GETPOSTINT("search_usergroup",
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
$showbirthday = 0;
-// If not choice done on calendar owner, we filter on user.
-/*if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
-{
- $filtert = $user->id;
+// If no choice done on calendar owner (like on left menu link "Agenda"), we filter on current user by default.
+/*if (empty($filtert) && !getDolGlobalString('AGENDA_ALL_CALENDARS')) {
+ $filtert = (string) $user->id;
}*/
$sortfield = GETPOST('sortfield', 'aZ09comma');
@@ -85,6 +82,7 @@ if (!$sortfield) {
$sortfield = "a.datec";
}
+// Security check
$socid = GETPOSTINT("search_socid") ? GETPOSTINT("search_socid") : GETPOSTINT("socid");
if ($user->socid) {
$socid = $user->socid;
@@ -101,19 +99,21 @@ if (!$user->hasRight('agenda', 'allactions', 'read')) {
$canedit = 0;
}
if (!$user->hasRight('agenda', 'allactions', 'read') || $filter == 'mine') { // If no permission to see all, we show only affected to me
- $filtert = $user->id;
+ $filtert = (string) $user->id;
}
+$action = GETPOST('action', 'aZ09');
+
$mode = 'show_peruser';
$resourceid = GETPOSTINT("search_resourceid") ? GETPOSTINT("search_resourceid") : GETPOSTINT("resourceid");
-$year = GETPOSTINT("year") ? GETPOSTINT("year") : idate("Y");
-$month = GETPOSTINT("month") ? GETPOSTINT("month") : idate("m");
-$week = GETPOSTINT("week") ? GETPOSTINT("week") : idate("W");
-$day = GETPOSTINT("day") ? GETPOSTINT("day") : idate("d");
+$year = GETPOSTINT("year") ? GETPOSTINT("year") : date("Y");
+$month = GETPOSTINT("month") ? GETPOSTINT("month") : date("m");
+$week = GETPOSTINT("week") ? GETPOSTINT("week") : date("W");
+$day = GETPOSTINT("day") ? GETPOSTINT("day") : date("d");
$pid = GETPOSTISSET("search_projectid") ? GETPOSTINT("search_projectid", 3) : GETPOSTINT("projectid", 3);
$status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo', 'na' or -1
-$type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'alpha') : GETPOST("type", 'alpha');
-$maxprint = ((GETPOSTINT("maxprint") != '') ? GETPOSTINT("maxprint") : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
+$type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
+$maxprint = GETPOSTISSET("maxprint") ? GETPOSTINT("maxprint") : getDolGlobalInt('AGENDA_MAX_EVENTS_DAY_VIEW', 3);
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$search_categ_cus = GETPOSTINT("search_categ_cus", 3) ? GETPOSTINT("search_categ_cus", 3) : 0;
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
@@ -133,7 +133,7 @@ if ($dateselect > 0) {
$year = GETPOSTINT('dateselectyear');
}
-$tmp = !getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS') ? '9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS;
+$tmp = getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS', '9-18');
$tmp = str_replace(' ', '', $tmp); // FIX 7533
$tmparray = explode('-', $tmp);
$begin_h = GETPOSTISSET('begin_h') ? GETPOSTINT('begin_h') : ($tmparray[0] != '' ? $tmparray[0] : 9);
@@ -148,7 +148,7 @@ if ($end_h <= $begin_h) {
$end_h = $begin_h + 1;
}
-$tmp = !getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS') ? '1-5' : $conf->global->MAIN_DEFAULT_WORKING_DAYS;
+$tmp = getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS', '1-5');
$tmp = str_replace(' ', '', $tmp); // FIX 7533
$tmparray = explode('-', $tmp);
$begin_d = GETPOSTISSET('begin_d') ? GETPOSTINT('begin_d') : ($tmparray[0] != '' ? $tmparray[0] : 1);
@@ -164,7 +164,7 @@ if ($end_d < $begin_d) {
}
if ($status == '' && !GETPOSTISSET('search_status')) {
- $status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
+ $status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS'));
}
if (empty($mode) && !GETPOSTISSET('mode')) {
@@ -177,12 +177,12 @@ if (GETPOST('viewcal', 'alpha') && $mode != 'show_day' && $mode != 'show_week' &
} // View by month
if (GETPOST('viewweek', 'alpha') || $mode == 'show_week') {
$mode = 'show_week';
- $week = ($week ? $week : idate("W"));
- $day = ($day ? $day : idate("d"));
+ $week = ($week ? $week : date("W"));
+ $day = ($day ? $day : date("d"));
} // View by week
if (GETPOST('viewday', 'alpha') || $mode == 'show_day') {
$mode = 'show_day';
- $day = ($day ? $day : idate("d"));
+ $day = ($day ? $day : date("d"));
} // View by day
$object = new ActionComm($db);
@@ -193,7 +193,7 @@ $langs->loadLangs(array('users', 'agenda', 'other', 'commercial'));
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
$hookmanager->initHooks(array('agenda'));
-$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
+$result = restrictedArea($user, 'agenda', 0, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
if ($user->socid && $socid) {
$result = restrictedArea($user, 'societe', $socid);
}
@@ -248,9 +248,65 @@ $nowmonth = $nowarray['mon'];
$nowday = $nowarray['mday'];
-// Define list of all external calendars (global setup)
$listofextcals = array();
+// Define list of all external calendars (global setup)
+if (!getDolGlobalString('AGENDA_DISABLE_EXT')) {
+ $i = 0;
+ while ($i < $MAXAGENDA) {
+ $i++;
+ $source = 'AGENDA_EXT_SRC'.$i;
+ $name = 'AGENDA_EXT_NAME'.$i;
+ $offsettz = 'AGENDA_EXT_OFFSETTZ'.$i;
+ $color = 'AGENDA_EXT_COLOR'.$i;
+ $default = 'AGENDA_EXT_ACTIVEBYDEFAULT'.$i;
+ $buggedfile = 'AGENDA_EXT_BUGGEDFILE'.$i;
+ if (getDolGlobalString($source) && getDolGlobalString($name)) {
+ // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
+ $listofextcals[] = array(
+ 'type' => 'globalsetup',
+ 'src' => getDolGlobalString($source),
+ 'name' => dol_string_nohtmltag(getDolGlobalString($name)),
+ 'offsettz' => (int) getDolGlobalInt($offsettz, 0),
+ 'color' => dol_string_nohtmltag(getDolGlobalString($color)),
+ // @phan-suppress-next-line PhanPluginSuspiciousParamPosition
+ 'default' => dol_string_nohtmltag(getDolGlobalString($default)),
+ 'buggedfile' => dol_string_nohtmltag(getDolGlobalString('buggedfile', ''))
+ );
+ }
+ }
+}
+
+// Define list of external calendars (user setup)
+if (!getDolUserString('AGENDA_DISABLE_EXT')) {
+ $i = 0;
+ while ($i < $MAXAGENDA) {
+ $i++;
+ $source = 'AGENDA_EXT_SRC_'.$user->id.'_'.$i;
+ $name = 'AGENDA_EXT_NAME_'.$user->id.'_'.$i;
+ $offsettz = 'AGENDA_EXT_OFFSETTZ_'.$user->id.'_'.$i;
+ $color = 'AGENDA_EXT_COLOR_'.$user->id.'_'.$i;
+ $enabled = 'AGENDA_EXT_ENABLED_'.$user->id.'_'.$i;
+ $default = 'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.'_'.$i;
+ $buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i;
+
+ if (getDolUserString($source) && getDolUserString($name)) {
+ // Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
+ $listofextcals[] = array(
+ 'type' => 'usersetup',
+ 'src' => getDolUserString($source),
+ 'name' => dol_string_nohtmltag(getDolUserString($name)),
+ 'offsettz' => (int) (empty($user->conf->$offsettz) ? 0 : $user->conf->$offsettz),
+ 'color' => dol_string_nohtmltag(getDolUserString($color)),
+ // @phan-suppress-next-line PhanPluginSuspiciousParamPosition
+ 'default' => dol_string_nohtmltag(getDolUserString($default)),
+ 'buggedfile' => dol_string_nohtmltag(isset($user->conf->buggedfile) ? $user->conf->buggedfile : '')
+ );
+ }
+ }
+}
+
+
$prev = dol_get_first_day_week($day, $month, $year);
$first_day = $prev['first_day'];
$first_month = $prev['first_month'];
@@ -264,7 +320,7 @@ $next_year = $next['year'];
$next_month = $next['month'];
$next_day = $next['day'];
-$max_day_in_month = idate("t", dol_mktime(0, 0, 0, $month, 1, $year));
+$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year));
$tmpday = $first_day;
//print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day;
@@ -296,7 +352,7 @@ if ($status || GETPOSTISSET('status') || GETPOSTISSET('search_status')) {
$param .= "&search_status=".urlencode($status);
}
if ($filter) {
- $param .= "&search_filter=".urlencode($filter);
+ $param .= "&search_filter=".urlencode((string) $filter);
}
if ($filtert) {
$param .= "&search_filtert=".urlencode((string) $filtert);
@@ -377,66 +433,31 @@ $nav .= " ".dol_print_date(dol_mktime(0, 0, 0, $first_mo
$nav .= " \n";
$nav .= " trans("Next"))."\">\n";
if (empty($conf->dol_optimize_smallscreen)) {
- $nav .= " '.$langs->trans("Today").' ';
+ $nav .= ' '.$langs->trans("Today").' ';
}
$nav .= '';
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
-$nav .= ' ';
+//$nav .= ' ';
+$nav .= '';
// Must be after the nav definition
-$param .= '&year='.urlencode((string) ($year)).'&month='.urlencode((string) ($month)).($day ? '&day='.urlencode((string) ($day)) : '');
+$paramnodate = $param;
+$param .= '&year='.$year.'&month='.$month.($day ? '&day='.$day : '');
//print 'x'.$param;
-$paramnoaction = preg_replace('/action=[a-z_]+/', '', $param);
+$paramnoaction = preg_replace('/mode=[a-z_]+/', '', preg_replace('/action=[a-z_]+/', '', $param));
+$paramnoactionodate = preg_replace('/mode=[a-z_]+/', '', preg_replace('/action=[a-z_]+/', '', $paramnodate));
$head = calendars_prepare_head($paramnoaction);
print '';
+
print "\n";
// Add js code to manage click on a box
@@ -1187,13 +1851,13 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
// We are in a particular day for $username, now we scan all events
foreach ($eventarray as $daykey => $notused) {
- $annee = dol_print_date($daykey, '%Y', 'tzuserrel');
- $mois = dol_print_date($daykey, '%m', 'tzuserrel');
- $jour = dol_print_date($daykey, '%d', 'tzuserrel');
+ $annee = (int) dol_print_date($daykey, '%Y', 'tzuserrel');
+ $mois = (int) dol_print_date($daykey, '%m', 'tzuserrel');
+ $jour = (int) dol_print_date($daykey, '%d', 'tzuserrel');
//var_dump("daykey=$daykey day=$day jour=$jour, month=$month mois=$mois, year=$year annee=$annee");
- if ($day == $jour && (int) $month == (int) $mois && $year == $annee) { // Is it the day we are looking for when calling function ?
+ if ($day == $jour && (int) $month == $mois && $year == $annee) { // Is it the day we are looking for when calling function ?
//var_dump("day=$day jour=$jour month=$month mois=$mois year=$year annee=$annee");
// Scan all event for this date
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index a3db32f86cb..606ca72fecf 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -924,16 +924,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '|||||||
| '; + print ' | ||||
| '; $form = new Form($db); if ($object->birthday) { print $form->selectDate($object->birthday, 'birthday', 0, 0, 0, "perso", 1, 0); } else { print $form->selectDate('', 'birthday', 0, 0, 1, "perso", 1, 0); } - print ' | '; - print ': '; + print ' '; if (!empty($object->birthday_alert)) { print ''; } else { diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index cfe0f519db9..de0d14ebd49 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -246,7 +246,7 @@ $holidaystatic = new Holiday($db); // Update sold $result = $object->updateBalance(); -$title = $langs->trans('CPTitreMenu'); +$title = $langs->trans('Holidays'); $help_url = 'EN:Module_Holiday'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-holiday page-list'); @@ -542,9 +542,6 @@ if ($id > 0) { // For user tab print ''; } else { - $title = $langs->trans("ListeCP"); - - $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); diff --git a/htdocs/langs/fr_FR/holiday.lang b/htdocs/langs/fr_FR/holiday.lang index 859f6d0d00a..7c9c40ea112 100644 --- a/htdocs/langs/fr_FR/holiday.lang +++ b/htdocs/langs/fr_FR/holiday.lang @@ -1,7 +1,7 @@ # Dolibarr language file - Source file is en_US - holiday HRM=GRH Holidays=Congés -Holiday=Demande de congés +Holiday=Congés CPTitreMenu=Demande de congés MenuReportMonth=État mensuel MenuAddCP=Créer demande de congés | |||