$selector = array(
'' => ts('- any -'),
0 => ts('Choose Date Range'),
- 'previous_2.year' => ts('Previous 2 calendar years'),
- 'previous_2.quarter' => ts('Previous 2 quarters'),
- 'previous_2.month' => ts('Previous 2 calendar months'),
- 'previous_2.week' => ts('Previous 2 weeks'),
- 'previous_2.day' => ts('Previous 2 days'),
- 'previous_before.year' => ts('Year prior to previous calendar year'),
- 'previous_before.quarter' => ts('Quarter prior to previous quarter'),
- 'previous_before.month' => ts('Month prior to previous calendar month'),
- 'previous_before.week' => ts('Week prior to previous week'),
- 'previous_before.day' => ts('Day prior to previous day'),
- 'previous.year' => ts('Previous calendar year'),
- 'previous.fiscal_year' => ts('Previous fiscal year'),
- 'previous.quarter' => ts('Previous quarter'),
- 'previous.month' => ts('Previous calendar month'),
- 'previous.week' => ts('Previous week'),
- 'earlier.year' => ts('To end of previous calendar year'),
- 'earlier.quarter' => ts('To end of previous quarter'),
- 'earlier.month' => ts('To end of previous calendar month'),
- 'earlier.week' => ts('To end of previous week'),
- 'earlier.day' => ts('To end of previous day'),
- 'greater_previous.year' => ts('From end of previous calendar year'),
- 'greater_previous.quarter' => ts('From end of previous quarter'),
- 'greater_previous.month' => ts('From end of previous calendar month'),
- 'greater_previous.week' => ts('From end of previous week'),
- 'greater.year' => ts('From start of current calendar year'),
- 'greater.quarter' => ts('From start of current quarter'),
- 'greater.month' => ts('From start of current calendar month'),
- 'greater.week' => ts('From start of current week'),
- 'greater.day' => ts('From start of current day'),
- 'current.year' => ts('Current calendar year to-date'),
- 'current.quarter' => ts('Current quarter to-date'),
- 'current.month' => ts('Current calendar month to-date'),
- 'current.week' => ts('Current week to-date'),
- 'ending_3.year' => ts('Last 3 years including today'),
- 'ending_2.year' => ts('Last 2 years including today'),
- 'ending.year' => ts('Last 12 months including today'),
- 'ending.quarter' => ts('Last 90 days including today'),
- 'ending_2.month' => ts('Last 60 days including today'),
- 'ending.month' => ts('Last 30 days including today'),
- 'ending.week' => ts('Last 7 days including today'),
- 'previous.day' => ts('Yesterday'),
- 'this.year' => ts('This calendar year'),
- 'this.fiscal_year' => ts('This fiscal year'),
- 'this.quarter' => ts('This quarter'),
- 'this.month' => ts('This calendar month'),
- 'this.week' => ts('This week'),
- 'this.day' => ts('Today'),
- 'starting.day' => ts('Tomorrow'),
- 'starting.week' => ts('Next 7 days including today'),
- 'starting.month' => ts('Next 30 days including today'),
- 'starting_2.month' => ts('Next 60 days including today'),
- 'starting.quarter' => ts('Next 90 days including today'),
- 'starting.year' => ts('Next 12 months including today'),
- 'less.year' => ts('To end of current calendar year'),
- 'less.quarter' => ts('To end of current quarter'),
- 'less.month' => ts('To end of current calendar month'),
- 'less.week' => ts('To end of current week'),
- 'next.week' => ts('Next week'),
- 'next.month' => ts('Next calendar month'),
- 'next.quarter' => ts('Next quarter'),
- 'next.fiscal_year' => ts('Next fiscal year'),
- 'next.year' => ts('Next calendar year'),
);
+ // CRM-16195 Pull relative date filters from an option group
+ $selector = $selector + CRM_Core_OptionGroup::values('relative_date_filters');
if (is_array($operators)) {
$selector = array_merge($selector, $operators);
);
}
+ /**
+ * Relative Date Terms.
+ *
+ * @return array
+ */
+ public static function getRelativeDateTerms() {
+ return array(
+ 'previous' => ts('Previous'),
+ 'previous_2' => ts('Previous 2'),
+ 'previous_before' => ts('Prior to Previous'),
+ 'before_previous' => ts('All Prior to Previous'),
+ 'earlier' => ts('To End of Previous'),
+ 'greater_previous' => ts('From End of Previous'),
+ 'greater' => ts('From Start Of Current'),
+ 'current' => ts('Current'),
+ 'ending_3' => ts('Last 3'),
+ 'ending_2' => ts('Last 2'),
+ 'ending' => ts('Last'),
+ 'this' => ts('This'),
+ 'starting' => ts('Upcoming'),
+ 'less' => ts('To End of'),
+ 'next' => ts('Next'),
+ );
+ }
+
+ /**
+ * Relative Date Units.
+ *
+ * @return array
+ */
+ public static function getRelativeDateUnits() {
+ return array(
+ 'year' => ts('Years'),
+ 'fiscal_year' => ts('Fiscal Years'),
+ 'quarter' => ts('Quarters'),
+ 'month' => ts('Months'),
+ 'week' => ts('Weeks'),
+ 'day' => ts('Days'),
+ );
+ }
+
}
INSERT IGNORE INTO civicrm_state_province (id, country_id, abbreviation, name) VALUES
(NULL, 1163, "PB", "Punjab");
+-- CRM-16195: Move relative date filters from code to database
+INSERT INTO
+ `civicrm_option_group` (`name`, `title`, `is_reserved`, `is_active`, `is_locked`)
+ VALUES
+ ('relative_date_filters' , '{ts escape="sql"}Relative Date Filters{/ts}' , 1, 1, 0);
+
+SELECT @option_group_id_date_filter := max(id) from civicrm_option_group where name = 'relative_date_filters';
+
+INSERT INTO
+ `civicrm_option_value` (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
+ VALUES
+ (@option_group_id_date_filter, '{ts escape="sql"}Previous 2 Years{/ts}', 'previous_2.year', 'previous_2.year', NULL, NULL, NULL,1, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Previous 2 Quarters{/ts}', 'previous_2.quarter', 'previous_2.quarter', NULL, NULL, NULL,2, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Previous 2 Months{/ts}', 'previous_2.month', 'previous_2.month', NULL, NULL, NULL,3, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Previous 2 Weeks{/ts}', 'previous_2.week', 'previous_2.week', NULL, NULL, NULL,4, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Previous 2 Days{/ts}', 'previous_2.day', 'previous_2.day', NULL, NULL, NULL,5, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Prior to Previous Year{/ts}', 'previous_before.year', 'previous_before.year', NULL, NULL, NULL,6, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Prior to Previous Quarter{/ts}', 'previous_before.quarter', 'previous_before.quarter', NULL, NULL, NULL,7, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Prior to Previous Month{/ts}', 'previous_before.month', 'previous_before.month', NULL, NULL, NULL,8, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Prior to Previous Week{/ts}', 'previous_before.week', 'previous_before.week', NULL, NULL, NULL,9, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Prior to Previous Day{/ts}', 'previous_before.day', 'previous_before.day', NULL, NULL, NULL,10, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Previous Year{/ts}', 'previous.year', 'previous.year', NULL, NULL, NULL,11, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Previous Fiscal Year{/ts}', 'previous.fiscal_year', 'previous.fiscal_year', NULL, NULL, NULL,12, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Previous Quarter{/ts}', 'previous.quarter', 'previous.quarter', NULL, NULL, NULL,13, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Previous Month{/ts}', 'previous.month', 'previous.month', NULL, NULL, NULL,14, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Previous Week{/ts}', 'previous.week', 'previous.week', NULL, NULL, NULL,15, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}To End of Previous Year{/ts}', 'earlier.year', 'earlier.year', NULL, NULL, NULL,16, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}To End of Previous Quarter{/ts}', 'earlier.quarter', 'earlier.quarter', NULL, NULL, NULL,17, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}To End of Previous Month{/ts}', 'earlier.month', 'earlier.month', NULL, NULL, NULL,18, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}To End of Previous Week{/ts}', 'earlier.week', 'earlier.week', NULL, NULL, NULL,19, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}To End of Previous Day{/ts}', 'earlier.day', 'earlier.day', NULL, NULL, NULL,20, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}From End of Previous Year{/ts}', 'greater_previous.year', 'greater_previous.year', NULL, NULL, NULL,21, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}From End of Previous Quarter{/ts}', 'greater_previous.quarter', 'greater_previous.quarter', NULL, NULL, NULL,22, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}From End of Previous Month{/ts}', 'greater_previous.month', 'greater_previous.month', NULL, NULL, NULL,23, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}From End of Previous Week{/ts}', 'greater_previous.week', 'greater_previous.week', NULL, NULL, NULL,24, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}From Start of Current Year{/ts}', 'greater.year', 'greater.year', NULL, NULL, NULL,25, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}From Start of Current Quarter{/ts}', 'greater.quarter', 'greater.quarter', NULL, NULL, NULL,26, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}From Start of Current Month{/ts}', 'greater.month', 'greater.month', NULL, NULL, NULL,27, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}From Start of Current Week{/ts}', 'greater.week', 'greater.week', NULL, NULL, NULL,28, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}From Start of Current Day{/ts}', 'greater.day', 'greater.day', NULL, NULL, NULL,29, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Current Year to-date{/ts}', 'current.year', 'current.year', NULL, NULL, NULL,30, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Current Quarter to-date{/ts}', 'current.quarter', 'current.quarter', NULL, NULL, NULL,31, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Current Month to-date{/ts}', 'current.month', 'current.month', NULL, NULL, NULL,32, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Current Week to-date{/ts}', 'current.week', 'current.week', NULL, NULL, NULL,33, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Last 3 Years{/ts}', 'ending_3.year', 'ending_3.year', NULL, NULL, NULL,34, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Last 2 Years{/ts}', 'ending_2.year', 'ending_2.year', NULL, NULL, NULL,35, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Last 12 Months{/ts}', 'ending.year', 'ending.year', NULL, NULL, NULL,36, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Last 3 Months{/ts}', 'ending.quarter', 'ending.quarter', NULL, NULL, NULL,37, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Last Month{/ts}', 'ending.month', 'ending.month', NULL, NULL, NULL,38, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Last 7 days{/ts}', 'ending.week', 'ending.week', NULL, NULL, NULL,39, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Yesterday{/ts}', 'previous.day', 'previous.day', NULL, NULL, NULL,40, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}This Year{/ts}', 'this.year', 'this.year', NULL, NULL, NULL,41, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}This Fiscal Year{/ts}', 'this.fiscal_year', 'this.fiscal_year', NULL, NULL, NULL,42, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}This Quarter{/ts}', 'this.quarter', 'this.quarter', NULL, NULL, NULL,43, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}This Month{/ts}', 'this.month', 'this.month', NULL, NULL, NULL,44, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}This Week{/ts}', 'this.week', 'this.week', NULL, NULL, NULL,45, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Today{/ts}', 'this.day', 'this.day', NULL, NULL, NULL,46, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Tomorrow{/ts}', 'starting.day', 'starting.day', NULL, NULL, NULL,47, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Upcoming 7 days{/ts}', 'starting.week', 'starting.week', NULL, NULL, NULL,48, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Upcoming Month{/ts}', 'starting.month', 'starting.month', NULL, NULL, NULL,49, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Upcoming 12 Months{/ts}', 'starting.year', 'starting.year', NULL, NULL, NULL,50, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}To End of Current Year{/ts}', 'less.year', 'less.year', NULL, NULL, NULL,51, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}To End of Current Quarter{/ts}', 'less.quarter', 'less.quarter', NULL, NULL, NULL,52, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}To End of Current Month{/ts}', 'less.month', 'less.month', NULL, NULL, NULL,53, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}To End of Current Week{/ts}', 'less.week', 'less.week', NULL, NULL, NULL,54, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Next Week{/ts}', 'next.week', 'next.week', NULL, NULL, NULL,55, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Next Month{/ts}', 'next.month', 'next.month', NULL, NULL, NULL,56, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Next Quarter{/ts}', 'next.quarter', 'next.quarter', NULL, NULL, NULL,57, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Next Fiscal Year{/ts}', 'next.fiscal_year', 'next.fiscal_year', NULL, NULL, NULL,58, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_date_filter, '{ts escape="sql"}Next Year{/ts}', 'next.year', 'next.year', NULL, NULL, NULL,59, NULL, 0, 0, 1, NULL, NULL);
('name_badge' , '{ts escape="sql"}Name Badge Format{/ts}' , 1, 1, 0),
('communication_style' , '{ts escape="sql"}Communication Style{/ts}' , 1, 1, 0),
('msg_mode' , '{ts escape="sql"}Message Mode{/ts}' , 1, 1, 0),
- ('contact_date_reminder_options' , '{ts escape="sql"}Contact Date Reminder Options{/ts}' , 1, 1, 1);
+ ('contact_date_reminder_options' , '{ts escape="sql"}Contact Date Reminder Options{/ts}' , 1, 1, 1),
+ ('relative_date_filters' , '{ts escape="sql"}Relative Date Filters{/ts}' , 1, 1, 0);
SELECT @option_group_id_pcm := max(id) from civicrm_option_group where name = 'preferred_communication_method';
SELECT @option_group_id_act := max(id) from civicrm_option_group where name = 'activity_type';
SELECT @option_group_id_communication_style := max(id) from civicrm_option_group where name = 'communication_style';
SELECT @option_group_id_msg_mode := max(id) from civicrm_option_group where name = 'msg_mode';
SELECT @option_group_id_contactDateMode := max(id) from civicrm_option_group where name = 'contact_date_reminder_options';
+SELECT @option_group_id_date_filter := max(id) from civicrm_option_group where name = 'relative_date_filters';
SELECT @contributeCompId := max(id) FROM civicrm_component where name = 'CiviContribute';
SELECT @eventCompId := max(id) FROM civicrm_component where name = 'CiviEvent';
-- Reminder Options for Contact Date Fields
(@option_group_id_contactDateMode, '{ts escape="sql"}Actual date only{/ts}', '1', 'Actual date only', NULL, NULL, 0, 1, NULL, 0, 1, 1, NULL, NULL),
-(@option_group_id_contactDateMode, '{ts escape="sql"}Each anniversary{/ts}', '2', 'Each anniversary', NULL, NULL, 0, 2, NULL, 0, 1, 1, NULL, NULL);
+(@option_group_id_contactDateMode, '{ts escape="sql"}Each anniversary{/ts}', '2', 'Each anniversary', NULL, NULL, 0, 2, NULL, 0, 1, 1, NULL, NULL),
+
+-- Relative Date Filters
+(@option_group_id_date_filter, '{ts escape="sql"}Previous 2 Years{/ts}', 'previous_2.year', 'previous_2.year', NULL, NULL, NULL,1, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Previous 2 Quarters{/ts}', 'previous_2.quarter', 'previous_2.quarter', NULL, NULL, NULL,2, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Previous 2 Months{/ts}', 'previous_2.month', 'previous_2.month', NULL, NULL, NULL,3, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Previous 2 Weeks{/ts}', 'previous_2.week', 'previous_2.week', NULL, NULL, NULL,4, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Previous 2 Days{/ts}', 'previous_2.day', 'previous_2.day', NULL, NULL, NULL,5, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Prior to Previous Year{/ts}', 'previous_before.year', 'previous_before.year', NULL, NULL, NULL,6, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Prior to Previous Quarter{/ts}', 'previous_before.quarter', 'previous_before.quarter', NULL, NULL, NULL,7, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Prior to Previous Month{/ts}', 'previous_before.month', 'previous_before.month', NULL, NULL, NULL,8, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Prior to Previous Week{/ts}', 'previous_before.week', 'previous_before.week', NULL, NULL, NULL,9, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Prior to Previous Day{/ts}', 'previous_before.day', 'previous_before.day', NULL, NULL, NULL,10, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Previous Year{/ts}', 'previous.year', 'previous.year', NULL, NULL, NULL,11, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Previous Fiscal Year{/ts}', 'previous.fiscal_year', 'previous.fiscal_year', NULL, NULL, NULL,12, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Previous Quarter{/ts}', 'previous.quarter', 'previous.quarter', NULL, NULL, NULL,13, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Previous Month{/ts}', 'previous.month', 'previous.month', NULL, NULL, NULL,14, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Previous Week{/ts}', 'previous.week', 'previous.week', NULL, NULL, NULL,15, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}To End of Previous Year{/ts}', 'earlier.year', 'earlier.year', NULL, NULL, NULL,16, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}To End of Previous Quarter{/ts}', 'earlier.quarter', 'earlier.quarter', NULL, NULL, NULL,17, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}To End of Previous Month{/ts}', 'earlier.month', 'earlier.month', NULL, NULL, NULL,18, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}To End of Previous Week{/ts}', 'earlier.week', 'earlier.week', NULL, NULL, NULL,19, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}To End of Previous Day{/ts}', 'earlier.day', 'earlier.day', NULL, NULL, NULL,20, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}From End of Previous Year{/ts}', 'greater_previous.year', 'greater_previous.year', NULL, NULL, NULL,21, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}From End of Previous Quarter{/ts}', 'greater_previous.quarter', 'greater_previous.quarter', NULL, NULL, NULL,22, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}From End of Previous Month{/ts}', 'greater_previous.month', 'greater_previous.month', NULL, NULL, NULL,23, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}From End of Previous Week{/ts}', 'greater_previous.week', 'greater_previous.week', NULL, NULL, NULL,24, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}From Start of Current Year{/ts}', 'greater.year', 'greater.year', NULL, NULL, NULL,25, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}From Start of Current Quarter{/ts}', 'greater.quarter', 'greater.quarter', NULL, NULL, NULL,26, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}From Start of Current Month{/ts}', 'greater.month', 'greater.month', NULL, NULL, NULL,27, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}From Start of Current Week{/ts}', 'greater.week', 'greater.week', NULL, NULL, NULL,28, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}From Start of Current Day{/ts}', 'greater.day', 'greater.day', NULL, NULL, NULL,29, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Current Year to-date{/ts}', 'current.year', 'current.year', NULL, NULL, NULL,30, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Current Quarter to-date{/ts}', 'current.quarter', 'current.quarter', NULL, NULL, NULL,31, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Current Month to-date{/ts}', 'current.month', 'current.month', NULL, NULL, NULL,32, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Current Week to-date{/ts}', 'current.week', 'current.week', NULL, NULL, NULL,33, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Last 3 Years{/ts}', 'ending_3.year', 'ending_3.year', NULL, NULL, NULL,34, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Last 2 Years{/ts}', 'ending_2.year', 'ending_2.year', NULL, NULL, NULL,35, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Last 12 Months{/ts}', 'ending.year', 'ending.year', NULL, NULL, NULL,36, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Last 3 Months{/ts}', 'ending.quarter', 'ending.quarter', NULL, NULL, NULL,37, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Last Month{/ts}', 'ending.month', 'ending.month', NULL, NULL, NULL,38, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Last 7 days{/ts}', 'ending.week', 'ending.week', NULL, NULL, NULL,39, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Yesterday{/ts}', 'previous.day', 'previous.day', NULL, NULL, NULL,40, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}This Year{/ts}', 'this.year', 'this.year', NULL, NULL, NULL,41, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}This Fiscal Year{/ts}', 'this.fiscal_year', 'this.fiscal_year', NULL, NULL, NULL,42, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}This Quarter{/ts}', 'this.quarter', 'this.quarter', NULL, NULL, NULL,43, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}This Month{/ts}', 'this.month', 'this.month', NULL, NULL, NULL,44, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}This Week{/ts}', 'this.week', 'this.week', NULL, NULL, NULL,45, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Today{/ts}', 'this.day', 'this.day', NULL, NULL, NULL,46, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Tomorrow{/ts}', 'starting.day', 'starting.day', NULL, NULL, NULL,47, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Upcoming 7 days{/ts}', 'starting.week', 'starting.week', NULL, NULL, NULL,48, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Upcoming Month{/ts}', 'starting.month', 'starting.month', NULL, NULL, NULL,49, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Upcoming 12 Months{/ts}', 'starting.year', 'starting.year', NULL, NULL, NULL,50, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}To End of Current Year{/ts}', 'less.year', 'less.year', NULL, NULL, NULL,51, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}To End of Current Quarter{/ts}', 'less.quarter', 'less.quarter', NULL, NULL, NULL,52, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}To End of Current Month{/ts}', 'less.month', 'less.month', NULL, NULL, NULL,53, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}To End of Current Week{/ts}', 'less.week', 'less.week', NULL, NULL, NULL,54, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Next Week{/ts}', 'next.week', 'next.week', NULL, NULL, NULL,55, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Next Month{/ts}', 'next.month', 'next.month', NULL, NULL, NULL,56, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Next Quarter{/ts}', 'next.quarter', 'next.quarter', NULL, NULL, NULL,57, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Next Fiscal Year{/ts}', 'next.fiscal_year', 'next.fiscal_year', NULL, NULL, NULL,58, NULL, 0, 0, 1, NULL, NULL),
+(@option_group_id_date_filter, '{ts escape="sql"}Next Year{/ts}', 'next.year', 'next.year', NULL, NULL, NULL,59, NULL, 0, 0, 1, NULL, NULL);
-- financial accounts
SELECT @opval := value FROM civicrm_option_value WHERE name = 'Revenue' and option_group_id = @option_group_id_fat;