From e2c3163ddb0c4c5e28d4f30ad25dcabc74297cc3 Mon Sep 17 00:00:00 2001 From: monishdeb Date: Wed, 3 Jul 2013 17:56:38 +0530 Subject: [PATCH] CRM-12520 fixes ---------------------------------------- * 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 | 2 ++ CRM/Utils/Date.php | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/CRM/Core/Form/Date.php b/CRM/Core/Form/Date.php index f81ce4a576..775f2435e5 100644 --- a/CRM/Core/Form/Date.php +++ b/CRM/Core/Form/Date.php @@ -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'), diff --git a/CRM/Utils/Date.php b/CRM/Utils/Date.php index 2111970642..d53d391584 100644 --- a/CRM/Utils/Date.php +++ b/CRM/Utils/Date.php @@ -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; -- 2.25.1