Fix: 1 second missing into lastdaytoshow.
This commit is contained in:
parent
a760fca08c
commit
eea034e0e5
@ -218,7 +218,7 @@ if (empty($action) || $action=='show_month')
|
|||||||
$tmpday = -date("w",dol_mktime(0,0,0,$month,1,$year))+2;
|
$tmpday = -date("w",dol_mktime(0,0,0,$month,1,$year))+2;
|
||||||
$tmpday+=((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)-1);
|
$tmpday+=((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)-1);
|
||||||
if ($tmpday >= 1) $tmpday -= 7;
|
if ($tmpday >= 1) $tmpday -= 7;
|
||||||
// Define firstdaytoshow and lastdaytoshow
|
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
|
||||||
$firstdaytoshow=dol_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$tmpday,$prev_year);
|
$firstdaytoshow=dol_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$tmpday,$prev_year);
|
||||||
$next_day=7 - ($max_day_in_month+1-$tmpday) % 7;
|
$next_day=7 - ($max_day_in_month+1-$tmpday) % 7;
|
||||||
if ($next_day < 6) $next_day+=7;
|
if ($next_day < 6) $next_day+=7;
|
||||||
@ -242,9 +242,9 @@ if ($action=='show_week')
|
|||||||
$next_month = $next['month'];
|
$next_month = $next['month'];
|
||||||
$next_day = $next['day'];
|
$next_day = $next['day'];
|
||||||
|
|
||||||
// Define firstdaytoshow and lastdaytoshow
|
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
|
||||||
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
|
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
|
||||||
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd');
|
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
|
||||||
|
|
||||||
$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
|
$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ if ($action == 'show_day')
|
|||||||
$next_month = $next['month'];
|
$next_month = $next['month'];
|
||||||
$next_day = $next['day'];
|
$next_day = $next['day'];
|
||||||
|
|
||||||
// Define firstdaytoshow and lastdaytoshow
|
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
|
||||||
$firstdaytoshow=dol_mktime(0,0,0,$prev_month,$prev_day,$prev_year);
|
$firstdaytoshow=dol_mktime(0,0,0,$prev_month,$prev_day,$prev_year);
|
||||||
$lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year);
|
$lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year);
|
||||||
}
|
}
|
||||||
@ -522,14 +522,14 @@ if ($resql)
|
|||||||
|
|
||||||
// Check values
|
// Check values
|
||||||
if ($event->date_end_in_calendar < $firstdaytoshow ||
|
if ($event->date_end_in_calendar < $firstdaytoshow ||
|
||||||
$event->date_start_in_calendar > $lastdaytoshow)
|
$event->date_start_in_calendar >= $lastdaytoshow)
|
||||||
{
|
{
|
||||||
// This record is out of visible range
|
// This record is out of visible range
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
||||||
if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow;
|
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow-1);
|
||||||
|
|
||||||
// Add an entry in actionarray for each day
|
// Add an entry in actionarray for each day
|
||||||
$daycursor=$event->date_start_in_calendar;
|
$daycursor=$event->date_start_in_calendar;
|
||||||
@ -659,7 +659,7 @@ if (count($listofextcals))
|
|||||||
if (isset($icalevent['RRULE']) && is_array($icalevent['RRULE'])) //repeatable event
|
if (isset($icalevent['RRULE']) && is_array($icalevent['RRULE'])) //repeatable event
|
||||||
{
|
{
|
||||||
//if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
//if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
||||||
//if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow;
|
//if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow-1);
|
||||||
if ($icalevent['DTSTART;VALUE=DATE']) //fullday event
|
if ($icalevent['DTSTART;VALUE=DATE']) //fullday event
|
||||||
{
|
{
|
||||||
$datecurstart=dol_stringtotime($icalevent['DTSTART;VALUE=DATE'],1);
|
$datecurstart=dol_stringtotime($icalevent['DTSTART;VALUE=DATE'],1);
|
||||||
@ -698,10 +698,10 @@ if (count($listofextcals))
|
|||||||
$until=empty($icalevent['RRULE']['UNTIL'])?0:dol_stringtotime($icalevent['RRULE']['UNTIL'],1);
|
$until=empty($icalevent['RRULE']['UNTIL'])?0:dol_stringtotime($icalevent['RRULE']['UNTIL'],1);
|
||||||
$maxrepeat=empty($icalevent['RRULE']['COUNT'])?0:$icalevent['RRULE']['COUNT'];
|
$maxrepeat=empty($icalevent['RRULE']['COUNT'])?0:$icalevent['RRULE']['COUNT'];
|
||||||
if ($until && ($until+($datecurend-$datecurstart)) < $firstdaytoshow) continue; // We discard repeatable event that end before start date to show
|
if ($until && ($until+($datecurend-$datecurstart)) < $firstdaytoshow) continue; // We discard repeatable event that end before start date to show
|
||||||
if ($datecurstart > $lastdaytoshow) continue; // We discard repeatable event that start after end date to show
|
if ($datecurstart >= $lastdaytoshow) continue; // We discard repeatable event that start after end date to show
|
||||||
|
|
||||||
$numofevent=0;
|
$numofevent=0;
|
||||||
while (($datecurstart <= $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat)))
|
while (($datecurstart < $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat)))
|
||||||
{
|
{
|
||||||
if ($datecurend >= $firstdaytoshow) // We add event
|
if ($datecurend >= $firstdaytoshow) // We add event
|
||||||
{
|
{
|
||||||
@ -833,7 +833,7 @@ if (count($listofextcals))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add event into $eventarray if date range are ok.
|
// Add event into $eventarray if date range are ok.
|
||||||
if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar > $lastdaytoshow)
|
if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow)
|
||||||
{
|
{
|
||||||
//print 'x'.$datestart.'-'.$dateend;exit;
|
//print 'x'.$datestart.'-'.$dateend;exit;
|
||||||
//print 'x'.$datestart.'-'.$dateend;exit;
|
//print 'x'.$datestart.'-'.$dateend;exit;
|
||||||
@ -843,7 +843,7 @@ if (count($listofextcals))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
||||||
if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow;
|
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
|
||||||
|
|
||||||
// Add an entry in actionarray for each day
|
// Add an entry in actionarray for each day
|
||||||
$daycursor=$event->date_start_in_calendar;
|
$daycursor=$event->date_start_in_calendar;
|
||||||
|
|||||||
@ -179,17 +179,11 @@ $next_year = $next['year'];
|
|||||||
$next_month = $next['month'];
|
$next_month = $next['month'];
|
||||||
$next_day = $next['day'];
|
$next_day = $next['day'];
|
||||||
|
|
||||||
// Define firstdaytoshow and lastdaytoshow
|
|
||||||
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
|
|
||||||
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd');
|
|
||||||
|
|
||||||
$max_day_in_month = date("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;
|
$tmpday = $first_day;
|
||||||
//print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day;
|
//print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day;
|
||||||
//print 'xx'.$next_year.'-'.$next_month.'-'.$next_day;
|
//print 'xx'.$next_year.'-'.$next_month.'-'.$next_day;
|
||||||
//print dol_print_date($firstdaytoshow,'day');
|
|
||||||
//print dol_print_date($lastdaytoshow,'day');
|
|
||||||
|
|
||||||
$title=$langs->trans("DoneAndToDoActions");
|
$title=$langs->trans("DoneAndToDoActions");
|
||||||
if ($status == 'done') $title=$langs->trans("DoneActions");
|
if ($status == 'done') $title=$langs->trans("DoneActions");
|
||||||
@ -225,9 +219,11 @@ $next_year = $next['year'];
|
|||||||
$next_month = $next['month'];
|
$next_month = $next['month'];
|
||||||
$next_day = $next['day'];
|
$next_day = $next['day'];
|
||||||
|
|
||||||
// Define firstdaytoshow and lastdaytoshow
|
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
|
||||||
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
|
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
|
||||||
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 6, 'd');
|
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
|
||||||
|
//print dol_print_date($firstdaytoshow,'dayhour');
|
||||||
|
//print dol_print_date($lastdaytoshow,'dayhour');
|
||||||
|
|
||||||
$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
|
$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
|
||||||
|
|
||||||
@ -440,14 +436,14 @@ if ($resql)
|
|||||||
|
|
||||||
// Check values
|
// Check values
|
||||||
if ($event->date_end_in_calendar < $firstdaytoshow ||
|
if ($event->date_end_in_calendar < $firstdaytoshow ||
|
||||||
$event->date_start_in_calendar > $lastdaytoshow)
|
$event->date_start_in_calendar >= $lastdaytoshow)
|
||||||
{
|
{
|
||||||
// This record is out of visible range
|
// This record is out of visible range
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
||||||
if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow;
|
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
|
||||||
|
|
||||||
// Add an entry in actionarray for each day
|
// Add an entry in actionarray for each day
|
||||||
$daycursor=$event->date_start_in_calendar;
|
$daycursor=$event->date_start_in_calendar;
|
||||||
@ -482,7 +478,6 @@ else
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$maxnbofchar=18;
|
$maxnbofchar=18;
|
||||||
$cachethirdparties=array();
|
$cachethirdparties=array();
|
||||||
$cachecontacts=array();
|
$cachecontacts=array();
|
||||||
@ -647,7 +642,7 @@ foreach ($usernames as $username)
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
|
var_dump($eventarray);exit;
|
||||||
|
|
||||||
// Add js code to manage click on a box
|
// Add js code to manage click on a box
|
||||||
print '<script type="text/javascript" language="javascript">
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user