*/
public $_participantRoleIds = array();
+
+ protected $_feePaymenBlock = NULL;
/**
* Function to set variables up before form is built
*
if ($this->_id) {
$this->assign('participantId', $this->_id);
- $feePaymentBlock = FALSE;
+ $this->_feePaymenBlock = FALSE;
$statusId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $this->_id, 'status_id', 'id');
if (in_array($participantStatuses[$statusId], array('Partially paid', 'Pending refund'))) {
- $feePaymentBlock = TRUE;
+ $this->_feePaymenBlock = TRUE;
}
- $this->assign('feePaymentBlock', $feePaymentBlock);
+ $this->assign('feePaymentBlock', $this->_feePaymenBlock);
$this->_paymentId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment',
$this->_id, 'id', 'participant_id'
);
* @access public
*/
public function buildQuickForm() {
- if ($this->_action == CRM_Core_Action::UPDATE) {
+ if ($this->_feePaymenBlock) {
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
}
if ($this->_showFeeBlock) {
}
$this->_params = $params;
- $amountOwed = $params['amount'];
- unset($params['amount']);
+ $amountOwed = NULL;
+ if (isset($params['amount'])) {
+ $amountOwed = $params['amount'];
+ unset($params['amount']);
+ }
$params['register_date'] = CRM_Utils_Date::processDate($params['register_date'], $params['register_date_time']);
$params['receive_date'] = CRM_Utils_Date::processDate(CRM_Utils_Array::value('receive_date', $params));
$params['contact_id'] = $this->_contactId;
* @return void
* @access public
*/
+ protected $_feePaymentBlock = NULL;
public function preProcess() {
$values = $ids = array();
$participantID = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
CRM_Event_BAO_Participant::fixEventLevel($values[$participantID]['fee_level']);
}
+ $this->assign('contactId', $contactID);
+ $this->assign('participantId', $participantID);
+ $this->_feePaymentBlock = FALSE;
+ $statusId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $participantID, 'status_id', 'id');
+ $participantStatuses = CRM_Event_PseudoConstant::participantStatus();
+ if (in_array($participantStatuses[$statusId], array('Partially paid', 'Pending refund'))) {
+ $this->_feePaymentBlock = TRUE;
+ }
+ $this->assign('feePaymentBlock', $this->_feePaymentBlock);
+
if ($values[$participantID]['is_test']) {
$values[$participantID]['status'] .= ' (test) ';
}
* @access public
*/
public function buildQuickForm() {
+ if ($this->_feePaymentBlock) {
+ CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
+ }
$this->addButtons(array(
array(
'type' => 'cancel',
}
$row['checkbox'] = CRM_Core_Form::CB_PREFIX . $result->participant_id;
+ $links = self::links($this->_key, $this->_context, $this->_compContext);
+
+ if ($statusTypes[$row['participant_status_id']] == 'Partially paid') {
+ $links[CRM_Core_Action::ADD] = array(
+ 'name' => ts('Record Payment'),
+ 'url' => 'civicrm/payment/add',
+ 'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=add&component=event',
+ 'title' => ts('Record Payment'),
+ );
+ }
- $row['action'] = CRM_Core_Action::formLink(self::links($this->_key, $this->_context, $this->_compContext),
+ $row['action'] = CRM_Core_Action::formLink($links,
$mask,
array(
'id' => $result->participant_id,
<td class="label">{ts}Event Source{/ts}</td><td>{$source} </td>
</tr>
{/if}
+ {if $participantId and $feePaymentBlock}
+ <tr>
+ <td class='label'>{ts}Fees{/ts}</td>
+ <td id='payment-info'></td>
+ </tr>
+ {/if}
{if $fee_level}
<tr class="crm-event-participantview-form-block-fee_amount">
{if $lineItem}
{/if}
{/foreach}
</table>
+ {if $participantId and $feePaymentBlock}
+ {include file="CRM/Contribute/Page/PaymentInfo.tpl" show='event-payment'}
+ {/if}
{include file="CRM/Custom/Page/CustomDataView.tpl"}
{if $accessContribution and $rows.0.contribution_id}
{include file="CRM/Contribute/Form/Selector.tpl" context="Search"}