Skip to content

Commit

Permalink
Merge pull request #125 from ATM-Consulting/FIX_2.7_DA025157_and_DA02…
Browse files Browse the repository at this point in the history
…5414

FIX 2.7 da025157 and da025414
  • Loading branch information
atm-etienne authored Aug 23, 2024
2 parents f8f9259 + 17be60b commit 4c2a112
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ All notable changes to this project will be documented in this file.


## Release 2.7
- FIX : *23/08/2024* - 2.7.3
- Affichage de l'évènement sur le bon fuseau horaire
- Affichage de la complétion des événements
- Affichage des couleurs des évènements en fonction de la couleur utilisateur
- Assignation du bon propriétaire lors de la création d'un évenement
- FIX : Suppression du fetch de chaque évenement apres la requête de sélection - *19/08/2024* - 2.7.2
- FIX : Refactor d'une partie de la requête de sélection des événements côté fullcalendar - *05/08/2024* - 2.7.1
- FIX : Compat v20 - *22/07/2024* - 2.7.0
Expand Down
2 changes: 1 addition & 1 deletion core/modules/modfullcalendar.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function __construct($db)
$this->description = "Description of module fullcalendar";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version

$this->version = '2.7.2';
$this->version = '2.7.3';
// Url to the file with your last numberversion of this module
require_once __DIR__ . '/../../class/techatm.class.php';
$this->url_last_version = \fullcalendar\TechATM::getLastModuleVersionUrl($this);
Expand Down
29 changes: 24 additions & 5 deletions script/interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
if(empty($TUser))$TUser[] = $user->id;
if(!is_array($TUser))$TUser=array($TUser);

$a->userownerid = $TUser[0];
$a->userownerid = $user->id;
$a->type_code = GETPOST('type_code', 'none') ? GETPOST('type_code', 'none') : 'AC_OTH';
$a->code = $a->type_code; // Up to Dolibarr 3.4, code is used in ActionComm:add() instead of type_code. It's seems unused, but you never know for sure.
$a->fk_action = dol_getIdFromCode($db, $a->type_code, 'c_actioncomm'); // type_code is not saved in ActionComm::update(), fk_action is up to Dolibarr 6.0
Expand Down Expand Up @@ -559,6 +559,7 @@ function _events($date_start, $date_end, $month=-1, $year=-1) {
$sql.= ' a.datep,';
$sql.= ' a.datep2,';
$sql.= ' a.percent,';
$sql.= ' u.color,';
$sql.= ' a.fk_project,';
$sql.= ' a.fk_user_author,a.fk_user_action,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
Expand Down Expand Up @@ -663,17 +664,28 @@ function _events($date_start, $date_end, $month=-1, $year=-1) {
$event->id = $obj->id;
$event->fetch_userassigned();

$event->color = $obj->color;
$event->percentage = $obj->percent;
$event->type_color = $obj->type_color;
$event->fulldayevent = $obj->fulldayevent;
$event->datep = $obj->datep;
$event->datef = $obj->datep2;
$event->socid = $obj->fk_soc;
$event->userownerid = $obj->fk_user_action;
$event->userownerid = $obj->fk_user_action;
$event->fk_project = $obj->fk_project;
$event->label = $obj->label;
$event->note = $obj->note;


if ($event->fulldayevent) {
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
$event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz
$event->datef = $db->jdate($obj->datep2, $tzforfullday ? 'tzuser' : 'tzserver');
} else {
// Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1)
$event->datep = $db->jdate($obj->datep, 'tzserver');
$event->datef = $db->jdate($obj->datep2, 'tzserver');
}

if(getDolGlobalString('FULLCALENDAR_SPLIT_DAYS')
&& getDolGlobalString('FULLCALENDAR_PREFILL_DATETIMES')
&& getDolGlobalString('FULLCALENDAR_PREFILL_DATETIME_MORNING_START')
Expand Down Expand Up @@ -727,6 +739,13 @@ function _events($date_start, $date_end, $month=-1, $year=-1) {
$TUserassigned = array();
$TColor=array();

if($event->color && getDolGlobalString('FULLCALENDAR_USE_ASSIGNED_COLOR')) {
$TColor[] = '#'.$event->color;
}
if($event->type_color && getDolGlobalString('FULLCALENDAR_SHOW_ALL_ASSIGNED_COLOR')) {
$TColor[] = '#'.$event->type_color;
}

if(getDolGlobalString('FULLCALENDAR_SHOW_AFFECTED_USER') ) {

$userownerid = (int)$event->userownerid;
Expand Down Expand Up @@ -834,8 +853,8 @@ function _events($date_start, $date_end, $month=-1, $year=-1) {
'id'=>$event->id
,'title'=>$event->label
,'allDay'=>(bool)($event->fulldayevent)
,'start'=>(empty($event->datep) ? '' : dol_print_date($event->datep, '%Y-%m-%d %H:%M:%S'))
,'end'=>(empty($event->datef) ? '' : dol_print_date($event->datef, '%Y-%m-%d %H:%M:%S'))
,'start'=>(empty($event->datep) ? '' : dol_print_date($event->datep, '%Y-%m-%d %H:%M:%S', 'tzuser'))
,'end'=>(empty($event->datef) ? '' : dol_print_date($event->datef, '%Y-%m-%d %H:%M:%S', 'tzuser'))
,'url_title'=>dol_buildpath('/comm/action/card.php?id='.$event->id,1)
,'editable'=>$editable
,'color'=>$color
Expand Down

0 comments on commit 4c2a112

Please sign in to comment.