View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Supportez nous sur Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - [SOLVED] isOpenDay function in projeqtor.php - ProjeQtOr

Prochaines sessions de formation

Les prochaines formations et démonstrations sont ouvertes, inscrivez-vous rapidement !

 

Démonstration de ProjeQtOr

(gratuit, sur inscription)

Mardi 23 avril (10h30-12h)

Jeudi 16 mai (16h-17h30)

Jeudi 13 juin (10h30-12h)

 
 

Planifiez avec ProjeQtOr

3 et 4 avril (9h - 12h30)

 
 

Administrez avec ProjeQtOr

10 et 11 avril (9h - 12h30)

 

 

 
 

[SOLVED] isOpenDay function in projeqtor.php

More
06 Juil 2016 17:11 #1 by keloniton
Hello Dear Mr. Babynus
Good day. How are you?
I want to change the off day from Saturday to Friday. I appreciate to know your idea about my following code which doesn't work correctly. This code declares all of the week days as off days. I just want to declare Friday as off day.
in tool/projeqtor.php:

function isOpenDay($dateValue, $idCalendarDefinition = '1') {
global $bankHolidays, $bankWorkdays;
$paramDefaultLocale = Parameter::getGlobalParameter ( 'paramDefaultLocale' );
$iDate = strtotime ( $dateValue );
$year = date ( 'Y', $iDate );
if (! $idCalendarDefinition)
$idCalendarDefinition = 1;
if (array_key_exists ( $year . '#' . $idCalendarDefinition, $bankWorkdays )) {
$aBankWorkdays = $bankWorkdays [$year . '#' . $idCalendarDefinition];
} else {
$cal = new Calendar ();
$crit = array (
'year' => $year,
'isOffDay' => '0',
'idCalendarDefinition' => $idCalendarDefinition
);
$aBankWorkdays = array ();
$lstCal = $cal->getSqlElementsFromCriteria ( $crit );
foreach ( $lstCal as $obj ) {
$aBankWorkdays [] = $obj->day;
}
$bankWorkdays [$year . '#' . $idCalendarDefinition] = $aBankWorkdays;
}
if (array_key_exists ( $year . '#' . $idCalendarDefinition, $bankHolidays )) {
$aBankHolidays = $bankHolidays [$year . '#' . $idCalendarDefinition];
} else {
$cal = new Calendar ();
$crit = array (
'year' => $year,
'isOffDay' => '1',
'idCalendarDefinition' => $idCalendarDefinition
);
$aBankHolidays = array ();
$lstCal = $cal->getSqlElementsFromCriteria ( $crit );
foreach ( $lstCal as $obj ) {
$aBankHolidays [] = $obj->day;
}
$bankHolidays [$year . '#' . $idCalendarDefinition] = $aBankHolidays;
}
// I HAVE ADDED THIS PART
if (date ( 'w', $iDate ) != 5) { // If it is not Friday
if (in_array ( date ( 'Ymd', $iDate ), $aBankWorkdays )) { //if it is a working day
return true; //tell me this is openday
} else { //if it is not a working day
return false;
}
} else { //if it is Friday
return false;
}
}

Please Connexion or Create an account to join the conversation.

More
06 Juil 2016 20:14 #2 by babynus
Better use the calendar feature : storing lines in calandar table for off days and opened saturdays or sundays, will automatically fill sbankHolidays (for extra off days) and $bankWorkDays (for worked week-ends)

Babynus
Administrator of ProjeQtOr web site

Please Connexion or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.029 seconds

Paramétrages de cookies

×

Cookies fonctionnels

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Veuillez vous connecter pour voir vos activités!

Autres cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.