}
$defaults = array();
if ($this->_mode) {
- $defaults = $this->_values;
-
- $config = CRM_Core_Config::singleton();
- // set default country from config if no country set
- if (empty($defaults["billing_country_id-{$this->_bltID}"])) {
- $defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
- }
-
- if (empty($defaults["billing_state_province_id-{$this->_bltID}"])) {
- $defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince;
- }
-
- $billingDefaults = $this->getProfileDefaults('Billing', $this->_contactId);
- $defaults = array_merge($defaults, $billingDefaults);
+ CRM_Core_Payment_Form::setDefaultValues($this, $this->_contactId);
+ $defaults = array_merge($defaults, $this->_defaults);
}
if (empty($defaults['trxn_date']) && empty($defaults['trxn_date_time'])) {
return $defaults;
}
+ /**
+ * Build the form object.
+ */
public function buildQuickForm() {
if ($this->_view == 'transaction' && ($this->_action & CRM_Core_Action::BROWSE)) {
$this->addButtons(array(
);
return;
}
- $ccPane = NULL;
- if ($this->_mode) {
- if (CRM_Utils_Array::value('payment_type', $this->_processors) & CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT
- ) {
- $ccPane = array(ts('Direct Debit Information') => 'DirectDebit');
- }
- else {
- $ccPane = array(ts('Credit Card Information') => 'CreditCard');
- }
- $defaults = $this->_values;
- $showAdditionalInfo = FALSE;
-
- foreach ($ccPane as $name => $type) {
- if ($this->_formType == $type || !empty($_POST["hidden_{$type}"]) ||
- CRM_Utils_Array::value("hidden_{$type}", $defaults)
- ) {
- $showAdditionalInfo = TRUE;
- $allPanes[$name]['open'] = 'true';
- }
- $urlParams = "snippet=4&formType={$type}";
- if ($this->_mode) {
- $urlParams .= "&mode={$this->_mode}";
- }
- $open = 'false';
- if ($type == 'CreditCard' ||
- $type == 'DirectDebit'
- ) {
- $open = 'true';
- }
-
- $allPanes[$name] = array(
- 'url' => CRM_Utils_System::url('civicrm/payment/add', $urlParams),
- 'open' => $open,
- 'id' => $type,
- );
-
- CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE, TRUE);
-
- $qfKey = $this->controller->_key;
- $this->assign('qfKey', $qfKey);
- $this->assign('allPanes', $allPanes);
- $this->assign('showAdditionalInfo', $showAdditionalInfo);
-
- if ($this->_formType) {
- $this->assign('formType', $this->_formType);
- return;
- }
- }
- }
+ CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE, TRUE);
$attributes = CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialTrxn');
$this->add('select', 'payment_processor_id', ts('Payment Processor'), $this->_processors, NULL);
{include file="CRM/common/formButtons.tpl"}
</div>
{/if}
- {elseif $formType}
- {include file="CRM/Contribute/Form/AdditionalInfo/$formType.tpl"}
{else}
<div class="crm-block crm-form-block crm-payment-form-block">
<span class="description">{ts}Net value of the payment (Total Amount minus Fee).{/ts}</span></td></tr>
</table>
</div>
+ {include file='CRM/Core/BillingBlockWrapper.tpl'}
</div>
-<div class="accordion ui-accordion ui-widget ui-helper-reset">
- {* Additional Detail / Honoree Information / Premium Information *}
- {foreach from=$allPanes key=paneName item=paneValue}
-
- <div class="crm-accordion-wrapper crm-ajax-accordion crm-{$paneValue.id}-accordion {if $paneValue.open neq 'true'}collapsed{/if}">
- <div class="crm-accordion-header" id="{$paneValue.id}">
-
- {$paneName}
- </div><!-- /.crm-accordion-header -->
- <div class="crm-accordion-body">
-
- <div class="{$paneValue.id}"></div>
- </div><!-- /.crm-accordion-body -->
- </div><!-- /.crm-accordion-wrapper -->
-
- {/foreach}
- </div>
-
-
-
{literal}
<script type="text/javascript">
$('#receiptDate', $form).show();
}
}
-
+
// bind first click of accordion header to load crm-accordion-body with snippet
$('#adjust-option-type', $form).hide();
$('.crm-ajax-accordion .crm-accordion-header', $form).one('click', function() {
CRM.loadPage(url, {target: $('div.' + id, $form)});
}
}
-
+
$('#fee_amount', $form).change( function() {
var totalAmount = $('#total_amount', $form).val();
var feeAmount = $('#fee_amount', $form).val();