$params['trxnParams']['payment_instrument_id'] = $params['contribution']->payment_instrument_id;
}
}
- $trxn = CRM_Core_BAO_FinancialTrxn::create($params['trxnParams']);
- $params['entity_id'] = $trxn->id;
if ($context == 'changedStatus') {
if (($params['prevContribution']->contribution_status_id == array_search('Pending', $contributionStatus)
|| $params['prevContribution']->contribution_status_id == array_search('In Progress', $contributionStatus))
&& ($params['contribution']->contribution_status_id == array_search('Completed', $contributionStatus))
) {
- $query = "UPDATE civicrm_financial_item SET status_id = %1 WHERE entity_id = %2 and entity_table = 'civicrm_line_item'";
- $sql = "SELECT id, amount FROM civicrm_financial_item WHERE entity_id = %1 and entity_table = 'civicrm_line_item'";
-
- $entityParams = array(
- 'entity_table' => 'civicrm_financial_item',
- 'financial_trxn_id' => $trxn->id,
- );
if (empty($params['line_item'])) {
//CRM-15296
//@todo - check with Joe regarding this situation - payment processors create pending transactions with no line items
// & this can be removed
return;
}
+ $trxn = CRM_Core_BAO_FinancialTrxn::create($params['trxnParams']);
+ $params['entity_id'] = $trxn->id;
+ $query = "UPDATE civicrm_financial_item SET status_id = %1 WHERE entity_id = %2 and entity_table = 'civicrm_line_item'";
+ $sql = "SELECT id, amount FROM civicrm_financial_item WHERE entity_id = %1 and entity_table = 'civicrm_line_item'";
+
+ $entityParams = array(
+ 'entity_table' => 'civicrm_financial_item',
+ 'financial_trxn_id' => $trxn->id,
+ );
foreach ($params['line_item'] as $fieldId => $fields) {
foreach ($fields as $fieldValueId => $fieldValues) {
$fparams = array(
return;
}
}
+
+ $trxn = CRM_Core_BAO_FinancialTrxn::create($params['trxnParams']);
+ $params['entity_id'] = $trxn->id;
if ($context != 'changePaymentInstrument') {
$itemParams['entity_table'] = 'civicrm_line_item';
$trxnIds['id'] = $params['entity_id'];
if ((empty($input['prevContribution']) && $paymentProcessorId) || (!$input['prevContribution']->is_pay_later && $input['prevContribution']->contribution_status_id == $contributionStatuses['Pending'])) {
$input['payment_processor'] = $paymentProcessorId;
}
- $input['contribution_status_id'] = $contributionStatuses['Completed'];
- $input['total_amount'] = $input['amount'];
- $input['contribution'] = $contribution;
- $input['financial_type_id'] = $contribution->financial_type_id;
if (!empty($contribution->_relatedObjects['participant'])) {
$input['contribution_mode'] = 'participant';
elseif (!empty($contribution->_relatedObjects['membership'])) {
$input['skipLineItem'] = TRUE;
$input['contribution_mode'] = 'membership';
+ $contribution->contribution_status_id = $contributionStatuses['Completed'];
+ $contribution->trxn_id = CRM_Utils_Array::value('trxn_id', $input);
+ $contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date);
}
+ $input['contribution_status_id'] = $contributionStatuses['Completed'];
+ $input['total_amount'] = $input['amount'];
+ $input['contribution'] = $contribution;
+ $input['financial_type_id'] = $contribution->financial_type_id;
//@todo writing a unit test I was unable to create a scenario where this line did not fatal on second
// and subsequent payments. In this case the line items are created at
// CRM_Contribute_BAO_ContributionRecur::addRecurLineItems
*/
public static function addPayments($lineItems, $contributions) {
// get financial trxn which is a payment
- $ftSql = "SELECT ft.id
- FROM civicrm_financial_trxn ft
+ $ftSql = "SELECT ft.id
+ FROM civicrm_financial_trxn ft
INNER JOIN civicrm_entity_financial_trxn eft ON eft.financial_trxn_id = ft.id AND eft.entity_table = 'civicrm_contribution'
WHERE eft.entity_id = %1 AND ft.is_payment = 1";
$sql = "SELECT fi.id, li.price_field_value_id
'Member' => $firstName . ' ' . $lastName,
'Membership Type' => $memTypeTitle1,
'Source' => 'Online Contribution:' . ' ' . $contributionTitle,
+ 'Status' => 'Pending',
);
- if ($payLater) {
- $verifyData['Status'] = 'Pending';
- }
- else {
-
- $verifyData['Status'] = 'New';
- }
$this->webtestVerifyTabularData($verifyData);
// Click View action link on associated contribution record
$verifyData = array(
'From' => $firstName . ' ' . $lastName,
'Total Amount' => '$ 100.00',
+ 'Contribution Status' => 'Pending : Pay Later',
);
- if ($payLater) {
- $verifyData['Contribution Status'] = 'Pending : Pay Later';
- }
- else {
- $verifyData['Contribution Status'] = 'Completed';
- }
$this->webtestVerifyTabularData($verifyData);
//CRM-15735 - verify membership dates gets changed w.r.t receive_date of contribution.
- if ($payLater) {
- $receiveDate = date('F jS, Y', strtotime("-1 month"));
- $endDate = date('F jS, Y', strtotime("+1 year -1 month -1 day"));
- $this->clickAjaxLink("xpath=//button//span[contains(text(),'Edit')]", 'receive_date');
- $this->select('contribution_status_id', 'Completed');
- $this->webtestFillDate('receive_date', '-1 month');
- $this->clickAjaxLink("xpath=//button//span[contains(text(),'Save')]", "xpath=//div[@class='ui-dialog-buttonset']/button[3]/span[2]");
- $updatedData = array(
- 'Status' => 'New',
- 'Member Since' => $receiveDate,
- 'Start date' => $receiveDate,
- 'End date' => $endDate,
- );
- $this->webtestVerifyTabularData($updatedData);
- }
+ $receiveDate = date('F jS, Y', strtotime("-1 month"));
+ $endDate = date('F jS, Y', strtotime("+1 year -1 month -1 day"));
+ $this->clickAjaxLink("xpath=//button//span[contains(text(),'Edit')]", 'receive_date');
+ $this->select('contribution_status_id', 'Completed');
+ $this->webtestFillDate('receive_date', '-1 month');
+ $this->clickAjaxLink("xpath=//button//span[contains(text(),'Save')]", "xpath=//div[@class='ui-dialog-buttonset']/button[3]/span[2]");
+ $updatedData = array(
+ 'Status' => 'New',
+ 'Member Since' => $receiveDate,
+ 'Start date' => $receiveDate,
+ 'End date' => $endDate,
+ );
+ $this->webtestVerifyTabularData($updatedData);
// CRM-8141 signup for membership 2 with same anonymous user info (should create 2 separate membership records because membership orgs are different)
//logout
$this->click("xpath=//div[@class='crm-section contribution_amount-section']/div[2]//span/label[text()='No thank you']");
}
elseif ($amountSection) {
+ $this->clickAt("xpath=//div[@class='content other_amount-content']/input");
+ $this->keyDown("xpath=//div[@class='content other_amount-content']/input", " ");
$this->type("xpath=//div[@class='content other_amount-content']/input", $otherAmount);
+ $this->typeKeys("xpath=//div[@class='content other_amount-content']/input", $otherAmount);
}
if ($payLater) {
$this->waitForAjaxContent();
- $this->click("xpath=//div[@class='payment_processor-section']/div[2]/label[text()='Pay later label {$hash}']");
+ $this->click("xpath=//label[text()='Pay later label {$hash}']");
}
$this->type("email-5", $firstName . "@example.com");
$this->waitForElementPresent("first_name");
}
else {
if (!$payLater && $amountSection) {
+ $this->click("xpath=//label[text()='Test Processor']");
+ $this->waitForAjaxContent();
//Credit Card Info
$this->select("credit_card_type", "value=Visa");
$this->type("credit_card_number", "4111111111111111");
$this->type("sort_name", "$lastName $firstName");
$this->click("xpath=//tr/td[1]/label[contains(text(), 'Contribution is a Test?')]/../../td[2]/label[contains(text(), 'Yes')]/preceding-sibling::input[1]");
$this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
+
+ // assert financial data - CRM-17863
+ $this->waitForElementPresent("xpath=//tr/td[@class='crm-contribution-amount']/a[@title='view payments']");
+ $this->click("xpath=//tr/td[@class='crm-contribution-amount']/a[@title='view payments']");
+ $this->waitForAjaxContent();
+ $verifyFinancialData = array(
+ 1 => '50.00',
+ 2 => 'Donation',
+ 6 => 'Completed',
+ );
+ foreach($verifyFinancialData as $col => $data) {
+ $this->verifyText("xpath=//tr[@class='crm-child-row']/td/div/table/tbody/tr[2]/td[{$col}]", $data);
+ }
$this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[10]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE);
//View Contribution Record and verify data
$this->type("sort_name", "$lastName $firstName");
$this->click("xpath=//tr/td[1]/label[contains(text(), 'Contribution is a Test?')]/../../td[2]/label[contains(text(), 'Yes')]/preceding-sibling::input[1]");
$this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
+
+ // assert financial data - CRM-17863
+ $this->waitForElementPresent("xpath=//tr/td[@class='crm-contribution-amount']/a[@title='view payments']");
+ $this->click("xpath=//tr/td[@class='crm-contribution-amount']/a[@title='view payments']");
+ $this->waitForAjaxContent();
+ $verifyFinancialData = array(
+ 1 => '0.00',
+ 2 => 'Member Dues',
+ 3 => 'Credit Card',
+ 6 => 'Completed',
+ );
+ foreach($verifyFinancialData as $col => $data) {
+ $this->verifyText("xpath=//tr[@class='crm-child-row']/td/div/table/tbody/tr[2]/td[{$col}]", $data);
+ }
$this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[10]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE);
//View Contribution Record and verify data