<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
CRM_Contribute_BAO_Contribution::getValues($params, $values, $ids);
CRM_Contribute_BAO_Contribution::resolveDefaults($values);
- if (CRM_Utils_Array::value('contribution_page_id', $values)) {
+ if (!empty($values['contribution_page_id'])) {
$contribPages = CRM_Contribute_PseudoConstant::contributionPage(NULL, TRUE);
$values['contribution_page_title'] = CRM_Utils_Array::value(CRM_Utils_Array::value('contribution_page_id', $values), $contribPages);
}
// get recieved into i.e to_financial_account_id from last trxn
$financialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($values['contribution_id'], 'DESC');
$values['to_financial_account'] = '';
- if (CRM_Utils_Array::value('financialTrxnId', $financialTrxnId)) {
+ if (!empty($financialTrxnId['financialTrxnId'])) {
$values['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $financialTrxnId['financialTrxnId'], 'to_financial_account_id');
if ($values['to_financial_account_id']) {
$values['to_financial_account'] = CRM_Contribute_PseudoConstant::financialAccount($values['to_financial_account_id']);
}
}
- if (CRM_Utils_Array::value('honor_contact_id', $values)) {
- $sql = "SELECT display_name FROM civicrm_contact WHERE id = %1";
- $params = array(1 => array($values['honor_contact_id'], 'Integer'));
- $dao = CRM_Core_DAO::executeQuery($sql, $params);
- if ($dao->fetch()) {
- $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid=$values[honor_contact_id]");
- $values['honor_display'] = "<A href = $url>" . $dao->display_name . "</A>";
- }
- $honor = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id');
- $values['honor_type'] = CRM_Utils_Array::value(CRM_Utils_Array::value('honor_type_id', $values), $honor);
- }
-
- if (CRM_Utils_Array::value('contribution_recur_id', $values)) {
+ if (!empty($values['contribution_recur_id'])) {
$sql = "SELECT installments, frequency_interval, frequency_unit FROM civicrm_contribution_recur WHERE id = %1";
$params = array(1 => array($values['contribution_recur_id'], 'Integer'));
$dao = CRM_Core_DAO::executeQuery($sql, $params);
$values['note'] = array_values($noteValue);
// show billing address location details, if exists
- if (CRM_Utils_Array::value('address_id', $values)) {
+ if (!empty($values['address_id'])) {
$addressParams = array('id' => CRM_Utils_Array::value('address_id', $values));
$addressDetails = CRM_Core_BAO_Address::getValues($addressParams, FALSE, 'id');
$addressDetails = array_values($addressDetails);
$values['billing_address'] = $addressDetails[0]['display'];
}
- //get soft credit record if exists.
- $values['softContributions'] = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($values['contribution_id']);
+ //assign soft credit record if exists.
+ $SCRecords = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($values['contribution_id'], TRUE);
+ if (!empty($SCRecords['soft_credit'])) {
+ $this->assign('softContributions', $SCRecords['soft_credit']);
+ unset($SCRecords['soft_credit']);
+ }
+
+ //assign pcp record if exists
+ foreach ($SCRecords as $name => $value) {
+ $this->assign($name, $value);
+ }
$lineItems = array();
if ($id) {
- $lineItem = CRM_Price_BAO_LineItem::getLineItems($id, 'contribution', 1);
- empty($lineItem) ? null :$lineItems[] = $lineItem;
+ $lineItem = CRM_Price_BAO_LineItem::getLineItems($id, 'contribution', 1, TRUE, TRUE);
+ if (!empty($lineItem)) {
+ $lineItems[] = $lineItem;
+ }
+
}
$this->assign('lineItem', empty($lineItems) ? FALSE : $lineItems);
$values['totalAmount'] = $values['total_amount'];
);
}
}
-