Skip to content

Commit

Permalink
Ensure that relative dates are handled in the newer way
Browse files Browse the repository at this point in the history
  • Loading branch information
seamuslee001 committed Sep 1, 2019
1 parent 606415c commit 15a4e98
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CRM/Contact/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,14 @@ public static function convertFormValues(&$formValues, $wildcard = 0, $useEquals

self::filterCountryFromValuesIfStateExists($formValues);
// We shouldn't have to whitelist fields to not hack but here we are, for now.
$nonLegacyDateFields = ['participant_register_date_relative', 'receive_date_relative'];
$nonLegacyDateFields = [
'participant_register_date_relative',
'receive_date_relative',
'pledge_end_date_relative',
'pledge_create_date_relative',
'pledge_start_date_relative',
'pledge_payment_scheduled_date_relative',
];
// Handle relative dates first
foreach (array_keys($formValues) as $id) {
if (
Expand Down
8 changes: 8 additions & 0 deletions CRM/Pledge/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@ public static function whereClauseSingle(&$values, &$query) {
);
return;

case 'pledge_payment_scheduled_date_low':
case 'pledge_payment_scheduled_date_high':
// process to / from date
$query->dateQueryBuilder($values,
'civicrm_pledge_payment', 'pledge_payment_scheduled_date', 'scheduled_date', 'Payment Scheduled'
);
return;

case 'pledge_amount':
case 'pledge_amount_low':
case 'pledge_amount_high':
Expand Down
1 change: 1 addition & 0 deletions xml/schema/Pledge/PledgePayment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<uniqueName>pledge_payment_scheduled_amount</uniqueName>
<title>Scheduled Amount</title>
<import>true</import>
<export>true</export>
<type>decimal</type>
<required>true</required>
<comment>Pledged amount for this payment (the actual contribution amount might be different).</comment>
Expand Down

0 comments on commit 15a4e98

Please sign in to comment.