Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-20286, added card type field on contribution search form #9999

Merged
merged 1 commit into from
Mar 17, 2017

Conversation

pradpnayak
Copy link
Contributor

@pradpnayak pradpnayak commented Mar 15, 2017

@pradpnayak
Copy link
Contributor Author

@eileenmcnaughton can you please review this?

@eileenmcnaughton
Copy link
Contributor

@pradpnayak I think this is good. I agree that your restructuring around the batch table is an improvement, and I was still able to do a search based on batch.

I have done a PR with a suggestion about changing the way you add the field to the search form.

Other than that, can you squash the commits into a single commit? Let me know if you are unsure how to

$this->quickCleanup($this->_tablesToTruncate);
$contactID1 = $this->individualCreate(array(), 1);
$contactID2 = $this->individualCreate(array(), 2);
$Contribution1 = civicrm_api3('Contribution', 'create', array(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor point, in the tests it's better to use $this->callAPISuccess - it has better handling when there is a bug

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.

'form_value' => array('financial_trxn_card_type' => array(1, 2)),
'expected_count' => 2,
'expected_contribution' => array($Contribution1['id'], $Contribution3['id']),
'expected_qill' => 'Card Type In Visa, MasterCard',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

including checks on the qill is good

$query->_tables['civicrm_financial_trxn'] = $query->_whereTables['civicrm_financial_trxn'] = 1;
$query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Financial_DAO_FinancialTrxn', 'card_type', $value, $op);
$query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => ts('Card Type'), 2 => $op, 3 => $value));
Copy link
Member

@monishdeb monishdeb Mar 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor change

-  $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => ts('Card Type'), 2 => $op, 3 => $value));
+  $query->_qill[$grouping][] = ts('Card Type %1 %2', array(1 => $op, 2 => $value));

@monishdeb
Copy link
Member

The patch is working as expected, tested on my local
image

PR needs two minor changes, one suggested by @eileenmcnaughton on unit-test and other by me on ts.

----------------------------------------
* CRM-20286: Add card type field on search form
  https://issues.civicrm.org/jira/browse/CRM-20286

CRM-20286, code cleanup and defined $_wheretables and $_tables correctly for batch and is_payment fields

----------------------------------------
* CRM-20286: Add card type field on search form
  https://issues.civicrm.org/jira/browse/CRM-20286

CRM-20286, added where clause for card type

----------------------------------------
* CRM-20286: Add card type field on search form
  https://issues.civicrm.org/jira/browse/CRM-20286

CRM-20286, added unit test

----------------------------------------
* CRM-20286: Add card type field on search form
  https://issues.civicrm.org/jira/browse/CRM-20286

Use metadata based method to add field to form

CRM-20286 Minor changes

----------------------------------------
* CRM-20286: Add card type field on search form
  https://issues.civicrm.org/jira/browse/CRM-20286
@eileenmcnaughton eileenmcnaughton merged commit 1b5b8cf into civicrm:master Mar 17, 2017
@pradpnayak pradpnayak deleted the CRM-20286 branch March 24, 2017 11:01
monishdeb pushed a commit to monishdeb/civicrm-core that referenced this pull request May 2, 2017
CRM-20286, added card type field on contribution search form
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants