Upgrade changes, weight and qill fix
authorJitendra Purohit <jitendra@fuzion.co.nz>
Wed, 26 Jul 2017 09:32:08 +0000 (15:02 +0530)
committerJitendra Purohit <jitendra@fuzion.co.nz>
Wed, 26 Jul 2017 09:32:08 +0000 (15:02 +0530)
CRM/Pledge/BAO/Query.php
CRM/Upgrade/Incremental/sql/4.7.24.mysql.tpl
xml/templates/civicrm_data.tpl

index ee9b5676fc2b52f2a91525fa456c819e1a749a54..9cf75496aa5d1ef250acc96868aa2b4c1a8cd6b5 100644 (file)
@@ -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;
 
index e8cf849664f55a4161e9d587b1a68d7c9be9dc06..f78e8d03dc15fead9eca9e6183b498bda33ab8e0 100644 (file)
@@ -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
index e23f93a86a8df7a9461a27a3a49862109f164ac0..e7e5e143b03c07c601529e5b597f4d02bffb9395 100644 (file)
@@ -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;