protected $_fromEmails = NULL;
+ protected $_view = NULL;
+
+ public $_action = NULL;
+
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);
+ if ($this->_view == 'transaction' && ($this->_action & CRM_Core_Action::BROWSE)) {
+ $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, TRUE);
+ $transactionRows = $paymentInfo['transaction'];
+ $this->assign('transaction', TRUE);
+ $this->assign('rows', $transactionRows);
+ return;
+ }
$this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
$this->_formType = CRM_Utils_Array::value('formType', $_GET);
$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));
}
public function setDefaultValues() {
+ if ($this->_view == 'transaction' && ($this->_action & CRM_Core_Action::BROWSE)) {
+ return;
+ }
if ($this->_mode) {
$defaults = $this->_values;
}
public function buildQuickForm() {
+ if ($this->_view == 'transaction' && ($this->_action & CRM_Core_Action::BROWSE)) {
+ $this->addButtons(array(
+ array(
+ 'type' => 'cancel',
+ 'name' => ts('Done'),
+ 'spacing' => ' ',
+ 'isDefault' => TRUE,
+ ),
+ )
+ );
+ return;
+ }
$ccPane = NULL;
if ($this->_mode) {
if (CRM_Utils_Array::value('payment_type', $this->_processors) & CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT
if ($this->_context == 'payment_info') {
$this->assign('paymentInfo', $paymentInfo);
}
- else {
- $rows = CRM_Utils_Array::value('transaction', $paymentInfo);
- $this->assign('rows', $rows);
- }
}
function run() {
<weight>580</weight>
</item>
<item>
- <path>civicrm/payment/add</path>
+ <path>civicrm/payment</path>
<title>New Payment</title>
<page_callback>CRM_Contribute_Form_AdditionalPayment</page_callback>
<path_arguments>action=add</path_arguments>
}
$this->set('onlinePendingContributionId', $this->_onlinePendingContributionId);
$roleIds = CRM_Event_PseudoConstant::participantRole();
-
if (!empty($roleIds)) {
$query = "
SELECT civicrm_custom_group.name as name,
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
$participantStatuses = CRM_Event_PseudoConstant::participantStatus();
$partiallyPaidStatusId = array_search('Partially paid', $participantStatuses);
- CRM_Core_Resources::singleton()->addSetting(array('partiallyPaidStatusId' => $partiallyPaidStatusId));
+ $this->assign('partiallyPaidStatusId', $partiallyPaidStatusId);
if ($this->_showFeeBlock) {
return CRM_Event_Form_EventFees::buildQuickForm($this);
$this->assign('notificationStatusIds', $notificationStatusIds);
$this->_participantStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
- $this->addSelect('status_id', $checkCancelledJs, TRUE);
+ $participantStatuses = $this->addSelect('status_id', $checkCancelledJs, TRUE);
+ $enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME,
+ 'enable_cart'
+ );
+ $pendingInCartStatusId = CRM_Utils_Array::key( "Pending in cart" , $this->_participantStatuses );
+ if (!$enableCart) {
+ $statusOptions = & $participantStatuses->_options;
+ foreach($statusOptions as $key =>$option){
+ $status_id = $option['attr']['value'];
+ if ($status_id == $pendingInCartStatusId) {
+ unset($statusOptions[$key]);
+ }
+ }
+ }
$this->addElement('checkbox', 'is_notify', ts('Send Notification'), NULL);
}
$this->assign('totalAmount', $contributionParams['total_amount']);
-
+ if (isset($contributionParams['partial_payment_total'])) {
+ // balance amount
+ $balanceAmount = $contributionParams['partial_payment_total'] - $contributionParams['partial_amount_pay'];
+ $this->assign('balanceAmount', $balanceAmount );
+ }
$this->assign('isPrimary', 1);
$this->assign('checkNumber', CRM_Utils_Array::value('check_number', $params));
}
if ($statusTypes[$row['participant_status_id']] == 'Partially paid') {
$links[CRM_Core_Action::ADD] = array(
'name' => ts('Record Payment'),
- 'url' => 'civicrm/payment/add',
+ 'url' => 'civicrm/payment',
'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=add&component=event',
'title' => ts('Record Payment'),
);
if ($statusTypes[$row['participant_status_id']] == 'Pending refund') {
$links[CRM_Core_Action::ADD] = array(
'name' => ts('Record Refund'),
- 'url' => 'civicrm/payment/add',
+ 'url' => 'civicrm/payment',
'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=add&component=event',
'title' => ts('Record Refund'),
);
UPDATE civicrm_msg_template SET msg_{$tpl.type} = '{$content|escape:"quotes"}' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_{$tpl.type} = @content));
{/foreach}
+{php}
$ovNames = array(
'contribution' => array(
'payment_or_refund_notification' => ts('Additional Payment Receipt or Refund Notification', array('escape' => 'sql')),
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
-{if $formType}
+{if $transaction}
+ <div class="crm-submit-buttons">
+ {include file="CRM/common/formButtons.tpl"}
+ </div>
+ {if !empty($rows)}
+ <table id='info'>
+ <tr class="columnheader">
+ <th>{ts}Amount{/ts}</th>
+ <th>{ts}Type{/ts}</th>
+ <th>{ts}Paid By{/ts}</th>
+ <th>{ts}Received{/ts}</th>
+ <th>{ts}Transaction ID{/ts}</th>
+ <th>{ts}Status{/ts}</th>
+ </tr>
+ {foreach from=$rows item=row}
+ <tr>
+ <td>{$row.total_amount|crmMoney}</td>
+ <td>{$row.financial_type}</td>
+ <td>{$row.payment_instrument}</td>
+ <td>{$row.receive_date|crmDate}</td>
+ <td>{$row.trxn_id}</td>
+ <td>{$row.status}</td>
+ </tr>
+ {/foreach}
+ <table>
+ {else}
+ {if $component eq 'event'}
+ {assign var='entity' value='participant'}
+ {else}
+ {assign var='entity' value=$component}
+ {/if}
+ {ts 1=$entity}No additional payments found for this %1 record{/ts}
+ {/if}
+{elseif $formType}
{include file="CRM/Contribute/Form/AdditionalInfo/$formType.tpl"}
{else}
<td>{$paymentInfo.total|crmMoney}</td>
<td class='right'>
{if $paymentInfo.paid > 0}
- <a class='action-item' href='{crmURL p="civicrm/payment/view" q="action=browse&cid=`$cid`&id=`$paymentInfo.id`&component=`$paymentInfo.component`&context=transaction"}'>{$paymentInfo.paid|crmMoney}<br/>>> view payments</a>
+ <a class='action-item' href='{crmURL p="civicrm/payment" q="view=transaction&cid=`$cid`&id=`$paymentInfo.id`&component=`$paymentInfo.component`&action=browse"}'>{$paymentInfo.paid|crmMoney}<br/>>> view payments</a>
{/if}
</td>
<td class='right'>{$paymentInfo.balance|crmMoney}</td>
{elseif $paymentInfo.balance < 0}
{assign var=paymentButtonName value='Record Refund'}
{/if}
- <a class="button" href='{crmURL p="civicrm/payment/add" q="reset=1&component=`$component`&id=`$id`&cid=`$cid`"}' title="{ts}{$paymentButtonName}{/ts}"><span><div class="icon add-icon"></div> {ts}{$paymentButtonName}{/ts}</span></a>
+ <a class="button" href='{crmURL p="civicrm/payment" q="action=add&reset=1&component=`$component`&id=`$id`&cid=`$cid`"}' title="{ts}{$paymentButtonName}{/ts}"><span><div class="icon add-icon"></div> {ts}{$paymentButtonName}{/ts}</span></a>
{/if}
-{elseif $context eq 'transaction'}
- {if !empty($rows)}
- <table id='info'>
- <tr class="columnheader">
- <th>{ts}Amount{/ts}</th>
- <th>{ts}Type{/ts}</th>
- <th>{ts}Paid By{/ts}</th>
- <th>{ts}Received{/ts}</th>
- <th>{ts}Transaction ID{/ts}</th>
- <th>{ts}Status{/ts}</th>
- </tr>
- {foreach from=$rows item=row}
- <tr>
- <td>{$row.total_amount|crmMoney}</td>
- <td>{$row.financial_type}</td>
- <td>{$row.payment_instrument}</td>
- <td>{$row.receive_date|crmDate}</td>
- <td>{$row.trxn_id}</td>
- <td>{$row.status}</td>
- </tr>
- {/foreach}
- <table>
- {else}
- {if $component eq 'event'}
- {assign var='entity' value='participant'}
- {else}
- {assign var='entity' value=$component}
- {/if}
- {ts 1=$entity}No additional payments found for this %1 record{/ts}
- {/if}
{/if}
\ No newline at end of file
// change the status to default 'partially paid' for partial payments
var feeAmount, userModifiedAmount;
+ var partiallyPaidStatusId = {/literal}{$partiallyPaidStatusId}{literal};
cj('#total_amount')
.focus(
userModifiedAmount = cj(this).val();
userModifiedAmount = parseInt(userModifiedAmount);
if (userModifiedAmount < feeAmount) {
- cj('#status_id').val(CRM.partiallyPaidStatusId);
+ cj('#status_id').select2('val', partiallyPaidStatusId);
}
}
);
- cj('#Participant').submit(
+ cj('#Participant').on("click",'.validate',
function(e) {
var userSubmittedStatus = cj('#status_id').val();
var statusLabel = cj('#status_id option:selected').text();
- if (userModifiedAmount < feeAmount && userSubmittedStatus != CRM.partiallyPaidStatusId) {
- var result = confirm('Payment amount is less than the amount owed. Expected participant status is \'Partially paid\'. Are you sure you want to set the participant status to ' + statusLabel + '? Click OK to continue, Cancel to change your entries.');
+ if (userModifiedAmount < feeAmount && userSubmittedStatus != partiallyPaidStatusId) {
+ var msg = "{/literal}{ts escape="js" 1="%1"}Payment amount is less than the amount owed. Expected participant status is 'Partially paid'. Are you sure you want to set the participant status to %1? Click OK to continue, Cancel to change your entries.{/ts}{literal}";
+ var result = confirm(ts(msg, {1: statusLabel}));
if (result == false) {
- e.preventDefault();
+ return false;
}
}
}
}
var roleGroupMapper = {/literal}{$participantRoleIds|@json_encode}{literal};
-
function showCustomData( type, subType, subName ) {
var dataUrl = {/literal}"{crmURL p=$urlPath h=0 q='snippet=4&type='}"{literal} + type;
var roleid = "role_id_"+subType;
var loadData = false;
if ( document.getElementById( roleid ).checked == true ) {
- if ( roleGroupMapper[subType] ) {
+ if ( typeof roleGroupMapper !== 'undefined' && roleGroupMapper[subType] ) {
var splitGroup = roleGroupMapper[subType].split(",");
for ( i = 0; i < splitGroup.length; i++ ) {
var roleCustomGroupId = splitGroup[i];
{if $isPrimary}
<tr>
<td {$labelStyle}>
- {ts}Total Amount{/ts}
+ {if $balanceAmount}
+ {ts}Total Paid{/ts}
+ {else}
+ {ts}Total Amount{/ts}
+ {/if}
</td>
<td {$valueStyle}>
{$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if}
</td>
</tr>
+ {if $balanceAmount}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Balance{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$balanceAmount|crmMoney}
+ </td>
+ </tr>
+ {/if}
{if $pricesetFieldsCount }
<tr>
<td {$labelStyle}>
{foreach from=$amount item=amnt key=level}{$amnt.amount|crmMoney} {$amnt.label}
{/foreach}
{/if}
-{if $isPrimary }
+{if $isPrimary}
+
+{if $balanceAmount}{ts}Total Paid{/ts}{else}{ts}Total Amount{/ts}{/if}: {$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if}
-{ts}Total Amount{/ts}: {$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if}
+{if $balanceAmount}
+{ts}Balance{/ts}: {$balanceAmount|crmMoney}
+{/if}
{if $pricesetFieldsCount }
{assign var="count" value= 0}