From aa47b33d73776f1b93767a4adb33b1f58ffbb366 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 29 Oct 2014 17:08:45 -0400 Subject: [PATCH] KMAIN-593: Move all BiblioCommons related files to opac/biblio/ Cross-port: 67a95ba Conflicts: Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm --- .../var/templates_kcls/opac/biblio/base.tt2 | 20 +++ .../var/templates_kcls/opac/biblio/login.tt2 | 31 ++++ .../var/templates_kcls/opac/biblio/main_fines.tt2 | 184 +++++++++++++++++++ .../var/templates_kcls/opac/biblio/main_pay.tt2 | 72 ++++++++ .../templates_kcls/opac/biblio/main_pay_init.tt2 | 30 ++++ .../opac/biblio/main_payment_form.tt2 | 198 +++++++++++++++++++++ .../templates_kcls/opac/biblio/main_payments.tt2 | 75 ++++++++ .../opac/biblio/main_refund_policy.tt2 | 24 +++ .../templates_kcls/opac/biblio/receipt_email.tt2 | 38 ++++ .../templates_kcls/opac/biblio/receipt_print.tt2 | 25 +++ .../var/templates_kcls/opac/biblio/tester.tt2 | 12 ++ .../var/templates_kcls/opac/biblio/topnav_logo.tt2 | 2 + .../src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 40 +++-- .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 2 +- 14 files changed, 741 insertions(+), 12 deletions(-) create mode 100644 KCLS/openils/var/templates_kcls/opac/biblio/base.tt2 create mode 100644 KCLS/openils/var/templates_kcls/opac/biblio/login.tt2 create mode 100644 KCLS/openils/var/templates_kcls/opac/biblio/main_fines.tt2 create mode 100644 KCLS/openils/var/templates_kcls/opac/biblio/main_pay.tt2 create mode 100644 KCLS/openils/var/templates_kcls/opac/biblio/main_pay_init.tt2 create mode 100644 KCLS/openils/var/templates_kcls/opac/biblio/main_payment_form.tt2 create mode 100644 KCLS/openils/var/templates_kcls/opac/biblio/main_payments.tt2 create mode 100644 KCLS/openils/var/templates_kcls/opac/biblio/main_refund_policy.tt2 create mode 100644 KCLS/openils/var/templates_kcls/opac/biblio/receipt_email.tt2 create mode 100644 KCLS/openils/var/templates_kcls/opac/biblio/receipt_print.tt2 create mode 100644 KCLS/openils/var/templates_kcls/opac/biblio/tester.tt2 create mode 100644 KCLS/openils/var/templates_kcls/opac/biblio/topnav_logo.tt2 diff --git a/KCLS/openils/var/templates_kcls/opac/biblio/base.tt2 b/KCLS/openils/var/templates_kcls/opac/biblio/base.tt2 new file mode 100644 index 0000000000..99b2565e02 --- /dev/null +++ b/KCLS/openils/var/templates_kcls/opac/biblio/base.tt2 @@ -0,0 +1,20 @@ + + + + + [% IF ctx.refresh %] + + [% ELSIF ctx.authtime %] + + [% END %] + + + [% l('BiblioCommons E-Commerce - KCLS') %] + + [% INCLUDE 'opac/parts/goog_analytics.tt2' %] + + + [% INCLUDE 'opac/parts/js.tt2' %] + [% content %] + + diff --git a/KCLS/openils/var/templates_kcls/opac/biblio/login.tt2 b/KCLS/openils/var/templates_kcls/opac/biblio/login.tt2 new file mode 100644 index 0000000000..64b28a082f --- /dev/null +++ b/KCLS/openils/var/templates_kcls/opac/biblio/login.tt2 @@ -0,0 +1,31 @@ +[% + PROCESS "opac/parts/header.tt2"; + PROCESS "opac/parts/misc_util.tt2"; + WRAPPER "opac/biblio/base.tt2"; + + ctx.page_title = l("Account Login") %] + +
+
+ [% INCLUDE "opac/parts/login/form.tt2" %] +
+ +
+
+[% END %] diff --git a/KCLS/openils/var/templates_kcls/opac/biblio/main_fines.tt2 b/KCLS/openils/var/templates_kcls/opac/biblio/main_fines.tt2 new file mode 100644 index 0000000000..c800fc3fd1 --- /dev/null +++ b/KCLS/openils/var/templates_kcls/opac/biblio/main_fines.tt2 @@ -0,0 +1,184 @@ + +[% + PROCESS "opac/parts/misc_util.tt2"; + WRAPPER "opac/biblio/base.tt2"; + PROCESS "opac/parts/header.tt2"; + myopac_page = "main"; + myopac_main_page = "main"; +%] + +
+
+ + + + +
+
+ +
+ [% IF ctx.fines.circulation.size > 0 %] +
+ + + + + + + + + + + + + + + + + [% FOR f IN ctx.fines.circulation; + NEXT IF f.xact.balance_owed < 0; # XXX middle layer + attrs = {marc_xml => f.marc_xml}; + IF f.marc_xml; + PROCESS get_marc_attrs args=attrs; + ELSIF f.xact.reservation; + attrs.title = f.xact.reservation.target_resource_type.name; + END %] + + + + + + + + + + [% END %] + +
+ [% l("Fines") %] +
[% l("Title") %][% l("Author") %][% l("Checkout Date") %][% l("Due Date") %][% l("Date Returned") %][% l("Balance Owed") %] + + +
+ [% attrs.title | html %] + + [% attrs.author | html %] + + [% ts = f.xact.circulation.xact_start || f.xact.reservation.start_time || 0; + IF ts; + date.format(ctx.parse_datetime(ts), DATE_FORMAT); + END %] + + [% ts = f.xact.circulation.due_date || f.xact.reservation.end_time || 0; + IF ts; + date.format(ctx.parse_datetime(ts), DATE_FORMAT); + END %] + + [% ts = f.xact.circulation.checkin_time || f.xact.reservation.return_time || 0; + IF ts; + date.format(ctx.parse_datetime(ts), DATE_FORMAT); + ELSE %] + + [% l('(fines accruing)') %] + [% END %] + + + [% money(f.xact.balance_owed) %] + + + +
+
+ [% END %] + + [% IF ctx.fines.grocery.size > 0 %] + +
+
+
+
+ + + + + + + + + + + + + + + + + [% FOR f IN ctx.fines.grocery %] + [% NEXT IF f.xact.balance_owed < 0 %] + + + + + + + + + + [% END %] + +
+ [% l("Other Fees") %] +
[% l("Transaction Start Time") %][% l("Last Payment Time") %][% l("Initial Amount Owed") %][% l("Total Amount Paid") %][% l("Balance Owed") %][% l("Billing Type") %] + + +
[% date.format( + ctx.parse_datetime(f.xact.xact_start), + DATE_FORMAT + ) %] + [% IF f.xact.last_payment_ts; + date.format( + ctx.parse_datetime( + f.xact.last_payment_ts + ), DATE_FORMAT + ); + END %] + [% money(f.xact.total_owed) %][% money(f.xact.total_paid) %] + + [% money(f.xact.balance_owed) %] + + [% f.xact.last_billing_type %] + +
+
+ [% END %] + [% UNLESS ctx.fines.grocery.size OR ctx.fines.circulation.size %] +
[% l('You have no current fines.') %]
+ [% ELSE %] +
+ +
+ [% END %] +
+[% END %] diff --git a/KCLS/openils/var/templates_kcls/opac/biblio/main_pay.tt2 b/KCLS/openils/var/templates_kcls/opac/biblio/main_pay.tt2 new file mode 100644 index 0000000000..617d69df79 --- /dev/null +++ b/KCLS/openils/var/templates_kcls/opac/biblio/main_pay.tt2 @@ -0,0 +1,72 @@ +[% + WRAPPER "opac/biblio/base.tt2"; + PROCESS "opac/parts/header.tt2"; +%] + + +
+
+ + + + +
+
+ +
+ + [% IF ctx.payment_response.textcode %] +
+ + [% ctx.payment_response.desc || ctx.payment_response.textcode %] +
+ [% ctx.payment_response.note %] + [% ctx.payment_response.payload.error_message %] +
+

+ [% + url_args = {xact => [], xact_misc => []}; + FOR k IN ['xact', 'xact_misc']; + FOR val IN CGI.param(k); + url_args.$k.push(val); + END; + END; + retry_url = mkurl(ctx.opac_root _ '/biblio/main_payment_form', url_args, 1); + %] +
+ [% l('Go back') %] + [% l('to try again or to cancel this payment attempt.') %] +

+ [% ELSE %] +

[% l('Your payment has been approved.') %]

+ [% IF ctx.printable_receipt.template_output; + print_args = []; + FOR p IN ctx.payment_response.payments; + print_args.push('payment=' _ p); + END %] +

[ [% l('Print receipt') %] ]

+ + [% ctx.printable_receipt.template_output.data %] + + [% ELSE %] +
+ [% l( + 'Error creating receipt: [_1]', + (ctx.printable_receipt.textcode ? ctx.printable_receipt.textcode _ ' / ' _ ctx.printable_receipt.desc : 0) || + ctx.printable_receipt.error_output.data || + l('No receipt data returned from server') + ) | html %] +
+ [% END %] +

[ [% + l("Back to Account Summary") %] ]

+ [% END %] +
+[% END %] diff --git a/KCLS/openils/var/templates_kcls/opac/biblio/main_pay_init.tt2 b/KCLS/openils/var/templates_kcls/opac/biblio/main_pay_init.tt2 new file mode 100644 index 0000000000..6cb82e0018 --- /dev/null +++ b/KCLS/openils/var/templates_kcls/opac/biblio/main_pay_init.tt2 @@ -0,0 +1,30 @@ +[% + WRAPPER "opac/biblio/base.tt2"; + PROCESS "opac/parts/header.tt2"; +%] + + +
+
+ + + + +
+
+ +
+ +
+ [% l('Processing...') %]

+ [% l('Processing your payment may take some time.') %]
+ [% l("Please do not Refresh or use your browser's Back button or your credit card may be charged more than once.") %]
+
+ +
+[% END %] diff --git a/KCLS/openils/var/templates_kcls/opac/biblio/main_payment_form.tt2 b/KCLS/openils/var/templates_kcls/opac/biblio/main_payment_form.tt2 new file mode 100644 index 0000000000..97dd7e4d31 --- /dev/null +++ b/KCLS/openils/var/templates_kcls/opac/biblio/main_payment_form.tt2 @@ -0,0 +1,198 @@ +[% + PROCESS "opac/parts/header.tt2"; + PROCESS "opac/parts/misc_util.tt2"; + WRAPPER "opac/biblio/base.tt2"; + last_chance = CGI.param("last_chance"); +%] + +
+
+ + +
+
+ +[% IF ctx.fines.balance_owed <= 0 %] +
+ [% l("You either have no fines to pay or you have selected fines whose " _ + "total is non-positive. We cannot process non-positive amounts.") %] +
+[% ELSE %] +
+ [% IF last_chance %] +

[% l("Are you sure you are ready to charge [_1] to your credit card?", money(ctx.fines.balance_owed)) %]

+
+ [% FOR k IN CGI.Vars; + NEXT UNLESS k; + FOR val IN CGI.param(k) %] + + [% END; END %] + + [% l('Cancel') %] + [% ELSE %] + + + [% FOR xact IN CGI.param('xact') %] + + [% END %] + [% FOR xact IN CGI.param('xact_misc') %] + + [% END %] + +
+

[% l('KCLS only accepts Visa or MasterCard') %]

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [% INCLUDE "opac/biblio/main_refund_policy.tt2" %] + +
[% l('Billing Information') %] +

[% l('Selected fines you are paying for:') %]

+ + + + + + + + + [% + FOR f IN ctx.fines.circulation; + NEXT IF CGI.param('xact').size && + !CGI.param('xact').grep(f.xact.id).size; + attrs = {marc_xml => f.marc_xml}; + IF f.marc_xml; + PROCESS get_marc_attrs args=attrs; + ELSIF f.xact.reservation; + attrs.title = f.xact.reservation.target_resource_type.name; + END %] + + + + + [% + END; + FOR f IN ctx.fines.grocery; + NEXT IF CGI.param('xact_misc').size && + !CGI.param('xact_misc').grep(f.xact.id).size %] + + + + + [% END %] + +
[% l('Name') %][% l('Amount') %]
[% attrs.title | html %][% money(f.xact.balance_owed) %]
[% f.xact.last_billing_type | html %][% money(f.xact.balance_owed) %]
+
+
+ [% l('Total amount to pay:') %] + [% money(ctx.fines.balance_owed) %] +
+
+ [% | l('', '') %]Click [_1]Cancel[_2] to go back and (un)select other fines.[% END %] +
[% l('First Name') %]
[% l('Last Name') %]
[% l('Email Address') %] + +
[% l('Street Address') %]
[% l('City' )%]
[% l('State or Province') %]
[% l('ZIP or Postal Code') %]
[% l('Credit Card Information') %]
[% l('Credit Card #') %]
[% l('Security Code') %] + +
[% l('Expiration Month') %] + +
[% l('Expiration Year') %] + +
+ + [% l('Cancel') %] +
+ [% END %] +
+
+ +[% END %] +[% END %] diff --git a/KCLS/openils/var/templates_kcls/opac/biblio/main_payments.tt2 b/KCLS/openils/var/templates_kcls/opac/biblio/main_payments.tt2 new file mode 100644 index 0000000000..3d85505e77 --- /dev/null +++ b/KCLS/openils/var/templates_kcls/opac/biblio/main_payments.tt2 @@ -0,0 +1,75 @@ +[% + WRAPPER "opac/biblio/base.tt2"; + PROCESS "opac/parts/header.tt2"; + limit = ctx.payment_history_limit; + offset = ctx.payment_history_offset; +%] + +
+
+ + + + +
+
+ +
+
+ [% l('Payments History') %] + + + [%# TODO: get total to prevent paging off then end of the list.. %] + + +
+
+ + [% IF ctx.payments.size %] + + + + + + + + + [% FOR payment IN ctx.payments %] + [% IF payment.mp.amount > 0 %] + + + + + + + [% END %] + [% END %] + +
[% l('Payment Date') %][% l('Payment For') %][% l('Amount') %][% l('Receipt') %]
[% date.format(ctx.parse_datetime(payment.mp.payment_ts), DATE_FORMAT) %][% + btype = payment.last_billing_type | html; + ptitle = payment.title | html; + (payment.xact_type == 'grocery') ? btype : ptitle + %][% money(payment.mp.amount) %] + [% IF payment.mp.payment_type == 'credit_card_payment' %] +
+ + +
+
+ + +
+ [% END %] +
+ [% ELSE %] +
[% l('You have no historical payments to display.') %]
+ [% END %] +
+[% END %] diff --git a/KCLS/openils/var/templates_kcls/opac/biblio/main_refund_policy.tt2 b/KCLS/openils/var/templates_kcls/opac/biblio/main_refund_policy.tt2 new file mode 100644 index 0000000000..0a22d817a6 --- /dev/null +++ b/KCLS/openils/var/templates_kcls/opac/biblio/main_refund_policy.tt2 @@ -0,0 +1,24 @@ + + +
+ + Important! You must have a printed receipt to be + eligible for a refund on lost items (regulations allow + for no exceptions). + +
+
+ + To ensure you have the necessary documentation if a refund is wanted, + make certain you have a printed receipt in hand before closing the payment receipt screen. + +
+ Refunds are not available for parts and pieces, overdue + fines, or items that do not display a specific title in + My Account. For a full list of refundable and + non-refundable items, visit + http://www.kcls.org/usingthelibrary/borrowing/refundable.cfm

+ This site uses VeriSign SSL encryption to ensure your + privacy. + + diff --git a/KCLS/openils/var/templates_kcls/opac/biblio/receipt_email.tt2 b/KCLS/openils/var/templates_kcls/opac/biblio/receipt_email.tt2 new file mode 100644 index 0000000000..33d3e073ae --- /dev/null +++ b/KCLS/openils/var/templates_kcls/opac/biblio/receipt_email.tt2 @@ -0,0 +1,38 @@ +[% + WRAPPER "opac/biblio/base.tt2"; + PROCESS "opac/parts/header.tt2"; +%] + +
+
+ + + + +
+
+
+ [% IF ctx.email_receipt_result; # result should be undef on success %] +
+ [% l('Error preparing receipt:') %] + + [% ctx.email_receipt_result.desc | html %] + +
+ [% ELSE %] +
+ [% l('Your receipt will be emailed to [_1]', ctx.user.email) | html %] +
+ [% END %] +

+ [ [%l("Back to Payments History") %] ] + [ [%l("Close Page") %] ] +

+
+ +[% END %] diff --git a/KCLS/openils/var/templates_kcls/opac/biblio/receipt_print.tt2 b/KCLS/openils/var/templates_kcls/opac/biblio/receipt_print.tt2 new file mode 100644 index 0000000000..5ae9cd368b --- /dev/null +++ b/KCLS/openils/var/templates_kcls/opac/biblio/receipt_print.tt2 @@ -0,0 +1,25 @@ +[%# sic! no wrapper %] + + + [% l('Receipt') %] + + + [% IF ctx.printable_receipt.template_output %] + + [% ctx.printable_receipt.template_output.data %] + + [% ELSE %] +
+ [% l( + 'Error preparing receipt: [_1]', + (ctx.printable_receipt.textcode ? ctx.printable_receipt.textcode _ ' / ' _ ctx.printable_receipt.desc : 0) || + ctx.printable_receipt.error_output.data || + l('No receipt data returned from server') + ) | html %] +
+ [% END %] +
+

[ [%l("Back to Payments History") %] ] [ [%l("Close Page") %] ]

+ + + diff --git a/KCLS/openils/var/templates_kcls/opac/biblio/tester.tt2 b/KCLS/openils/var/templates_kcls/opac/biblio/tester.tt2 new file mode 100644 index 0000000000..13b282dac0 --- /dev/null +++ b/KCLS/openils/var/templates_kcls/opac/biblio/tester.tt2 @@ -0,0 +1,12 @@ +

biblio/main_payments

+ +

biblio/main_fines

+ \ No newline at end of file diff --git a/KCLS/openils/var/templates_kcls/opac/biblio/topnav_logo.tt2 b/KCLS/openils/var/templates_kcls/opac/biblio/topnav_logo.tt2 new file mode 100644 index 0000000000..e69de08f6f --- /dev/null +++ b/KCLS/openils/var/templates_kcls/opac/biblio/topnav_logo.tt2 @@ -0,0 +1,2 @@ + [% l('KCLS Logo') %] diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index e93d94ca05..7bfb8633cd 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -182,6 +182,20 @@ sub load { ) ); } + + if($path =~ m|opac/biblio/login|) { + return $self->load_login unless $self->editor->requestor; # already logged in? + + # This will be less confusing to users than to be shown a login form + # when they're already logged in. + return $self->generic_redirect( + sprintf( + "%s://%s%s/myopac/main", + $self->ctx->{proto}, + $self->ctx->{hostname}, $self->ctx->{opac_root} + ) + ); + } if ($path =~ m|opac/sms_cn| and !$self->editor->requestor) { my $org_unit = $self->ctx->{physical_loc} || $self->cgi->param('loc') || $self->ctx->{aou_tree}->()->id; @@ -211,18 +225,11 @@ sub load { return $self->load_myopac_messages if $path =~ m|opac/myopac/messages|; return $self->load_myopac_payment_form if $path =~ m|opac/myopac/main_payment_form|; return $self->load_myopac_payments if $path =~ m|opac/myopac/main_payments|; - return $self->load_myopac_payment_form if $path =~ m|opac/myopac/biblio_main_payment_form|; - return $self->load_myopac_payments if $path =~ m|opac/myopac/biblio_main_payments|; - return $self->load_myopac_main if $path =~ m|opac/myopac/biblio_main_fines|; - return $self->biblio_load_myopac_pay_init if $path =~ m|opac/myopac/biblio_main_pay_init|; - return $self->load_myopac_pay if $path =~ m|opac/myopac/biblio_main_pay|; return $self->load_myopac_pay_init if $path =~ m|opac/myopac/main_pay_init|; return $self->load_myopac_pay if $path =~ m|opac/myopac/main_pay|; return $self->load_myopac_main if $path =~ m|opac/myopac/main|; return $self->load_myopac_receipt_email if $path =~ m|opac/myopac/receipt_email|; - return $self->load_myopac_receipt_email if $path =~ m|opac/myopac/biblio_receipt_email|; return $self->load_myopac_receipt_print if $path =~ m|opac/myopac/receipt_print|; - return $self->load_myopac_receipt_print if $path =~ m|opac/myopac/biblio_receipt_print|; return $self->load_myopac_update_email if $path =~ m|opac/myopac/update_email|; return $self->load_myopac_update_password if $path =~ m|opac/myopac/update_password|; return $self->load_myopac_update_username if $path =~ m|opac/myopac/update_username|; @@ -237,6 +244,15 @@ sub load { return $self->load_myopac_prefs_my_lists if $path =~ m|opac/myopac/prefs_my_lists|; return $self->load_myopac_prefs if $path =~ m|opac/myopac/prefs|; return $self->load_sms_cn if $path =~ m|opac/sms_cn|; + + #BiblioCommons E-Commerce Screens + return $self->load_myopac_payment_form if $path =~ m|opac/biblio/main_payment_form|; + return $self->load_myopac_payments if $path =~ m|opac/biblio/main_payments|; + return $self->biblio_load_myopac_pay_init if $path =~ m|opac/biblio/main_pay_init|; + return $self->load_myopac_main if $path =~ m|opac/biblio/main_fines|; + return $self->load_myopac_pay if $path =~ m|opac/biblio/main_pay|; + return $self->load_myopac_receipt_email if $path =~ m|opac/biblio/receipt_email|; + return $self->load_myopac_receipt_print if $path =~ m|opac/biblio/receipt_print|; return Apache2::Const::OK; } @@ -260,10 +276,12 @@ sub redirect_auth { my $login_page = sprintf('%s://%s%s/login',($self->ctx->{is_staff} ? 'oils' : 'https'), $self->ctx->{hostname}, $self->ctx->{opac_root}); my $redirect_to = uri_escape_utf8($self->apache->unparsed_uri); - if ($redirect_to =~ m/biblio_main_fines/ || $redirect_to =~ m/biblio_main_payment/){ - $login_page .= '_fines'; - } - + if ($redirect_to =~ m/biblio%2Fmain_fines/ || $redirect_to =~ m/biblio%2Fmain_payment/){ + $login_page = sprintf('%s://%s%s/biblio/login', + ($self->ctx->{is_staff} ? 'oils' : 'https'), + $self->ctx->{hostname}, $self->ctx->{opac_root}); + } + return $self->generic_redirect("$login_page?redirect_to=$redirect_to"); } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 7280675b3b..e0ddbd20ae 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -1945,7 +1945,7 @@ sub biblio_load_myopac_pay_init { # transactions we were processing, so the UI can bring the user back # to the payment form w/ the same xacts if the payment fails. - my $refresh = "1; url=biblio_main_pay/$token?xact=" . pop(@payment_xacts); + my $refresh = "1; url=main_pay/$token?xact=" . pop(@payment_xacts); $refresh .= ";xact=$_" for @payment_xacts; $self->ctx->{refresh} = $refresh; -- 2.11.0