phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpgwapi/inc class.calendar_holidays.inc.php, 1.4


From: powerstat
Subject: [Phpgroupware-cvs] phpgwapi/inc class.calendar_holidays.inc.php, 1.4
Date: Mon, 9 May 2005 13:41:00 +0200

Update of phpgwapi/inc

Modified Files:
     Branch: MAIN
            class.calendar_holidays.inc.php lines: +6 -5

Log Message:
Bug fix; weekend was subtracted twice sometimes.
Also added some documentation lines.

====================================================
Index: phpgwapi/inc/class.calendar_holidays.inc.php
diff -u phpgwapi/inc/class.calendar_holidays.inc.php:1.3 
phpgwapi/inc/class.calendar_holidays.inc.php:1.4
--- phpgwapi/inc/class.calendar_holidays.inc.php:1.3    Wed May  4 13:19:05 2005
+++ phpgwapi/inc/class.calendar_holidays.inc.php        Mon May  9 11:41:22 2005
@@ -421,11 +421,12 @@
      // echo 'days % 7: ' . ($days % 7) . "\n";
      // echo $firstweekday . ':' . $lastweekday . "\n";

-     $days -= floor($days / 7) * 2;
-     $days -= (($firstweekday <= $lastweekday) ?
-     (($lastweekday <= 5 /* Friday */) ? 0 : (1 + ((($firstweekday < 
$lastweekday) && ($lastweekday == 7)) ? 1 : 0))) :
-     (1 + (($firstweekday <= 6 /* Saturday */) ? 1 : 0)));
-
+     $days -= floor($days / 7) * 2; // Subtract number of weekend days 
(Sat/Sun) in range
+     $days -= (($firstweekday <= $lastweekday) ?
+     (($lastweekday <= 5 /* Friday */) ? 0 : (1 + ((($firstweekday < 
$lastweekday) && ($lastweekday == 7)) ? 1 : 0))) : // Subtract 1 for Saturday 
or two for Sat/Sun when lastweekday falls on the weekend; for firstweekday <= 
lastweekday; week starts with monday as 1
+     (($firstweekday - $lastweekday == 1) ? 0 : (1 + (($firstweekday <= 6 /* 
Saturday */) ? 1 : 0))) // Subtract weekend days; for firstweekday > lastweekday
+     );
+
      // echo 'mo-fr days: ' . $days . "\n";

      $days -= 
$this->get_number_of_holidays($startday,$startmonth,$startyear,$endday,$endmonth,$endyear,$country,$federal_state,$religion);






reply via email to

[Prev in Thread] Current Thread [Next in Thread]