fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10588] property: periodization


From: Sigurd Nes
Subject: [Fmsystem-commits] [10588] property: periodization
Date: Wed, 12 Dec 2012 08:28:37 +0000

Revision: 10588
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10588
Author:   sigurdne
Date:     2012-12-12 08:28:36 +0000 (Wed, 12 Dec 2012)
Log Message:
-----------
property: periodization

Modified Paths:
--------------
    trunk/property/inc/class.boinvoice.inc.php

Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php  2012-12-11 14:51:04 UTC (rev 
10587)
+++ trunk/property/inc/class.boinvoice.inc.php  2012-12-12 08:28:36 UTC (rev 
10588)
@@ -250,11 +250,13 @@
                {
                        $time = time();
 
-                       if ( date('j',$time) < 7 ) //Day of the month without 
leading zeros
+                       $_lag = date('n') == 1 ? 12 : 7;
+
+                       if ( date('j',$time) < $_lag ) //Day of the month 
without leading zeros
                        {
-                               $time = $time - (7 * 24 * 3600);
+                               $time = $time - ($_lag * 24 * 3600);
                        }
-                       
+
                        $month = date('n', $time);
                        $year = date('Y',$time);
                        $check_year = true;
@@ -275,10 +277,24 @@
                                        $check_year = false;
                                }
                        }
+
+                       if(count($period_list) == 1) //last month in year
+                       {
+                               $year++;
+                               $period = sprintf("%s%02d",$year,1);
+                               $period_list[] = array
+                               (
+                                       'id'    => $period,
+                                       'name'  => $period
+                               );
+                       
+                       }
+
                        foreach ($period_list as &$_period)
                        {
                                $_period['selected'] = $_period['id'] == 
$selected ? 1 : 0;
                        }
+
                        return $period_list;
                }
 




reply via email to

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