[hermes] PATCH: Configure what day the week starts on.

Jason M. Felice jfelice at cronosys.com
Fri Jul 11 12:46:29 PDT 2003


... can even make it start on Thursday if you are so inclined.

-- 
 Jason M. Felice
 Cronosys, LLC <http://www.cronosys.com/>
 216.221.4600 x302
-------------- next part --------------
Index: config/conf.xml
===================================================================
RCS file: /repository/hermes/config/conf.xml,v
retrieving revision 1.8
diff -u -u -r1.8 conf.xml
--- config/conf.xml	14 Dec 2002 16:51:24 -0000	1.8
+++ config/conf.xml	11 Jul 2003 19:37:08 -0000
@@ -6,6 +6,17 @@
   <configheader>Time Tracking Settings</configheader>
   <configboolean name="choose_ifbillable" desc="Should users enter whether time is billable or not billable?">true</configboolean>
   <configinteger name="days_to_keep" desc="How many days should we keep time after it is exported/billed?">60</configinteger>
+  <configenum name="start_of_week" desc="What day does the week start on?">1
+   <values>
+    <value desc="Sunday">0</value>
+    <value desc="Monday">1</value>
+    <value desc="Tuesday">2</value>
+    <value desc="Wednesday">3</value>
+    <value desc="Thursday">4</value>
+    <value desc="Friday">5</value>
+    <value desc="Saturday">6</value>
+   </values>
+  </configenum>
  </configsection>
 
  <configsection name="storage">
Index: lib/Hermes.php
===================================================================
RCS file: /repository/hermes/lib/Hermes.php,v
retrieving revision 1.6
diff -u -u -r1.6 Hermes.php
--- lib/Hermes.php	2003-07-11 15:42:23.000000000 -0400
+++ lib/Hermes.php	2003-07-11 15:40:02.000000000 -0400
@@ -54,13 +54,9 @@
     {
         // Compensate for date('w') returning 0 for Sunday, when weeks
         // should start on Monday.
-        $dow = date('w', $timestamp);
-        if ($dow == 0) {
-            $dow = 6;
-        } else {
-            $dow--;
-        }
-        return $dow;
+        global $conf;
+        $dow = 7 + date('w', $timestamp) - $conf['time']['start_of_week'];
+        return $dow % 7;
     }
 
     function getCurrentTimestamp()


More information about the hermes mailing list