$sendReceipt = CRM_Contribute_Form_AdditionalInfo::emailReceipt($this, $this->_params, TRUE);
}
- //process the note
- if ($contribution->id && isset($params['note'])) {
- CRM_Contribute_Form_AdditionalInfo::processNote($params, $contactID, $contribution->id, NULL);
- }
-
if ($contribution->id) {
array_unshift($this->statusMessage, ts('The contribution record has been processed.'));
if (!empty($this->_params['is_email_receipt']) && $sendReceipt) {
);
}
- //process note
- if ($contribution->id && isset($formValues['note'])) {
- CRM_Contribute_Form_AdditionalInfo::processNote($formValues, $this->_contactID, $contribution->id, $this->_noteID);
- }
-
- //process premium
- if ($contribution->id && isset($formValues['product_name'][0])) {
- CRM_Contribute_Form_AdditionalInfo::processPremium($formValues, $contribution->id,
- $this->_premiumID, $this->_options
- );
- }
array_unshift($this->statusMessage, ts('The contribution record has been saved.'));
$this->invoicingPostProcessHook($submittedValues, $action, $lineItem);
}
+ if ($contribution->id && isset($formValues['product_name'][0])) {
+ CRM_Contribute_Form_AdditionalInfo::processPremium($formValues, $contribution->id,
+ $this->_premiumID, $this->_options
+ );
+ }
+
+ if ($contribution->id && isset($submittedValues['note'])) {
+ CRM_Contribute_Form_AdditionalInfo::processNote($submittedValues, $this->_contactID, $contribution->id, $this->_noteID);
+ }
+
CRM_Core_Session::setStatus(implode(' ', $this->statusMessage), $this->statusMessageTitle, 'success');
CRM_Contribute_BAO_Contribution::updateRelatedPledge(
*/
public function tearDown() {
$this->quickCleanUpFinancialEntities();
+ $this->quickCleanup(array('civicrm_note'));
}
/**
$mut->stop();
}
+ /**
+ * Test the submit function on the contribution page.
+ */
+ public function testSubmitWithNote() {
+ $form = new CRM_Contribute_Form_Contribution();
+ $form->testSubmit(array(
+ 'total_amount' => 50,
+ 'financial_type_id' => 1,
+ 'receive_date' => '04/21/2015',
+ 'receive_date_time' => '11:27PM',
+ 'contact_id' => $this->_individualId,
+ 'payment_instrument_id' => array_search('Check', $this->paymentInstruments),
+ 'contribution_status_id' => 1,
+ 'note' => 'Super cool and interesting stuff',
+ ),
+ CRM_Core_Action::ADD);
+ $this->callAPISuccessGetCount('Contribution', array('contact_id' => $this->_individualId), 1);
+ $note = $this->callAPISuccessGetSingle('note', array('entity_table' => 'civicrm_contribution'));
+ $this->assertEquals($note['note'], 'Super cool and interesting stuff');
+ }
+
+ /**
+ * Test the submit function on the contribution page.
+ */
+ public function testSubmitWithNoteCreditCard() {
+ $form = new CRM_Contribute_Form_Contribution();
+
+ $form->testSubmit(array(
+ 'total_amount' => 50,
+ 'financial_type_id' => 1,
+ 'receive_date' => '04/21/2015',
+ 'receive_date_time' => '11:27PM',
+ 'contact_id' => $this->_individualId,
+ 'payment_instrument_id' => array_search('Check', $this->paymentInstruments),
+ 'contribution_status_id' => 1,
+ 'note' => 'Super cool and interesting stuff',
+ ) + $this->getCreditCardParams (),
+ CRM_Core_Action::ADD);
+ $this->callAPISuccessGetCount('Contribution', array('contact_id' => $this->_individualId), 1);
+ $note = $this->callAPISuccessGetSingle('note', array('entity_table' => 'civicrm_contribution'));
+ $this->assertEquals($note['note'], 'Super cool and interesting stuff');
+ }
+
+ /**
+ * Get parameters for credit card submit calls.
+ *
+ * @return array
+ * Credit card specific parameters.
+ */
+ function getCreditCardParams() {
+ return array(
+ 'payment_processor_id' => $this->paymentProcessor->id,
+ 'credit_card_exp_date' => array('M' => 5, 'Y' => 2012),
+ 'credit_card_number' => '411111111111111',
+ );
+ }
}
+