Skip to content

Commit

Permalink
Upgrade changes, weight and qill fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jitendra Purohit committed Jul 26, 2017
1 parent e7212d8 commit dc0f890
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CRM/Pledge/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,15 @@ public static function whereClauseSingle(&$values, &$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)) {
Expand All @@ -314,7 +318,7 @@ public static function whereClauseSingle(&$values, &$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;

Expand Down
11 changes: 11 additions & 0 deletions CRM/Upgrade/Incremental/sql/4.7.24.mysql.tpl
Original file line number Diff line number Diff line change
@@ -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);
4 changes: 2 additions & 2 deletions xml/templates/civicrm_data.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dc0f890

Please sign in to comment.