|
Lines 8-13
Link Here
|
| 8 |
[% USE Price %] |
8 |
[% USE Price %] |
| 9 |
[% USE Registers %] |
9 |
[% USE Registers %] |
| 10 |
[% PROCESS 'i18n.inc' %] |
10 |
[% PROCESS 'i18n.inc' %] |
|
|
11 |
[% PROCESS 'html_helpers.inc' %] |
| 11 |
[% SET footerjs = 1 %] |
12 |
[% SET footerjs = 1 %] |
| 12 |
[% SET registers = Registers.all( filters => { current_branch => 1 } ) %] |
13 |
[% SET registers = Registers.all( filters => { current_branch => 1 } ) %] |
| 13 |
|
14 |
|
|
Lines 239-244
Link Here
|
| 239 |
data-accountline="[% account.accountlines_id | html %]" |
240 |
data-accountline="[% account.accountlines_id | html %]" |
| 240 |
data-amount="[% account.amount | $Price on_editing => 1 %]" |
241 |
data-amount="[% account.amount | $Price on_editing => 1 %]" |
| 241 |
data-amountoutstanding="[% account.amountoutstanding | $Price on_editing => 1 %]" |
242 |
data-amountoutstanding="[% account.amountoutstanding | $Price on_editing => 1 %]" |
|
|
243 |
data-payment-type="[% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', account.credits.single.payment_type ) | html %]" |
| 242 |
data-member="[% account.borrowernumber | html %]" |
244 |
data-member="[% account.borrowernumber | html %]" |
| 243 |
><i class="fa-solid fa-money-bill-1"></i> Issue refund</button |
245 |
><i class="fa-solid fa-money-bill-1"></i> Issue refund</button |
| 244 |
> |
246 |
> |
|
Lines 345-410
Link Here
|
| 345 |
</div> |
347 |
</div> |
| 346 |
<!-- /#issuePayoutModal --> |
348 |
<!-- /#issuePayoutModal --> |
| 347 |
|
349 |
|
| 348 |
<!-- Issue refund modal --> |
350 |
[% INCLUDE 'modals/refund_modal.inc' refund_form_action = '/cgi-bin/koha/members/boraccount.pl' patron = patron registers = registers %] |
| 349 |
<div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel"> |
|
|
| 350 |
<form id="refund_form" action="/cgi-bin/koha/members/boraccount.pl" method="post" enctype="multipart/form-data" class="validated"> |
| 351 |
[% INCLUDE 'csrf-token.inc' %] |
| 352 |
<input type="hidden" name="accountlines_id" value="" id="refundline" /> |
| 353 |
<input type="hidden" name="op" value="cud-refund" /> |
| 354 |
<input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]" /> |
| 355 |
<div class="modal-dialog"> |
| 356 |
<div class="modal-content"> |
| 357 |
<div class="modal-header"> |
| 358 |
<h1 class="modal-title" id="issueRefundLabel">Issue refund</h1> |
| 359 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
| 360 |
</div> |
| 361 |
<div class="modal-body"> |
| 362 |
[% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %] |
| 363 |
<div id="refund_error" class="alert alert-warning"> You must have at least one cash register associated with this branch before you can record cash refunds. </div> |
| 364 |
[% END %] |
| 365 |
<fieldset class="rows"> |
| 366 |
<ol> |
| 367 |
<li> <span id="refund_item" class="label">Account: </span><span></span> </li> |
| 368 |
<li> <span id="paid" class="label">Amount paid: </span><span></span> </li> |
| 369 |
<li> |
| 370 |
<label class="required" for="amount">Returned to patron: </label> |
| 371 |
<input type="text" inputmode="numeric" pattern="[0-9]*" id="returned" name="amount" required="required" /> |
| 372 |
<span class="required">Required</span> |
| 373 |
</li> |
| 374 |
|
| 375 |
[% INCLUDE 'transaction_types.inc' type="refund" %] |
| 376 |
|
| 377 |
[% IF Koha.Preference('UseCashRegisters') %] |
| 378 |
<li> |
| 379 |
<label for="registerid">Cash register: </label> |
| 380 |
<select name="registerid" id="refund_registerid"> |
| 381 |
<option id="noregister" disabled selected="selected" value="">-- Select an option--</option> |
| 382 |
[% PROCESS options_for_registers %] |
| 383 |
</select> |
| 384 |
</li> |
| 385 |
[% END %] |
| 386 |
<li> |
| 387 |
<label for="refund_note">Note: </label> |
| 388 |
<textarea id="refund_note" name="refund_note" rows="5" cols="30"></textarea> |
| 389 |
</li> |
| 390 |
</ol> |
| 391 |
</fieldset> |
| 392 |
<!-- /.rows --> |
| 393 |
</div> |
| 394 |
<!-- /.modal-body --> |
| 395 |
<div class="modal-footer"> |
| 396 |
<button type="submit" class="btn btn-primary" id="borr_refund_confirm">Confirm</button> |
| 397 |
<button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button> |
| 398 |
</div> |
| 399 |
<!-- /.modal-footer --> |
| 400 |
</div> |
| 401 |
<!-- /.modal-content --> |
| 402 |
</div> |
| 403 |
<!-- /.modal-dialog --> |
| 404 |
</form> |
| 405 |
<!-- /#refund_form --> |
| 406 |
</div> |
| 407 |
<!-- /#issueRefundModal --> |
| 408 |
|
351 |
|
| 409 |
<!-- Apply discount modal --> |
352 |
<!-- Apply discount modal --> |
| 410 |
<div class="modal" id="applyDiscountModal" tabindex="-1" role="dialog" aria-labelledby="applyDiscountLabel"> |
353 |
<div class="modal" id="applyDiscountModal" tabindex="-1" role="dialog" aria-labelledby="applyDiscountLabel"> |
|
Lines 577-582
Link Here
|
| 577 |
[% INCLUDE 'format_price.inc' %] |
520 |
[% INCLUDE 'format_price.inc' %] |
| 578 |
[% INCLUDE 'str/members-menu.inc' %] |
521 |
[% INCLUDE 'str/members-menu.inc' %] |
| 579 |
[% Asset.js("js/members-menu.js") | $raw %] |
522 |
[% Asset.js("js/members-menu.js") | $raw %] |
|
|
523 |
[% Asset.js("js/refund_modal.js") | $raw %] |
| 580 |
<script> |
524 |
<script> |
| 581 |
$(document).ready(function() { |
525 |
$(document).ready(function() { |
| 582 |
[% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %] |
526 |
[% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %] |
|
Lines 618-660
Link Here
|
| 618 |
$("#amount, #payout_transaction_type").focus(); |
562 |
$("#amount, #payout_transaction_type").focus(); |
| 619 |
}); |
563 |
}); |
| 620 |
|
564 |
|
| 621 |
$("#issueRefundModal").on("shown.bs.modal", function(e){ |
565 |
// Initialize refund modal with cash register validation |
| 622 |
var button = $(e.relatedTarget); |
|
|
| 623 |
var item = button.data('item'); |
| 624 |
$("#item + span").replaceWith(item); |
| 625 |
var accountline = button.data('accountline'); |
| 626 |
$('#refundline').val(accountline); |
| 627 |
var amount = button.data('amount'); |
| 628 |
var amountoutstanding = button.data('amountoutstanding') || 0; |
| 629 |
var paid = amount - amountoutstanding; |
| 630 |
$("#paid + span").text(paid.format_price()); |
| 631 |
$("#returned").attr({ "value": paid.format_price(), "max": paid.format_price(), "min": 0 }); |
| 632 |
var member = button.data('member'); |
| 633 |
if ( member === '' ) { |
| 634 |
$("#refund_type option[value='AC']").remove(); |
| 635 |
} else if ( $("#refund_type option[value='AC']").length == 0 ) { |
| 636 |
$("#refund_type").prepend('<option value="AC" selected="selected">Account credit</option>'); |
| 637 |
} |
| 638 |
$("#returned, #refund_type").focus(); |
| 639 |
}); |
| 640 |
|
| 641 |
// Validate cash register requirement for refunds |
| 642 |
[% IF Koha.Preference('UseCashRegisters') %] |
566 |
[% IF Koha.Preference('UseCashRegisters') %] |
| 643 |
$("#refund_form").on("submit", function(e) { |
567 |
initRefundModal({ |
| 644 |
var refund_type = $("#refund_type").val(); |
568 |
validateCashRegister: true |
| 645 |
var register = $("#refund_registerid").val(); |
|
|
| 646 |
|
| 647 |
// Only require register for non-AC refunds with CASH or SIP00 payment types |
| 648 |
if (refund_type && refund_type !== 'AC' && (refund_type === 'CASH' || refund_type.match(/^SIP\d{2}$/))) { |
| 649 |
if (!register || register === '') { |
| 650 |
e.preventDefault(); |
| 651 |
alert(_("Cash register is required for cash refunds")); |
| 652 |
$("#refund_registerid").focus(); |
| 653 |
return false; |
| 654 |
} |
| 655 |
} |
| 656 |
return true; |
| 657 |
}); |
569 |
}); |
|
|
570 |
[% ELSE %] |
| 571 |
initRefundModal(); |
| 658 |
[% END %] |
572 |
[% END %] |
| 659 |
|
573 |
|
| 660 |
$("#applyDiscountModal").on("shown.bs.modal", function(e){ |
574 |
$("#applyDiscountModal").on("shown.bs.modal", function(e){ |