Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt
Tomas Cohen Arazi 523b4533f8 Bug 23215: Remove traces of the PayPal feature
This patch removes the PayPal payments feature. It has been moved to
its' own plugin.

To test:
1. Apply this patches
2. Run:
   $ updatedatabase
=> SUCCESS: Database updates correctly
3. Run:
   $ koha-mysql kohadev
   > SELECT * FROM systempreferences WHERE variable LIKE 'paypal';
=> SUCCESS: No results
4. On the sysprefs, OPAC section
=> SUCCESS: No PayPal-related sysprefs show up
5. Add some charges to your patron
6. In the OPAC, log in and see your charges
=> SUCCESS: Nothing broken
7. Install the PayPal plugin [1] or any other payment plugin
8. Restart plack (mandatory for the PayPal plugin)
9. Set some random data in the config (or better, real sandbox testing
   data)
10. Go to the OPAC's account page and try to pay your debts (use the
    checkbox to select lines)
=> SUCCESS: The PayPal payment method shows, you can click the button,
    it fails due to bad config, but things work as expected.
11. Sign off :-D

[1] https://gitlab.com/thekesolutions/plugins/koha-plugin-pay-via-paypal/-/releases

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-05-07 14:44:00 +02:00

163 lines
6.7 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
[% USE AuthorisedValues %]
[% USE Price %]
[% SET ENABLE_OPAC_PAYMENTS = payment_methods %]
[% SET DISPLAY_PAYMENT_BLOCK = 0 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Your charges &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %]
[% Asset.css("css/datatables.css") | $raw %]
[% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='opac-account' bodyclass='scrollto' %]
[% INCLUDE 'masthead.inc' %]
<div class="main">
<nav aria-label="breadcrumb">
<ul class="breadcrumb">
<li class="breadcrumb-item">
<a href="/cgi-bin/koha/opac-main.pl">Home</a>
</li>
<li class="breadcrumb-item">
<a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
<a href="#">Your charges</a>
</li>
</ul>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col col-lg-2 order-2 order-lg-1">
<div id="navigation">
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
</div>
</div>
<div class="col-md-12 col-lg-10 order-1">
<div id="useraccount" class="maincontent">
<h1>Charges</h1>
[% IF message %]
<div class="alert alert-info">
[% IF message == 'valid_payment' %]
<p>Your payment of $[% message_value | html %] has been processed successfully!</p>
[% ELSIF message == 'duplicate_payment' %]
<p>A payment with the transaction id '[% message_value | html %]' has already been posted to an account.</p>
<p>Please contact a librarian for details.</p>
[% ELSIF message == 'invalid_payment' %]
<p>The transaction id '[% message_value | html %]' for this payment is invalid.</p>
<p>Please contact a librarian for details.</p>
[% END %]
</div>
[% END %]
[% IF payment_error %]
<div id="error" class="alert alert-warning">
<p><strong>Error:</strong> there was a problem processing your payment</p>
</div>
[% ELSIF payment %]
<div class="alert alert-info">
<p><strong>Payment applied:</strong> your payment of [% payment | html %] has been applied to your account</p>
</div>
[% END %]
[% PROCESS 'account-table.inc' ACCOUNT_LINES = ACCOUNT_LINES, ENABLE_OPAC_PAYMENTS = ENABLE_OPAC_PAYMENTS, plugins = plugins %]
</div> <!-- / #useraccount -->
</div> <!-- / .col-10 -->
</div> <!-- / .row -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% INCLUDE 'datatables.inc' %]
<script>
$( document ).ready(function() {
var MSG_MIN_THRESHOLD = _("Minimum amount needed by this service is %s");
var txtActivefilter = _("Filter paid transactions");
var txtInactivefilter = _("Show all transactions");
var fines_table = $("#finestable").dataTable($.extend(true, {}, dataTablesDefaults, {
[% IF ENABLE_OPAC_PAYMENTS %]
"order": [[ 1, "desc" ]],
[% ELSE %]
"order": [[ 0, "desc" ]],
[% END %]
"dom": '<"#filter_p">',
} ));
$("#filter_p").html('<p><a href="#" id="filter_paid"><i class="fa fa-filter" aria-hidden="true"></i> '+txtActivefilter+'</a>');
$('#filter_paid').click(function(e) {
e.preventDefault();
if ($(this).hasClass('filtered')) {
var filteredValue = '';
$(this).html('<i class="fa fa-filter" aria-hidden="true"></i> '+txtActivefilter);
} else { //Not filtered. Let's do it!
var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
$(this).html('<i class="fa fa-filter" aria-hidden="true"></i> '+txtInactivefilter);
}
fines_table.fnFilter(filteredValue, -1, true, false);
$(this).toggleClass('filtered');
});
//Start filtered
$('#filter_paid').click();
$(".pay-online").removeClass("hidden");
$("#amount-to-pay-label").hide();
$(".checkbox-pay, input[name='payment_method']").change( function() {
// Disable the pay button if no fees are selected
//$("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length );
// Calculate the total amount to be paid based on selected fees
var total = 0;
$(".checkbox-pay").each( function() {
if ( $(this).is(":checked") ) {
var id = this.id.split("checkbox-pay-")[1];
total += parseFloat( $("#amount-" + id).val() );
}
});
var p = Promise.resolve();
if ( total ) {
p = Promise.all(
$('input[name="payment_method"]').map(function() {
var self = this;
return new Promise(function(resolve, reject) {
var threshold = $(self).data('threshold');
var help = $(self).parent().siblings('.help-block');
if(!threshold || threshold == '' || threshold <= total) {
$(self).prop('disabled', false);
help.addClass('hide');
} else {
$(self).prop('disabled', true);
help.html(MSG_MIN_THRESHOLD.format(parseInt(threshold,10).toFixed(2))).removeClass('hide');
}
resolve();
})
}).toArray()
);
$("#amount-to-pay").html( total.toFixed(2) );
$("#amount-to-pay-label").show();
} else {
$('input[name="payment_method"]').prop('disabled', false).parent().siblings('.help-block').addClass('hide');
$("#amount-to-pay-label").hide();
}
p.then(function() {
$("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length || ! $('input[name="payment_method"]:checked:not(:disabled)').length);
})
});
});
</script>
[% END %]