本文整理汇总了PHP中CRM_Contribute_BAO_Contribution::getPaymentInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_Contribution::getPaymentInfo方法的具体用法?PHP CRM_Contribute_BAO_Contribution::getPaymentInfo怎么用?PHP CRM_Contribute_BAO_Contribution::getPaymentInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_BAO_Contribution
的用法示例。
在下文中一共展示了CRM_Contribute_BAO_Contribution::getPaymentInfo方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
public function preProcess()
{
$this->_participantId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->_eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_participantId, 'event_id');
$this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($this->_eventId);
$this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_participantId, 'contribution_id', 'participant_id');
if ($this->_contributionId) {
$this->_isPaidEvent = TRUE;
}
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, TRUE);
list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
$this->assign('displayName', $this->_contributorDisplayName);
$this->assign('email', $this->_contributorEmail);
$this->_participantStatus = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $this->_participantId, 'status_id');
//set the payment mode - _mode property is defined in parent class
$this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
$this->assign('contactId', $this->_contactId);
$this->assign('id', $this->_participantId);
$paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_participantId, 'event');
$this->_paidAmount = $paymentInfo['paid'];
$this->assign('paymentInfo', $paymentInfo);
CRM_Core_Resources::singleton()->addSetting(array('feePaid' => $this->_paidAmount));
$title = "Change selections for {$this->_contributorDisplayName}";
if ($title) {
CRM_Utils_System::setTitle(ts('%1', array(1 => $title)));
}
}
示例2: browse
public function browse()
{
$getTrxnInfo = $this->_context == 'transaction' ? TRUE : FALSE;
$paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, $getTrxnInfo, TRUE);
if ($this->_context == 'payment_info') {
$this->assign('paymentInfo', $paymentInfo);
}
}
示例3: browse
function browse()
{
$getTrxnInfo = $this->_context == 'transaction' ? TRUE : FALSE;
$paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, $getTrxnInfo);
if ($this->_context == 'payment_info') {
$this->assign('paymentInfo', $paymentInfo);
} else {
$rows = CRM_Utils_Array::value('transaction', $paymentInfo);
$this->assign('rows', $rows);
}
}
示例4: preProcess
/**
* Set variables up before form is built.
*/
public function preProcess()
{
parent::preProcess();
$this->_paymentProcessors = $this->get('paymentProcessors');
$this->preProcessPaymentOptions();
if (!empty($this->_ccid)) {
$payment = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_ccid, 'contribution');
//bounce if the contribution is not pending.
if (empty($payment['balance'])) {
CRM_Core_Error::statusBounce(ts("Returning since contribution has already been handled."));
}
if (!empty($payment['total'])) {
$this->_pendingAmount = $payment['total'];
$this->assign('pendingAmount', $this->_pendingAmount);
}
$lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($this->_ccid);
foreach (array_keys($lineItems) as $id) {
$lineItems[$id]['id'] = $id;
}
$itemId = key($lineItems);
if ($itemId && !empty($lineItems[$itemId]['price_field_id'])) {
$this->_priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'price_set_id');
}
if (!empty($lineItems[$itemId]['price_field_id'])) {
$this->_lineItem[$this->_priceSetId] = $lineItems;
}
$isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config');
$this->assign('lineItem', $this->_lineItem);
$this->assign('is_quick_config', $isQuickConfig);
$this->assign('priceSetID', $this->_priceSetId);
}
// Make the contributionPageID available to the template
$this->assign('contributionPageID', $this->_id);
$this->assign('ccid', $this->_ccid);
$this->assign('isShare', CRM_Utils_Array::value('is_share', $this->_values));
$this->assign('isConfirmEnabled', CRM_Utils_Array::value('is_confirm_enabled', $this->_values));
$this->assign('reset', CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject));
$this->assign('mainDisplay', CRM_Utils_Request::retrieve('_qf_Main_display', 'Boolean', CRM_Core_DAO::$_nullObject));
if (!empty($this->_pcpInfo['id']) && !empty($this->_pcpInfo['intro_text'])) {
$this->assign('intro_text', $this->_pcpInfo['intro_text']);
} elseif (!empty($this->_values['intro_text'])) {
$this->assign('intro_text', $this->_values['intro_text']);
}
$qParams = "reset=1&id={$this->_id}";
if ($pcpId = CRM_Utils_Array::value('pcp_id', $this->_pcpInfo)) {
$qParams .= "&pcpId={$pcpId}";
}
$this->assign('qParams', $qParams);
if (!empty($this->_values['footer_text'])) {
$this->assign('footer_text', $this->_values['footer_text']);
}
}
示例5: preProcess
public function preProcess()
{
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->_component = CRM_Utils_Request::retrieve('component', 'String', $this, TRUE);
$this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
$this->_formType = CRM_Utils_Array::value('formType', $_GET);
$enitityType = NULL;
if ($this->_component == 'event') {
$enitityType = 'participant';
$this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_id, 'contribution_id', 'participant_id');
}
$eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_id, 'event_id', 'id');
$this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($eventId);
$paymentInfo = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($this->_id, $enitityType);
$paymentDetails = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component);
$this->_amtPaid = $paymentDetails['paid'];
$this->_amtTotal = $paymentDetails['total'];
if (!empty($paymentInfo['refund_due'])) {
$paymentAmt = $this->_refund = $paymentInfo['refund_due'];
$this->_paymentType = 'refund';
} elseif (!empty($paymentInfo['amount_owed'])) {
$paymentAmt = $this->_owed = $paymentInfo['amount_owed'];
$this->_paymentType = 'owed';
} else {
CRM_Core_Error::fatal(ts('No payment information found for this record'));
}
//set the payment mode - _mode property is defined in parent class
$this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
if (!empty($this->_mode) && $this->_paymentType == 'refund') {
CRM_Core_Error::fatal(ts('Credit card payment is not for Refund payments use'));
}
list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
if (!$this->_refund) {
$this->assignProcessors();
// also check for billing information
// get the billing location type
$this->assignBillingType();
}
$this->assign('contributionMode', $this->_mode);
$this->assign('contactId', $this->_contactId);
$this->assign('component', $this->_component);
$this->assign('id', $this->_id);
$this->assign('paymentType', $this->_paymentType);
$this->assign('paymentAmt', abs($paymentAmt));
$this->_paymentProcessor = array('billing_mode' => 1);
$title = $this->_refund ? "Refund for {$this->_contributorDisplayName}" : "Payment from {$this->_contributorDisplayName}";
if ($title) {
CRM_Utils_System::setTitle(ts('%1', array(1 => $title)));
}
}
示例6: preProcess
public function preProcess()
{
$this->_participantId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->_eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_participantId, 'event_id');
$this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($this->_eventId);
$this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_participantId, 'contribution_id', 'participant_id');
if (!$this->_contributionId) {
if ($primaryParticipantId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $this->_participantId, 'registered_by_id')) {
$this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_ParticipantPayment', $primaryParticipantId, 'contribution_id', 'participant_id');
}
}
if ($this->_contributionId) {
$this->_isPaidEvent = TRUE;
}
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, TRUE);
list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
$this->assign('displayName', $this->_contributorDisplayName);
$this->assign('email', $this->_contributorEmail);
$this->_participantStatus = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $this->_participantId, 'status_id');
//set the payment mode - _mode property is defined in parent class
$this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
$this->assign('contactId', $this->_contactId);
$this->assign('id', $this->_participantId);
$paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_participantId, 'event');
$this->_paidAmount = $paymentInfo['paid'];
$this->assign('paymentInfo', $paymentInfo);
$this->assign('feePaid', $this->_paidAmount);
$ids = CRM_Event_BAO_Participant::getParticipantIds($this->_contributionId);
if (count($ids) > 1) {
$total = 0;
foreach ($ids as $val) {
$total += CRM_Price_BAO_LineItem::getLineTotal($val, 'civicrm_participant');
}
$this->assign('totalLineTotal', $total);
$lineItemTotal = CRM_Price_BAO_LineItem::getLineTotal($this->_participantId, 'civicrm_participant');
$this->assign('lineItemTotal', $lineItemTotal);
}
$title = "Change selections for {$this->_contributorDisplayName}";
if ($title) {
CRM_Utils_System::setTitle(ts('%1', array(1 => $title)));
}
}
示例7: sendMailings
/**
* @param $mappingID
* @param $now
*
* @throws CRM_Core_Exception
*/
static function sendMailings($mappingID, $now)
{
$domainValues = CRM_Core_BAO_Domain::getNameAndEmail();
$fromEmailAddress = "{$domainValues['0']} <{$domainValues['1']}>";
$mapping = new CRM_Core_DAO_ActionMapping();
$mapping->id = $mappingID;
$mapping->find(TRUE);
$actionSchedule = new CRM_Core_DAO_ActionSchedule();
$actionSchedule->mapping_id = $mappingID;
$actionSchedule->is_active = 1;
$actionSchedule->find(FALSE);
$tokenFields = array();
$session = CRM_Core_Session::singleton();
while ($actionSchedule->fetch()) {
$extraSelect = $extraJoin = $extraWhere = $extraOn = '';
if ($actionSchedule->from_email) {
$fromEmailAddress = "{$actionSchedule->from_name} <{$actionSchedule->from_email}>";
}
if ($actionSchedule->record_activity) {
if ($mapping->entity == 'civicrm_membership') {
$activityTypeID = CRM_Core_OptionGroup::getValue('activity_type', 'Membership Renewal Reminder', 'name');
} else {
$activityTypeID = CRM_Core_OptionGroup::getValue('activity_type', 'Reminder Sent', 'name');
}
$activityStatusID = CRM_Core_OptionGroup::getValue('activity_status', 'Completed', 'name');
}
if ($mapping->entity == 'civicrm_activity') {
$tokenEntity = 'activity';
$tokenFields = array('activity_id', 'activity_type', 'subject', 'details', 'activity_date_time');
$extraSelect = ', ov.label as activity_type, e.id as activity_id';
$extraJoin = "\nINNER JOIN civicrm_option_group og ON og.name = 'activity_type'\nINNER JOIN civicrm_option_value ov ON e.activity_type_id = ov.value AND ov.option_group_id = og.id";
$extraOn = ' AND e.is_current_revision = 1 AND e.is_deleted = 0 ';
if ($actionSchedule->limit_to == 0) {
$extraJoin = "\nLEFT JOIN civicrm_option_group og ON og.name = 'activity_type'\nLEFT JOIN civicrm_option_value ov ON e.activity_type_id = ov.value AND ov.option_group_id = og.id";
}
}
if ($mapping->entity == 'civicrm_participant') {
$tokenEntity = 'event';
$tokenFields = array('event_type', 'title', 'event_id', 'start_date', 'end_date', 'summary', 'description', 'location', 'info_url', 'registration_url', 'fee_amount', 'contact_email', 'contact_phone', 'balance');
$extraSelect = ', ov.label as event_type, ev.title, ev.id as event_id, ev.start_date, ev.end_date, ev.summary, ev.description, address.street_address, address.city, address.state_province_id, address.postal_code, email.email as contact_email, phone.phone as contact_phone ';
$extraJoin = "\nINNER JOIN civicrm_event ev ON e.event_id = ev.id\nINNER JOIN civicrm_option_group og ON og.name = 'event_type'\nINNER JOIN civicrm_option_value ov ON ev.event_type_id = ov.value AND ov.option_group_id = og.id\nLEFT JOIN civicrm_loc_block lb ON lb.id = ev.loc_block_id\nLEFT JOIN civicrm_address address ON address.id = lb.address_id\nLEFT JOIN civicrm_email email ON email.id = lb.email_id\nLEFT JOIN civicrm_phone phone ON phone.id = lb.phone_id\n";
if ($actionSchedule->limit_to == 0) {
$extraJoin = "\nLEFT JOIN civicrm_event ev ON e.event_id = ev.id\nLEFT JOIN civicrm_option_group og ON og.name = 'event_type'\nLEFT JOIN civicrm_option_value ov ON ev.event_type_id = ov.value AND ov.option_group_id = og.id\nLEFT JOIN civicrm_loc_block lb ON lb.id = ev.loc_block_id\nLEFT JOIN civicrm_address address ON address.id = lb.address_id\nLEFT JOIN civicrm_email email ON email.id = lb.email_id\nLEFT JOIN civicrm_phone phone ON phone.id = lb.phone_id\n";
}
}
if ($mapping->entity == 'civicrm_membership') {
$tokenEntity = 'membership';
$tokenFields = array('fee', 'id', 'join_date', 'start_date', 'end_date', 'status', 'type');
$extraSelect = ', mt.minimum_fee as fee, e.id as id , e.join_date, e.start_date, e.end_date, ms.name as status, mt.name as type';
$extraJoin = '
INNER JOIN civicrm_membership_type mt ON e.membership_type_id = mt.id
INNER JOIN civicrm_membership_status ms ON e.status_id = ms.id';
if ($actionSchedule->limit_to == 0) {
$extraJoin = '
LEFT JOIN civicrm_membership_type mt ON e.membership_type_id = mt.id
LEFT JOIN civicrm_membership_status ms ON e.status_id = ms.id';
}
}
if ($mapping->entity == 'civicrm_contact') {
$tokenEntity = 'contact';
//TODO: get full list somewhere!
$tokenFields = array('birth_date', 'last_name');
//TODO: is there anything to add here?
}
$entityJoinClause = "INNER JOIN {$mapping->entity} e ON e.id = reminder.entity_id";
if ($actionSchedule->limit_to == 0) {
$entityJoinClause = "LEFT JOIN {$mapping->entity} e ON e.id = reminder.entity_id";
$extraWhere .= " AND (e.id = reminder.entity_id OR reminder.entity_table = 'civicrm_contact')";
}
$entityJoinClause .= $extraOn;
$query = "\nSELECT reminder.id as reminderID, reminder.contact_id as contactID, reminder.*, e.id as entityID, e.* {$extraSelect}\nFROM civicrm_action_log reminder\n{$entityJoinClause}\n{$extraJoin}\nWHERE reminder.action_schedule_id = %1 AND reminder.action_date_time IS NULL\n{$extraWhere}";
$dao = CRM_Core_DAO::executeQuery($query, array(1 => array($actionSchedule->id, 'Integer')));
while ($dao->fetch()) {
$entityTokenParams = array();
foreach ($tokenFields as $field) {
if ($field == 'location') {
$loc = array();
$stateProvince = CRM_Core_PseudoConstant::stateProvince();
$loc['street_address'] = $dao->street_address;
$loc['city'] = $dao->city;
$loc['state_province'] = CRM_Utils_Array::value($dao->state_province_id, $stateProvince);
$loc['postal_code'] = $dao->postal_code;
$entityTokenParams["{$tokenEntity}." . $field] = CRM_Utils_Address::format($loc);
} elseif ($field == 'info_url') {
$entityTokenParams["{$tokenEntity}." . $field] = CRM_Utils_System::url('civicrm/event/info', 'reset=1&id=' . $dao->event_id, TRUE, NULL, FALSE);
} elseif ($field == 'registration_url') {
$entityTokenParams["{$tokenEntity}." . $field] = CRM_Utils_System::url('civicrm/event/register', 'reset=1&id=' . $dao->event_id, TRUE, NULL, FALSE);
} elseif (in_array($field, array('start_date', 'end_date', 'join_date', 'activity_date_time'))) {
$entityTokenParams["{$tokenEntity}." . $field] = CRM_Utils_Date::customFormat($dao->{$field});
} elseif ($field == 'balance') {
$info = CRM_Contribute_BAO_Contribution::getPaymentInfo($dao->entityID, 'event');
$balancePay = CRM_Utils_Array::value('balance', $info);
$balancePay = CRM_Utils_Money::format($balancePay);
$entityTokenParams["{$tokenEntity}." . $field] = $balancePay;
//.........这里部分代码省略.........
示例8: preProcess
public function preProcess()
{
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->_component = CRM_Utils_Request::retrieve('component', 'String', $this, TRUE);
$this->_view = CRM_Utils_Request::retrieve('view', 'String', $this, FALSE);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
$this->assign('component', $this->_component);
$this->assign('id', $this->_id);
$this->assign('suppressPaymentFormButtons', $this->isBeingCalledFromSelectorContext());
if ($this->_view == 'transaction' && $this->_action & CRM_Core_Action::BROWSE) {
$paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, TRUE);
$transactionRows = $paymentInfo['transaction'];
$title = ts('View Payment');
if ($this->_component == 'event') {
$info = CRM_Event_BAO_Participant::participantDetails($this->_id);
$title .= " - {$info['title']}";
}
CRM_Utils_System::setTitle($title);
$this->assign('transaction', TRUE);
$this->assign('rows', $transactionRows);
return;
}
$this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
$this->_formType = CRM_Utils_Array::value('formType', $_GET);
$enitityType = NULL;
if ($this->_component == 'event') {
$enitityType = 'participant';
$this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_id, 'contribution_id', 'participant_id');
}
$eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_id, 'event_id', 'id');
$this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($eventId);
$paymentInfo = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($this->_id, $enitityType);
$paymentDetails = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, FALSE, TRUE);
$this->_amtPaid = $paymentDetails['paid'];
$this->_amtTotal = $paymentDetails['total'];
if (!empty($paymentInfo['refund_due'])) {
$paymentAmt = $this->_refund = $paymentInfo['refund_due'];
$this->_paymentType = 'refund';
} elseif (!empty($paymentInfo['amount_owed'])) {
$paymentAmt = $this->_owed = $paymentInfo['amount_owed'];
$this->_paymentType = 'owed';
} else {
CRM_Core_Error::fatal(ts('No payment information found for this record'));
}
//set the payment mode - _mode property is defined in parent class
$this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
if (!empty($this->_mode) && $this->_paymentType == 'refund') {
CRM_Core_Error::fatal(ts('Credit card payment is not for Refund payments use'));
}
list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
$this->assignPaymentRelatedVariables();
$this->assign('contributionMode', $this->_mode);
$this->assign('contactId', $this->_contactId);
$this->assign('paymentType', $this->_paymentType);
$this->assign('paymentAmt', abs($paymentAmt));
$this->setPageTitle($this->_refund ? ts('Refund') : ts('Payment'));
}
示例9: evaluateToken
/**
* Evaluate the content of a single token.
*
* @param \Civi\Token\TokenRow $row
* The record for which we want token values.
* @param string $entity
* @param string $field
* The name of the token field.
* @param mixed $prefetch
* Any data that was returned by the prefetch().
*
* @return mixed
*/
public function evaluateToken(\Civi\Token\TokenRow $row, $entity, $field, $prefetch = NULL)
{
$actionSearchResult = $row->context['actionSearchResult'];
if ($field == 'location') {
$loc = array();
$stateProvince = \CRM_Core_PseudoConstant::stateProvince();
$loc['street_address'] = $actionSearchResult->street_address;
$loc['city'] = $actionSearchResult->city;
$loc['state_province'] = \CRM_Utils_Array::value($actionSearchResult->state_province_id, $stateProvince);
$loc['postal_code'] = $actionSearchResult->postal_code;
//$entityTokenParams[$tokenEntity][$field] = \CRM_Utils_Address::format($loc);
$row->tokens($entity, $field, \CRM_Utils_Address::format($loc));
} elseif ($field == 'info_url') {
$row->tokens($entity, $field, \CRM_Utils_System::url('civicrm/event/info', 'reset=1&id=' . $actionSearchResult->event_id, TRUE, NULL, FALSE));
} elseif ($field == 'registration_url') {
$row->tokens($entity, $field, \CRM_Utils_System::url('civicrm/event/register', 'reset=1&id=' . $actionSearchResult->event_id, TRUE, NULL, FALSE));
} elseif (in_array($field, array('start_date', 'end_date'))) {
$row->tokens($entity, $field, \CRM_Utils_Date::customFormat($actionSearchResult->{$field}));
} elseif ($field == 'balance') {
if ($actionSearchResult->entityTable == 'civicrm_contact') {
$balancePay = 'N/A';
} elseif (!empty($actionSearchResult->entityID)) {
$info = \CRM_Contribute_BAO_Contribution::getPaymentInfo($actionSearchResult->entityID, 'event');
$balancePay = \CRM_Utils_Array::value('balance', $info);
$balancePay = \CRM_Utils_Money::format($balancePay);
}
$row->tokens($entity, $field, $balancePay);
} elseif ($field == 'fee_amount') {
$row->tokens($entity, $field, \CRM_Utils_Money::format($actionSearchResult->{$field}));
} elseif (isset($actionSearchResult->{$field})) {
$row->tokens($entity, $field, $actionSearchResult->{$field});
} else {
$row->tokens($entity, $field, '');
}
}
示例10: testAddPartialPayment
/**
* CRM-13964
*/
public function testAddPartialPayment()
{
$feeAmt = 100;
$amtPaid = 60;
$balance = $feeAmt - $amtPaid;
list($participant, $contribution) = $this->addParticipantWithPayment($feeAmt, $amtPaid);
$paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($participant['id'], 'event');
// amount checking
$this->assertEquals(round($paymentInfo['total']), $feeAmt, 'Total amount recorded is not proper');
$this->assertEquals(round($paymentInfo['paid']), $amtPaid, 'Amount paid is not proper');
$this->assertEquals(round($paymentInfo['balance']), $balance, 'Balance amount is not proper');
// status checking
$this->assertEquals($participant['participant_status_id'], 14, 'Status record is not proper for participant');
$this->assertEquals($contribution->contribution_status_id, 8, 'Status record is not proper for contribution');
}