From dc0f89098f8f089bfa991d6b7427a1cbc885f350 Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Wed, 26 Jul 2017 15:02:08 +0530 Subject: [PATCH] Upgrade changes, weight and qill fix --- CRM/Pledge/BAO/Query.php | 6 +++++- CRM/Upgrade/Incremental/sql/4.7.24.mysql.tpl | 11 +++++++++++ xml/templates/civicrm_data.tpl | 4 ++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CRM/Pledge/BAO/Query.php b/CRM/Pledge/BAO/Query.php index ee9b5676fc..9cf75496aa 100644 --- a/CRM/Pledge/BAO/Query.php +++ b/CRM/Pledge/BAO/Query.php @@ -298,11 +298,15 @@ class CRM_Pledge_BAO_Query extends CRM_Core_BAO_Query { $tableName = 'civicrm_pledge'; $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; $label = "Pledge Status"; + $qillDAO = 'CRM_Pledge_DAO_Pledge'; + $qillField = 'status_id'; } else { $tableName = 'civicrm_pledge_payment'; $query->_tables['civicrm_pledge_payment'] = $query->_whereTables['civicrm_pledge_payment'] = 1; $label = "Pledge Payment Status"; + $qillDAO = 'CRM_Contribute_DAO_Contribution'; + $qillField = 'contribution_status_id'; } $name = 'status_id'; if (!empty($value) && is_array($value) && !in_array(key($value), CRM_Core_DAO::acceptedSQLOperators(), TRUE)) { @@ -314,7 +318,7 @@ class CRM_Pledge_BAO_Query extends CRM_Core_BAO_Query { $value, 'Integer' ); - list($qillop, $qillVal) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_Contribution', 'contribution_status_id', $value, $op); + list($qillop, $qillVal) = CRM_Contact_BAO_Query::buildQillForFieldValue($qillDAO, $qillField, $value, $op); $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $label, 2 => $qillop, 3 => $qillVal)); return; diff --git a/CRM/Upgrade/Incremental/sql/4.7.24.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.7.24.mysql.tpl index e8cf849664..f78e8d03dc 100644 --- a/CRM/Upgrade/Incremental/sql/4.7.24.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.7.24.mysql.tpl @@ -1 +1,12 @@ {* file to handle db changes in 4.7.24 during upgrade *} +--Add pledge status option group +INSERT INTO `civicrm_option_group` ( `name`, {localize field='title'}`title`{/localize}, `is_active` ) VALUES ('pledge_status', {localize}'{ts escape="sql"}Pledge Status{/ts}'{/localize}, 1); + +SELECT @option_group_id_ps := MAX(id) FROM `civicrm_option_group` where name = 'pledge_status'; + +INSERT INTO `civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `is_default`, `weight`) VALUES +(@option_group_id_ps, {localize}'{ts escape="sql"}Completed{/ts}'{/localize} , 1, 'Completed', NULL, 1), +(@option_group_id_ps, {localize}'{ts escape="sql"}Pending{/ts}'{/localize} , 2, 'Pending', NULL, 2), +(@option_group_id_ps, {localize}'{ts escape="sql"}Cancelled{/ts}'{/localize} , 3, 'Cancelled', NULL, 3), +(@option_group_id_ps, {localize}'{ts escape="sql"}In Progress{/ts}'{/localize}, 4, 'In Progress', NULL, 4), +(@option_group_id_ps, {localize}'{ts escape="sql"}Overdue{/ts}'{/localize} , 5, 'Overdue', NULL, 5); \ No newline at end of file diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index e23f93a86a..e7e5e143b0 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -1033,8 +1033,8 @@ VALUES (@option_group_id_ps, '{ts escape="sql"}Completed{/ts}' , 1, 'Completed' , NULL, 0, NULL, 1, NULL, 0, 1, 1, NULL, NULL, NULL), (@option_group_id_ps, '{ts escape="sql"}Pending{/ts}' , 2, 'Pending' , NULL, 0, NULL, 2, NULL, 0, 1, 1, NULL, NULL, NULL), (@option_group_id_ps, '{ts escape="sql"}Cancelled{/ts}' , 3, 'Cancelled' , NULL, 0, NULL, 3, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_ps, '{ts escape="sql"}In Progress{/ts}', 4, 'In Progress', NULL, 0, NULL, 5, NULL, 0, 1, 1, NULL, NULL, NULL), - (@option_group_id_ps, '{ts escape="sql"}Overdue{/ts}' , 5, 'Overdue' , NULL, 0, NULL, 6, NULL, 0, 1, 1, NULL, NULL, NULL); + (@option_group_id_ps, '{ts escape="sql"}In Progress{/ts}', 4, 'In Progress', NULL, 0, NULL, 4, NULL, 0, 1, 1, NULL, NULL, NULL), + (@option_group_id_ps, '{ts escape="sql"}Overdue{/ts}' , 5, 'Overdue' , NULL, 0, NULL, 5, NULL, 0, 1, 1, NULL, NULL, NULL); -- financial accounts SELECT @opval := value FROM civicrm_option_value WHERE name = 'Revenue' and option_group_id = @option_group_id_fat; -- 2.25.1