CRM-12520 fixes
authormonishdeb <monish.deb@webaccess.co.in>
Wed, 3 Jul 2013 12:26:38 +0000 (17:56 +0530)
committermonishdeb <monish.deb@webaccess.co.in>
Thu, 4 Jul 2013 15:09:19 +0000 (20:39 +0530)
----------------------------------------
* CRM-12520: Add 24 and 36 month searching to relative date filter drop downs
  http://issues.civicrm.org/jira/browse/CRM-12520

CRM/Core/Form/Date.php
CRM/Utils/Date.php

index f81ce4a57653f00d1e820812347ef0cc41cf7410..775f2435e5495ba4943863536de7e05b849a7f2c 100644 (file)
@@ -171,6 +171,8 @@ Class CRM_Core_Form_Date {
         'current.quarter' => ts('Current Quarter to-date'),
         'current.month' => ts('Current Month to-date'),
         'current.week' => ts('Current Week to-date'),
+        'ending_3.year' => ts('Last 3 Years'),
+        'ending_2.year' => ts('Last 2 Years'),
         'ending.year' => ts('Last 12 Months'),
         'ending.quarter' => ts('Last 3 Months'),
         'ending.month' => ts('Last Month'),
index 2111970642ed2e51268bcd6aa36f9a00b7755d7e..d53d3915841d2a24391e5c1caeece1ec7453ff29 100644 (file)
@@ -984,6 +984,26 @@ class CRM_Utils_Date {
             $to['M'] = $now['mon'];
             $to['Y'] = $now['year'];
             break;
+
+          case 'ending_2':
+            $to['d'] = $now['mday'];
+            $to['M'] = $now['mon'];
+            $to['Y'] = $now['year'];
+            $to['H'] = 23;
+            $to['i'] = $to['s'] = 59;
+            $from    = self::intervalAdd('year', -2, $to);
+            $from    = self::intervalAdd('second', 1, $from);
+            break;
+
+          case 'ending_3':
+            $to['d'] = $now['mday'];
+            $to['M'] = $now['mon'];
+            $to['Y'] = $now['year'];
+            $to['H'] = 23;
+            $to['i'] = $to['s'] = 59;
+            $from    = self::intervalAdd('year', -3, $to);
+            $from    = self::intervalAdd('second', 1, $from);
+            break;
         }
         break;