Skip to content

Commit

Permalink
Merge pull request #12662 from eileenmcnaughton/net_amount
Browse files Browse the repository at this point in the history
Remove net_amount from the Back office contribution form.
  • Loading branch information
eileenmcnaughton authored Aug 27, 2018
2 parents bd5fd07 + 3533db2 commit cc0a70e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
10 changes: 1 addition & 9 deletions CRM/Contribute/Form/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public function setDefaultValues() {
}
}

$amountFields = array('non_deductible_amount', 'fee_amount', 'net_amount');
$amountFields = array('non_deductible_amount', 'fee_amount');
foreach ($amountFields as $amt) {
if (isset($defaults[$amt])) {
$defaults[$amt] = CRM_Utils_Money::format($defaults[$amt], NULL, '%a');
Expand Down Expand Up @@ -535,7 +535,6 @@ public function buildQuickForm() {
'invoice_id',
'non_deductible_amount',
'fee_amount',
'net_amount',
);
foreach ($additionalDetailFields as $key) {
if (!empty($defaults[$key])) {
Expand Down Expand Up @@ -883,13 +882,6 @@ public static function formRule($fields, $files, $self) {

$softErrors = CRM_Contribute_Form_SoftCredit::formRule($fields, $errors, $self);

if (!empty($fields['total_amount']) && (!empty($fields['net_amount']) || !empty($fields['fee_amount']))) {
$sum = CRM_Utils_Rule::cleanMoney($fields['net_amount']) + CRM_Utils_Rule::cleanMoney($fields['fee_amount']);
if (CRM_Utils_Rule::cleanMoney($fields['total_amount']) != $sum) {
$errors['total_amount'] = ts('The sum of fee amount and net amount must be equal to total amount');
}
}

//CRM-16285 - Function to handle validation errors on form, for recurring contribution field.
CRM_Contribute_BAO_ContributionRecur::validateRecurContribution($fields, $files, $self, $errors);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
<span class="description">{ts}Non-deductible portion of this contribution.{/ts}</span></td></tr>
<tr class="crm-contribution-form-block-fee_amount"><td class="label">{$form.fee_amount.label}</td><td{$valueStyle}>{$form.fee_amount.html|crmMoney:$currency:'XXX':'YYY'}<br />
<span class="description">{ts}Processing fee for this transaction (if applicable).{/ts}</span></td></tr>

<tr class="crm-contribution-form-block-net_amount"><td class="label">{$form.net_amount.label}</td><td{$valueStyle}>{$form.net_amount.html|crmMoney:$currency:'':1}<br />
<span class="description">{ts}Net value of the contribution (Total Amount minus Fee).{/ts}</span></td></tr>
<tr class="crm-contribution-form-block-invoice_id"><td class="label">{$form.invoice_id.label}</td><td{$valueStyle}>{$form.invoice_id.html}<br />
<span class="description">{ts}Unique internal reference ID for this contribution.{/ts}</span></td></tr>
Expand Down
13 changes: 2 additions & 11 deletions templates/CRM/Contribute/Form/Contribution.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
{/if}
</div>
{/if}

<div class="crm-block crm-form-block crm-contribution-form-block">

{if !$email and $action neq 8 and $context neq 'standalone'}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>&nbsp;{ts}You will not be able to send an automatic email receipt for this contribution because there is no email address recorded for this contact. If you want a receipt to be sent when this contribution is recorded, click Cancel and then click Edit from the Summary tab to add an email address before recording the contribution.{/ts}
</div>
{/if}

{if $action eq 8}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>
Expand Down Expand Up @@ -590,15 +590,6 @@ function showStartDate( ) {
var thousandMarker = "{/literal}{$config->monetaryThousandSeparator}{literal}";
var separator = "{/literal}{$config->monetaryDecimalPoint}{literal}";
cj('#fee_amount').change( function() {
var totalAmount = cj('#total_amount').val().replace(thousandMarker,'').replace(separator,'.');
var feeAmount = cj('#fee_amount').val().replace(thousandMarker,'').replace(separator,'.');
var netAmount = totalAmount - feeAmount;
if (totalAmount) {
cj('#net_amount').val(CRM.formatMoney(netAmount, true));
}
});
cj("#financial_type_id").on("change",function(){
cj('#total_amount').trigger("change");
})
Expand Down

0 comments on commit cc0a70e

Please sign in to comment.