Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0
This commit is contained in:
commit
4bf918065b
@ -95,6 +95,10 @@ if ($year && $month && $day) {
|
|||||||
$daytoparse = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime'
|
$daytoparse = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$daytoparsegmt = dol_now('gmt');
|
||||||
|
if ($yearofday && $monthofday && $dayofday) $daytoparsegmt = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday, 'gmt'); // xxxofday is value of day after submit action 'addtime'
|
||||||
|
elseif ($year && $month && $day) $daytoparsegmt = dol_mktime(0, 0, 0, $month, $day, $year, 'gmt'); // this are value submited after submit of action 'submitdateselect'
|
||||||
|
|
||||||
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
|
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
|
||||||
$usertoprocess = $user;
|
$usertoprocess = $user;
|
||||||
$search_usertoprocessid = $usertoprocess->id;
|
$search_usertoprocessid = $usertoprocess->id;
|
||||||
@ -619,6 +623,11 @@ $numendworkingday = 0;
|
|||||||
$numstartworkingday = 0;
|
$numstartworkingday = 0;
|
||||||
// Get if user is available or not for each day
|
// Get if user is available or not for each day
|
||||||
$isavailable = array();
|
$isavailable = array();
|
||||||
|
|
||||||
|
// Assume from Monday to Friday if conf empty or badly formed
|
||||||
|
$numstartworkingday = 1;
|
||||||
|
$numendworkingday = 5;
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {
|
if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {
|
||||||
$tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
|
$tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
|
||||||
if (count($tmparray) >= 2) {
|
if (count($tmparray) >= 2) {
|
||||||
@ -631,7 +640,7 @@ $statusofholidaytocheck = Holiday::STATUS_APPROVED;
|
|||||||
$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, $statusofholidaytocheck); // $daytoparse is a date with hours = 0
|
$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, $statusofholidaytocheck); // $daytoparse is a date with hours = 0
|
||||||
$isavailable[$daytoparse] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
|
$isavailable[$daytoparse] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
|
||||||
|
|
||||||
$test = num_public_holiday($daytoparse, $daytoparse + 86400, $mysoc->country_code);
|
$test = num_public_holiday($daytoparsegmt, $daytoparsegmt + 86400, $mysoc->country_code);
|
||||||
if ($test) {
|
if ($test) {
|
||||||
$isavailable[$daytoparse] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday');
|
$isavailable[$daytoparse] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,7 +98,7 @@ $next_day = $next['day'];
|
|||||||
|
|
||||||
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
|
// 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, 7, 'd');
|
$firstdaytoshowgmt = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt');
|
||||||
|
|
||||||
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
|
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
|
||||||
$usertoprocess = $user;
|
$usertoprocess = $user;
|
||||||
@ -509,6 +509,11 @@ $numendworkingday = 0;
|
|||||||
$numstartworkingday = 0;
|
$numstartworkingday = 0;
|
||||||
// Get if user is available or not for each day
|
// Get if user is available or not for each day
|
||||||
$isavailable = array();
|
$isavailable = array();
|
||||||
|
|
||||||
|
// Assume from Monday to Friday if conf empty or badly formed
|
||||||
|
$numstartworkingday = 1;
|
||||||
|
$numendworkingday = 5;
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {
|
if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {
|
||||||
$tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
|
$tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
|
||||||
if (count($tmparray) >= 2) {
|
if (count($tmparray) >= 2) {
|
||||||
@ -519,25 +524,18 @@ if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {
|
|||||||
|
|
||||||
for ($idw = 0; $idw < 7; $idw++) {
|
for ($idw = 0; $idw < 7; $idw++) {
|
||||||
$dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
|
$dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
|
||||||
|
$dayinloopfromfirstdaytoshowgmt = dol_time_plus_duree($firstdaytoshowgmt, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
|
||||||
// Useless because $dayinloopwithouthours should be same than $dayinloopfromfirstdaytoshow
|
|
||||||
//$tmparray = dol_getdate($dayinloop);
|
|
||||||
//$dayinloopwithouthours=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
|
|
||||||
//print dol_print_date($dayinloop, 'dayhour').' ';
|
|
||||||
//print dol_print_date($dayinloopwithouthours, 'dayhour').' ';
|
|
||||||
//print dol_print_date($dayinloopfromfirstdaytoshow, 'dayhour').'<br>';
|
|
||||||
|
|
||||||
$statusofholidaytocheck = Holiday::STATUS_APPROVED;
|
$statusofholidaytocheck = Holiday::STATUS_APPROVED;
|
||||||
|
|
||||||
$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $dayinloopfromfirstdaytoshow, $statusofholidaytocheck);
|
$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $dayinloopfromfirstdaytoshow, $statusofholidaytocheck);
|
||||||
$isavailable[$dayinloopfromfirstdaytoshow] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
|
$isavailable[$dayinloopfromfirstdaytoshow] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
|
||||||
|
|
||||||
$test = num_public_holiday($dayinloopfromfirstdaytoshow, $dayinloopfromfirstdaytoshow + 86400, $mysoc->country_code);
|
$test = num_public_holiday($dayinloopfromfirstdaytoshowgmt, $dayinloopfromfirstdaytoshowgmt + 86400, $mysoc->country_code);
|
||||||
if ($test) {
|
if ($test) {
|
||||||
$isavailable[$dayinloopfromfirstdaytoshow] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday');
|
$isavailable[$dayinloopfromfirstdaytoshow] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//var_dump($isavailable);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -669,13 +667,7 @@ if (!empty($arrayfields['timeconsumed']['checked'])) {
|
|||||||
}
|
}
|
||||||
for ($idw = 0; $idw < 7; $idw++) {
|
for ($idw = 0; $idw < 7; $idw++) {
|
||||||
$dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
|
$dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
|
||||||
$dayinloop = dol_time_plus_duree($startday, $idw, 'd');
|
|
||||||
/*print $dayinloopfromfirstdaytoshow;
|
|
||||||
print dol_print_date($dayinloopfromfirstdaytoshow, 'dayhour', 'gmt');
|
|
||||||
print dol_print_date($dayinloopfromfirstdaytoshow, 'dayhour');
|
|
||||||
print dol_print_date($dayinloopfromfirstdaytoshow, '%a', 'gmt');
|
|
||||||
print dol_print_date($dayinloopfromfirstdaytoshow, '%a');
|
|
||||||
print '<br>';*/
|
|
||||||
$cssweekend = '';
|
$cssweekend = '';
|
||||||
if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) { // This is a day is not inside the setup of working days, so we use a week-end css.
|
if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) { // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||||
$cssweekend = 'weekend';
|
$cssweekend = 'weekend';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user