Bug 38714: sco/sco-main.tt

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2025-01-13 13:51:23 +01:00 committed by Katrin Fischer
parent ec640b81d5
commit 69d56d1859
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 251 additions and 216 deletions

View File

@ -57,228 +57,28 @@
[% INCLUDE 'masthead-sco.inc' %]
<div class="main">
<div class="container-fluid">
<div class="row">
[% IF ( display_patron_image ) %]
<div class="col-10 order-first order-md-first order-lg-2">
[% SET main_div_class = 'col-10 order-first order-md-first order-lg-2' %]
[% ELSE %]
<div class="col order-first order-md-first order-lg-2">
[% SET main_div_class = 'col order-first order-md-first order-lg-2' %]
[% END %]
[% UNLESS ( hide_main ) %]
[% IF ( validuser ) %]
<div class="container-fluid">
<div class="row">
<div class="[% main_div_class | html %]">
<div id="masthead"><h1>[% LibraryName | html %] Self checkout system</h1></div>
[% FOREACH item IN impossible %]<!-- We tried to issue, but failed. -->
<div class="alert alert-warning">
<span class="sco-alert-warning noissue"></span>
<h2>Item cannot be checked out.</h2>
<p>Sorry, this item cannot be checked out at this station.</p>
[% IF ( item.title ) %]
<p>Title: <em>[% item.title | html %]</em> </p>
[% PROCESS display_errors %]
<div class="alert alert-info">You are logged in as [% borrowername | html %].</div>
[% INCLUDE 'opac-note.inc' sco="true" %]
[% IF patron_has_hold_fee %]
<div class="alert alert-warning">A hold fee was charged to your account for collecting this item.</div>
[% END %]
<p>
[% IF ( item.circ_error_UNKNOWN_BARCODE ) %]
<span id="ce_unknown_barcode">The system does not recognize this barcode.</span>
[% ELSIF ( item.circ_error_max_loans_allowed ) %]
<span id="ce_max_loans_allowed">You have reached the maximum limit of items checked out.</span>
[% ELSIF ( item.circ_error_ISSUED_TO_ANOTHER ) %]
<span id="ce_issued_to_another">This item is checked out to someone else.</span>
[% ELSIF ( item.circ_error_NO_MORE_RENEWALS ) %]
<span id="ce_no_more_renewals">You cannot renew this item again.</span>
[% ELSIF ( item.circ_error_NOT_FOR_LOAN ) %]
<span id="ce_not_for_loan">This item is not for loan.</span>
[% ELSIF ( item.circ_error_DEBT ) %]
<span id="ce_too_much_debt">You owe the library [% item.DEBT | $Price with_symbol => 1%] and cannot check out.</span>
[% ELSIF ( item.circ_error_WTHDRAWN ) %]
<span id="ce_wthdrawn">This item has been withdrawn from the collection.</span>
[% ELSIF ( item.circ_error_RESTRICTED ) %]
<span id="ce_restricted">This item is restricted.</span>
[% ELSIF ( item.circ_error_RESERVED ) %]
<span id="ce_reserved">This item is on hold for another patron.</span>
[% ELSIF ( item.circ_error_ITEMNOTSAMEBRANCH ) %]
<span id="ce_itemnotsamebranch">This item belongs to another library.</span>
[% ELSIF ( item.circ_error_EXPIRED ) %]
<span id="ce_expired">Your account has expired.</span>
[% ELSIF ( item.circ_error_DEBARRED ) %]
<span id="ce_debarred">Your account has been suspended.</span>
[% ELSIF ( item.circ_error_CARD_LOST ) %]
<span id="ce_card_lost">This library card has been declared lost.</span>
[% ELSIF ( item.circ_error_GNA ) %]
<span id="ce_gna">Your contact information seems to be incomplete.</span>
[% ELSIF ( item.circ_error_INVALID_DATE ) %]
<span id="ce_invalid_date">Due date is not valid.</span>
[% ELSIF ( item.circ_error_ADDITIONAL_MATERIALS ) %]
<span id="ce_addtional_materials">Item must be checked out at a circulation desk.</span>
[% END %]
<span id ="ce_see_staff">Please see a member of the library staff.</span>
</p>
[% IF ( item.returnitem && Koha.Preference('SCOAllowCheckin') ) %]
<form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
[% INCLUDE 'csrf-token.inc' %]
<legend class="sr-only">Return</legend>
<input type="hidden" name="op" value="cud-returnbook" />
<input type="hidden" name="patronid" value="[% patronid | html %]" />
<input type="hidden" name="barcode" value="[% item.barcode | html %]" />
<input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
<input type="hidden" name="newissues" value="[% newissues | html %]" />
<button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
</form>
[% END %]
<form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="get">
<legend class="sr-only">Error</legend>
<input type="hidden" name="op" value="" />
<input type="hidden" name="patronid" value="[% patronid | html %]" />
<input type="hidden" name="barcode" value="[% item.barcode | html %]" />
<input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
<input type="hidden" name="newissues" value="[% newissues | html %]" />
<input type="submit" name= "confirm" value="Return to account summary" class="btn btn-info back focus" />
</form>
</div> <!-- / .alert -->
[% END # / FOREACH impossible %]
[% FOREACH c IN confirm %]<!-- We need to confirm the issue.. -->
<div class="alert alert-warning"><h2>Please confirm the checkout:</h2>
<span class="sco-alert-warning confirm"></span>
[% IF ( c.confirm_renew_issue ) %]
<p>This item is already checked out to you: <b>[% c.confirm | html %]</b> <i>([% c.barcode | html %])</i></p>
[% END %]
[% IF ( c.renew && Koha.Preference('SCOAllowCheckin') ) %]
<form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
[% INCLUDE 'csrf-token.inc' %]
<legend class="sr-only">Return</legend>
<input type="hidden" name="op" value="cud-returnbook" />
<input type="hidden" name="patronid" value="[% patronid | html %]" />
<input type="hidden" name="barcode" value="[% c.barcode | html %]" />
<input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
<input type="hidden" name="confirmed" value="" />
<input type="hidden" name="newissues" value="[% newissues | html %]" />
<button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
</form>
[% END %]
[% UNLESS ( c.renew ) %]
<form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
[% INCLUDE 'csrf-token.inc' %]
<legend class="sr-only">Renew</legend>
<input type="hidden" name="op" value="cud-renew" />
<input type="hidden" name="patronid" value="[% patronid | html %]" />
<input type="hidden" name="barcode" value="[% c.barcode | html %]" />
<input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
<input type="hidden" name="confirmed" value="1" />
<input type="hidden" name="newissues" value="[% newissues | html %]" />
<button type="submit" name="confirm" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
</form>
[% ELSE %]
<form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
[% INCLUDE 'csrf-token.inc' %]
<legend class="sr-only">Renew</legend>
<input type="hidden" name="op" value="cud-renew" />
<input type="hidden" name="patronid" value="[% patronid | html %]" />
<input type="hidden" name="barcode" value="[% c.barcode | html %]" />
<input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
<input type="hidden" name="confirmed" value="1" />
<input type="hidden" name="newissues" value="[% newissues | html %]" />
<button type="submit" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
</form>
[% END %]
<form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="get">
<legend class="sr-only">Cancel</legend>
<input type="hidden" name="op" value="" />
<input type="hidden" name="patronid" value="[% patronid | html %]" />
<input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
<input type="hidden" name="newissues" value="[% newissues | html %]" />
<button type="submit" class="btn btn-primary"><i class="fa fa-cancel" aria-hidden="true"></i> Cancel</button>
</form>
</div>
[% END # / FOREACH confirm %]
[% IF ( nopermission ) %]
<!-- This is what is displayed if user doesn't have permission -->
<div class="alert alert-warning">
<span class="sco-alert-warning nopermission"></span>
<h2>Access denied</h2>
<p>Sorry, this self-checkout station has lost authentication. Please contact the administrator to resolve this problem.</p>
</div>
[% END %]
[% IF ( different_ip ) %]
<!-- This is what is displayed if user doesn't have permission -->
<div class="alert alert-warning">
<span class="sco-alert-warning sessionlost"></span>
<h2>Session lost</h2>
<p>You are accessing self-checkout from a different IP address! please log in again.</p>
</div>
[% END %]
[% IF ( invalid_username_or_password ) %]
<!-- This is what is displayed if user doesn't have permission -->
<div class="alert alert-warning">
<span class="sco-alert-warning notfound"></span>
<h2>Record not found</h2>
<p>Your userid was not found in the database. Please try again.</p>
</div>
[% END %]
[% IF ( issued ) %]
[% IF batch_checkouts_allowed %]
[% FOREACH barcode IN newissues.split(',') %]
<span class="sco-alert-success issue"></span>
<div class="alert alert-info">
<p>Item checked out <i>([% barcode | html %])</i></p>
</div>
[% END %]
[% ELSE %]
<span class="sco-alert-success issue"></span>
<div class="alert alert-info">
<p>Item checked out <i>([% newissues.split(',').last | html %])</i></p>
</div>
[% END %]
[% ELSIF ( renewed ) %]
<span class="sco-alert-success renew"></span>
<div class="alert alert-info">
<p>Item renewed <i>([% barcode | html %])</i></p>
</div>
[% ELSIF ( renewed == 0) %]
<span class="sco-alert-warning renew"></span>
<div class="alert alert-info">
<p>Item not renewed</p>
</div>
[% ELSIF ( returned == 0 ) %]
<span class="sco-alert-warning return"></span>
<div class="alert alert-info">
<p>Item not checked in: please see circulation staff for assistance</p>
</div>
[% ELSIF ( returned == 1 ) %]
<span class="sco-alert-success return"></span>
<div class="alert alert-info">
<p>Item checked in <i>([% barcode | html %])</i></p>
</div>
[% END %]
[% UNLESS ( hide_main ) %]
[% IF ( patronid ) %]
[% IF ( validuser ) %]
<div class="alert alert-info">You are logged in as [% borrowername | html %].</div>
[% INCLUDE 'opac-note.inc' sco="true" %]
[% IF patron_has_hold_fee %]
<div class="alert alert-warning">A hold fee was charged to your account for collecting this item.</div>
[% END %]
[% END %]
[% IF ( nouser ) %]
<div class="alert alert-warning">
<h3>Sorry</h3>
<p>The userid <strong>[% patronid | html %]</strong> was not found in the database. Please try again.</p>
</div>
[% END %]
[% END # / IF patronid %]
[% IF ( validuser ) %]
<div id="newcheckout" class="sco_entry">
<form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl">
[% INCLUDE 'csrf-token.inc' %]
@ -475,8 +275,31 @@
[% END # /WRAPPER tab_panels %]
[% END # /WRAPPER tabs %]
[% IF ( SCOMainUserBlock ) %]
<div id="scomainuserblock">
[% PROCESS koha_news_block news => SCOMainUserBlock %]
</div>
[% END %]
</div> <!-- / .span12 -->
</div> <!-- / .row -->
</div> <!-- / .container-fluid -->
[% ELSE # IF validuser %]
<div class="container-fluid">
<div class="row">
<div class="[% main_div_class | html %]">
<div id="masthead"><h1>[% LibraryName | html %] Self checkout system</h1></div>
[% PROCESS display_errors %]
[% IF patronid && nouser %]
<div class="alert alert-warning">
<h3>Sorry</h3>
<p>The userid <strong>[% patronid | html %]</strong> was not found in the database. Please try again.</p>
</div>
[% END %]
<div class="sco_entry" >
<form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
[% INCLUDE 'csrf-token.inc' %]
@ -524,8 +347,6 @@
</fieldset>
</form> <!-- /#mainform -->
</div> <!-- / .sco_entry -->
[% END # / IF validuser %]
[% END # / UNLESS ( hide_main %]
[% IF ( SCOMainUserBlock ) %]
<div id="scomainuserblock">
[% PROCESS koha_news_block news => SCOMainUserBlock %]
@ -534,6 +355,26 @@
</div> <!-- / .span12 -->
</div> <!-- / .row -->
</div> <!-- / .container-fluid -->
[% END # / IF validuser %]
[% ELSE # / UNLESS ( hide_main %]
<div class="container-fluid">
<div class="row">
<div class="[% main_div_class | html %]">
<div id="masthead"><h1>[% LibraryName | html %] Self checkout system</h1></div>
[% PROCESS display_errors %]
[% IF ( SCOMainUserBlock ) %]
<div id="scomainuserblock">
[% PROCESS koha_news_block news => SCOMainUserBlock %]
</div>
[% END %]
</div> <!-- / .span12 -->
</div> <!-- / .row -->
</div> <!-- / .container-fluid -->
[% END # / UNLESS ( hide_main %]
</div> <!-- / .main -->
<span id="audio-alert"></span>
@ -666,3 +507,197 @@
[% IF ( Koha.Preference('SCOUserJS') ) %]<script>[% Koha.Preference('SCOUserJS') | $raw %]</script>[% END %]
[% END %]
[% BLOCK display_errors %]
[% FOREACH item IN impossible %]<!-- We tried to issue, but failed. -->
<div class="alert alert-warning">
<span class="sco-alert-warning noissue"></span>
<h2>Item cannot be checked out.</h2>
<p>Sorry, this item cannot be checked out at this station.</p>
[% IF ( item.title ) %]
<p>Title: <em>[% item.title | html %]</em> </p>
[% END %]
<p>
[% IF ( item.circ_error_UNKNOWN_BARCODE ) %]
<span id="ce_unknown_barcode">The system does not recognize this barcode.</span>
[% ELSIF ( item.circ_error_max_loans_allowed ) %]
<span id="ce_max_loans_allowed">You have reached the maximum limit of items checked out.</span>
[% ELSIF ( item.circ_error_ISSUED_TO_ANOTHER ) %]
<span id="ce_issued_to_another">This item is checked out to someone else.</span>
[% ELSIF ( item.circ_error_NO_MORE_RENEWALS ) %]
<span id="ce_no_more_renewals">You cannot renew this item again.</span>
[% ELSIF ( item.circ_error_NOT_FOR_LOAN ) %]
<span id="ce_not_for_loan">This item is not for loan.</span>
[% ELSIF ( item.circ_error_DEBT ) %]
<span id="ce_too_much_debt">You owe the library [% item.DEBT | $Price with_symbol => 1%] and cannot check out.</span>
[% ELSIF ( item.circ_error_WTHDRAWN ) %]
<span id="ce_wthdrawn">This item has been withdrawn from the collection.</span>
[% ELSIF ( item.circ_error_RESTRICTED ) %]
<span id="ce_restricted">This item is restricted.</span>
[% ELSIF ( item.circ_error_RESERVED ) %]
<span id="ce_reserved">This item is on hold for another patron.</span>
[% ELSIF ( item.circ_error_ITEMNOTSAMEBRANCH ) %]
<span id="ce_itemnotsamebranch">This item belongs to another library.</span>
[% ELSIF ( item.circ_error_EXPIRED ) %]
<span id="ce_expired">Your account has expired.</span>
[% ELSIF ( item.circ_error_DEBARRED ) %]
<span id="ce_debarred">Your account has been suspended.</span>
[% ELSIF ( item.circ_error_CARD_LOST ) %]
<span id="ce_card_lost">This library card has been declared lost.</span>
[% ELSIF ( item.circ_error_GNA ) %]
<span id="ce_gna">Your contact information seems to be incomplete.</span>
[% ELSIF ( item.circ_error_INVALID_DATE ) %]
<span id="ce_invalid_date">Due date is not valid.</span>
[% ELSIF ( item.circ_error_ADDITIONAL_MATERIALS ) %]
<span id="ce_addtional_materials">Item must be checked out at a circulation desk.</span>
[% END %]
<span id ="ce_see_staff">Please see a member of the library staff.</span>
</p>
[% IF ( item.returnitem && Koha.Preference('SCOAllowCheckin') ) %]
<form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
[% INCLUDE 'csrf-token.inc' %]
<legend class="sr-only">Return</legend>
<input type="hidden" name="op" value="cud-returnbook" />
<input type="hidden" name="patronid" value="[% patronid | html %]" />
<input type="hidden" name="barcode" value="[% item.barcode | html %]" />
<input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
<input type="hidden" name="newissues" value="[% newissues | html %]" />
<button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
</form>
[% END %]
<form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="get">
<legend class="sr-only">Error</legend>
<input type="hidden" name="op" value="" />
<input type="hidden" name="patronid" value="[% patronid | html %]" />
<input type="hidden" name="barcode" value="[% item.barcode | html %]" />
<input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
<input type="hidden" name="newissues" value="[% newissues | html %]" />
<input type="submit" name= "confirm" value="Return to account summary" class="btn btn-info back focus" />
</form>
</div> <!-- / .alert -->
[% END # / FOREACH impossible %]
[% FOREACH c IN confirm %]<!-- We need to confirm the issue.. -->
<div class="alert alert-warning"><h2>Please confirm the checkout:</h2>
<span class="sco-alert-warning confirm"></span>
[% IF ( c.confirm_renew_issue ) %]
<p>This item is already checked out to you: <b>[% c.confirm | html %]</b> <i>([% c.barcode | html %])</i></p>
[% END %]
[% IF ( c.renew && Koha.Preference('SCOAllowCheckin') ) %]
<form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
[% INCLUDE 'csrf-token.inc' %]
<legend class="sr-only">Return</legend>
<input type="hidden" name="op" value="cud-returnbook" />
<input type="hidden" name="patronid" value="[% patronid | html %]" />
<input type="hidden" name="barcode" value="[% c.barcode | html %]" />
<input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
<input type="hidden" name="confirmed" value="" />
<input type="hidden" name="newissues" value="[% newissues | html %]" />
<button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
</form>
[% END %]
[% UNLESS ( c.renew ) %]
<form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
[% INCLUDE 'csrf-token.inc' %]
<legend class="sr-only">Renew</legend>
<input type="hidden" name="op" value="cud-renew" />
<input type="hidden" name="patronid" value="[% patronid | html %]" />
<input type="hidden" name="barcode" value="[% c.barcode | html %]" />
<input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
<input type="hidden" name="confirmed" value="1" />
<input type="hidden" name="newissues" value="[% newissues | html %]" />
<button type="submit" name="confirm" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
</form>
[% ELSE %]
<form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
[% INCLUDE 'csrf-token.inc' %]
<legend class="sr-only">Renew</legend>
<input type="hidden" name="op" value="cud-renew" />
<input type="hidden" name="patronid" value="[% patronid | html %]" />
<input type="hidden" name="barcode" value="[% c.barcode | html %]" />
<input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
<input type="hidden" name="confirmed" value="1" />
<input type="hidden" name="newissues" value="[% newissues | html %]" />
<button type="submit" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
</form>
[% END %]
<form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="get">
<legend class="sr-only">Cancel</legend>
<input type="hidden" name="op" value="" />
<input type="hidden" name="patronid" value="[% patronid | html %]" />
<input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
<input type="hidden" name="newissues" value="[% newissues | html %]" />
<button type="submit" class="btn btn-primary"><i class="fa fa-cancel" aria-hidden="true"></i> Cancel</button>
</form>
</div>
[% END # / FOREACH confirm %]
[% IF ( nopermission ) %]
<!-- This is what is displayed if user doesn't have permission -->
<div class="alert alert-warning">
<span class="sco-alert-warning nopermission"></span>
<h2>Access denied</h2>
<p>Sorry, this self-checkout station has lost authentication. Please contact the administrator to resolve this problem.</p>
</div>
[% END %]
[% IF ( different_ip ) %]
<!-- This is what is displayed if user doesn't have permission -->
<div class="alert alert-warning">
<span class="sco-alert-warning sessionlost"></span>
<h2>Session lost</h2>
<p>You are accessing self-checkout from a different IP address! please log in again.</p>
</div>
[% END %]
[% IF ( invalid_username_or_password ) %]
<!-- This is what is displayed if user doesn't have permission -->
<div class="alert alert-warning">
<span class="sco-alert-warning notfound"></span>
<h2>Record not found</h2>
<p>Your userid was not found in the database. Please try again.</p>
</div>
[% END %]
[% IF ( issued ) %]
[% IF batch_checkouts_allowed %]
[% FOREACH barcode IN newissues.split(',') %]
<span class="sco-alert-success issue"></span>
<div class="alert alert-info">
<p>Item checked out <i>([% barcode | html %])</i></p>
</div>
[% END %]
[% ELSE %]
<span class="sco-alert-success issue"></span>
<div class="alert alert-info">
<p>Item checked out <i>([% newissues.split(',').last | html %])</i></p>
</div>
[% END %]
[% ELSIF ( renewed ) %]
<span class="sco-alert-success renew"></span>
<div class="alert alert-info">
<p>Item renewed <i>([% barcode | html %])</i></p>
</div>
[% ELSIF ( renewed == 0) %]
<span class="sco-alert-warning renew"></span>
<div class="alert alert-info">
<p>Item not renewed</p>
</div>
[% ELSIF ( returned == 0 ) %]
<span class="sco-alert-warning return"></span>
<div class="alert alert-info">
<p>Item not checked in: please see circulation staff for assistance</p>
</div>
[% ELSIF ( returned == 1 ) %]
<span class="sco-alert-success return"></span>
<div class="alert alert-info">
<p>Item checked in <i>([% barcode | html %])</i></p>
</div>
[% END %]
[% END %]