case 'contribution_status':
$name .= '_id';
case 'financial_type_id':
+ case 'invoice_id':
case 'payment_instrument_id':
case 'contribution_payment_instrument_id':
case 'contribution_page_id':
// Add field for transaction ID search
$form->addElement('text', 'contribution_trxn_id', ts("Transaction ID"));
-
+ $form->addElement('text', 'invoice_id', ts("Invoice ID"));
$form->addElement('text', 'contribution_check_number', ts('Check Number'));
// Add field for pcp display in roll search
<td>
{$form.contribution_or_softcredits.label} <br />
{$form.contribution_or_softcredits.html}
- </td>
- <td>
<div class="float-left" id="contribution_soft_credit_type_wrapper">
{$form.contribution_soft_credit_type_id.label} <br />
{$form.contribution_soft_credit_type_id.html|crmAddClass:twenty}
</div>
</td>
+ <td>
+ {$form.invoice_id.label} <br />
+ {$form.invoice_id.html}
+ </td>
</tr>
<tr>
<td>
$this->assertEquals(1, $contribution['count']);
}
+ /**
+ * CRM-16227 introduces invoice_id as a parameter.
+ */
+ public function testGetContributionByInvoice() {
+ $this->callAPISuccess('Contribution', 'create', array_merge($this->_params, array('invoice_id' => 'curly')));
+ $this->callAPISuccess('Contribution', 'create', array_merge($this->_params), array('invoice_id' => 'churlish'));
+ $this->callAPISuccessGetCount('Contribution', array(), 2);
+ $this->callAPISuccessGetSingle('Contribution', array('invoice_id' => 'curly'));
+ // The following don't work. They are the format we are trying to introduce but although the form uses this format
+ // CRM_Contact_BAO_Query::convertFormValues puts them into the other format & the where only supports that.
+ // ideally the where clause would support this format (as it does on contact_BAO_Query) and those lines would
+ // come out of convertFormValues
+ // $this->callAPISuccessGetSingle('Contribution', array('invoice_id' => array('LIKE' => '%ish%')));
+ // $this->callAPISuccessGetSingle('Contribution', array('invoice_id' => array('NOT IN' => array('curly'))));
+ // $this->callAPISuccessGetCount('Contribution', array('invoice_id' => array('LIKE' => '%ly%')), 2);
+ // $this->callAPISuccessGetCount('Contribution', array('invoice_id' => array('IN' => array('curly', 'churlish'))),
+ // 2);
+ }
+
/**
* Create test with unique field name on source.
*/