Koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt
Owen Leonard e5f1ada249 Bug 28937: Use Flatpickr on circulation and patron pages
This patch replaces the use of jQueryUI's datepicker on circulation and
patron-related pages.

The patch modifies Flatpickr's default configuration (in calendar.inc)
so that it has the following features:

 - A Flatpickr input with a "futuredate" class will require that the
   selected date be after today.
 - The Flatpickr input field will be wrapped in a container to
   facilitate better CSS styling.
 - Generic handling of paired date fields is enabled using
   ".flatpickrfrom" and ".flatpickrto" field classes. This mimics the
   same feature we have for jQueryUI datepickers using ".datepickerfrom"
   and ".datepickerto".

This patch also removes an unused function which was repeated in three
templates: validate1.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

- Go to Circulation and check out to a patron.
  - Open the Restrictions tab and click "Add manual restriction."
    - In the "Expiration" field, test that the Flatpickr widget works
      correctly and limits to dates after today.
  - Enable the SpecifyDueDate preference if necessary.
    - Test the behavior of the SpecifyDueDate controls: Setting a date,
      clearing a date, session persistence.
- Enable the SuspendHoldsIntranet system preference if necessary.
  - Check out to a patron with existing holds.
    - Open the Holds tab and click the "Suspend" button for one of the
      holds.
      - In the modal window which appears, check that the Flatpickr
        widget works correctly and limits to dates after today.
      - At the bottom of the table of holds, test that the "Suspend all
        holds" Flatpickr works correctly and limits to dates after
        today.
        - Perform this same test from the patron details page.
- Enable the  BatchCheckouts system preference if necessary.
  - Open a patron record and click "Batch check out" in the left-hand
    sidebar menu.
    - Test that the "Hard due date" Flatpickr works correctly as a date
      and time picker.
- Go to Circulation -> Overdues.
  - Test that the date due filters in the sidebar work correctly and
    are linked, e.g. the "to" field cannot be before the "from" field.
     - Perform the same test here: Circulation -> Holds to pull; and
       here: Circulation -> Hold ratios.
- Enable the  HouseboundModule system preference if necessary.
  - Check out to or view details of a patron.
    - Click "Housebound" in the sidebar menu.
      - Save delivery day and frequency settings for that patron.
      - Click "Add a new delivery."
      - Test that the "Date" Flatpickr widget works correctly.
- Go to Patrons -> A patron record -> Edit.
  - Test that Flatpickr widgets work on the following fields:
    - Date of birth
    - Registration date & Expiration date (linked).
    - Patron restrictions -> Add manual restriction -> Expiration.
- View a bibliographic record and start the process of placing a hold.
  - After selecting a patron, test the "Hold starts on" and "Hold
    expires on" date fields. The fields should be linked and each
    should limit to future dates.
  - Confirm that the dates are saved correctly when you submit the
    hold.
- Locate a bibliographic record with multiple holds and view the holds.
  - In the table of holds, test each date field: Date, expiration, and
    suspend-until.
- Test that Flatpickr's static "formatDate" method is working
  correctly:
  - Locate a bibliographic record's item so that there is text in both
    the "Public note" and "Non-public note" field.
  - Check that item out to a patron.
  - After the page reloads the public and non-public notes should be
    shown under the checkout title highlighted in red.
- Check for references to a "validate1" function. There should be none.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-09-29 12:47:33 +02:00

375 lines
18 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Branches %]
[% USE Koha %]
[% USE KohaDates %]
[% USE Price %]
[% USE AuthorisedValues %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
[% SET destination = "circ" %]
<title>
[% IF patron %]
Batch check out to [% INCLUDE 'patron-title.inc' invert_name = 1 no_html = 1 %] &rsaquo;
[% END %]
Circulation &rsaquo; Koha
</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="circ_circulation_batch_checkouts" class="circ">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'circ-search.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
</li>
[% IF patron %]
<li>
<a href="/cgi-bin/koha/circ/circulation.pl">Batch check out</a>
</li>
<li>
<a href="#" aria-current="page">
[% INCLUDE 'patron-title.inc' %]
</a>
</li>
[% ELSE %]
<li>
<a href="#" aria-current="page">
Batch check out
</a>
</li>
[% END %]
</ol>
</nav>
<div class="main container-fluid">
<div class="row">
[% IF patron %]
<div class="col-sm-10 col-sm-push-2">
[% ELSE %]
<div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
[% END %]
<main>
[% IF patron %]
[% INCLUDE 'members-toolbar.inc' %]
[% END %]
[% IF patron and not batch_allowed %]
<div class="dialog alert">You are not allowed to use batch checkout for this patron</div>
[% ELSIF patron and noissues and not checkout_infos %]
<div class="dialog alert">
Cannot check out!
[% IF ( charges ) %]
[% INCLUDE 'blocked-fines.inc' fines = chargesamount %]
[% END %]
[% IF ( charges_guarantors_guarantees ) %]
<li>
<span class="circ-hlt">Charges:</span> Patron's guarantors and their other guarantees collectively owe [% charges_guarantors_guarantees | $Price %].
[% IF noissues %]
<span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
[% END %]
</li>
[% END %]
[% IF ( charges_guarantees ) %]
<li>
<span class="circ-hlt">Charges:</span> Patron's guarantees collectively owe [% chargesamount_guarantees | $Price %].
[% IF noissues %]
<span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
[% END %]
</li>
[% END %]
</div>
[% ELSIF patron and not checkout_infos %]
<form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/circ/circulation.pl">
<fieldset id="circ_circulation_issue">
<label for="barcode">Checking out to [% INCLUDE 'patron-title.inc' %]</label>
<fieldset class="rows">
<legend>Use a file</legend>
<ol>
<li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
</ol>
</fieldset>
<fieldset class="rows">
<legend>Or list barcodes one by one</legend>
<ol>
<li>
<label for="barcodelist">Barcode list (one barcode per line): </label>
<textarea rows="10" cols="30" id="barcodelist" name="barcodelist"></textarea>
</li>
</ol>
</fieldset>
[% IF Koha.Preference('SpecifyDueDate') %]
<fieldset class="rows">
<legend>Due date: </legend>
<label for="duedatespec">Hard due date [% INCLUDE 'date-format.inc' %]:</label>
<input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | $KohaDates with_hours => 1 %]" />
</fieldset>
[% END %]
<input type="hidden" name="op" value="show" />
<fieldset class="action">
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
<input type="hidden" name="branch" value="[% branch | html %]" />
<input type="hidden" name="batch" value="1" />
<input type="submit" value="Check out" class="button" />
</fieldset>
</fieldset>
</form>
[% ELSIF patron %]
[% IF confirmation_needed && CAN_user_circulate_force_checkout %]
<h3>Batch checkout confirmation [% IF patron %] for [% INCLUDE 'patron-title.inc' invert_name = 1 %] [% END %]</h3>
<form method="post" action="/cgi-bin/koha/circ/circulation.pl" id="mainform" name="mainform" autocomplete="off">
[% ELSE %]
<h3>Batch checkout information [% IF patron.borrowernumber %] for [% INCLUDE 'patron-title.inc' invert_name = 1 %] |[% batch | html %]|[% END %]</h3>
[% END %]
<table id="checkout_infos">
<thead>
<tr>
[% IF confirmation_needed && CAN_user_circulate_force_checkout %]
<th class="NoSort"></th>
[% END %]
<th>Barcode</th>
<th class="anti-the">Title</th>
<th>Information</th>
</tr>
</thead>
<tbody>
[% FOR checkout_info IN checkout_infos %]
<tr>
[% IF confirmation_needed && CAN_user_circulate_force_checkout %]
<td>
[% IF checkout_info.NEEDSCONFIRMATION %]
<input type="checkbox" name="barcodes" value="[% checkout_info.barcode | html %]" checked="checked" />
[% END %]
</td>
[% END %]
<td>[% checkout_info.barcode | html %]</td>
<td>
[% INCLUDE 'biblio-title.inc' biblio=checkout_info.biblio link = 1 %] [% IF checkout_info.biblio.author %], by [% checkout_info.biblio.author | html %][% END %][% IF ( checkout_info.item.itemnotes ) %]- <span class="circ-hlt">[% checkout_info.item.itemnotes | $raw %]</span>[% END %] <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% checkout_info.biblio.biblionumber | uri %]&amp;itemnumber=[% checkout_info.item.itemnumber | uri %]#item[% checkout_info.item.itemnumber | uri %]">[% checkout_info.item.barcode | html %]</a>
</td>
<td>
[% IF checkout_info.NEEDSCONFIRMATION %]
<ul class="fa-ul warn">
[% IF checkout_info.AGE_RESTRICTION %]
<li><i class="fa fa-li fa-warning"></i>Age restriction [% checkout_info.AGE_RESTRICTION | html %].</li>
[% END %]
[% IF checkout_info.RENEW_ISSUE %]
<li><i class="fa fa-li fa-warning"></i>This item is currently checked out to this patron. Renew?</li>
[% END %]
[% IF checkout_info.RESERVE_WAITING %]
<li><i class="fa fa-li fa-warning"></i>This item is waiting for another patron.</li>
[% END %]
[% IF checkout_info.TRANSFERRED %]
<li><i class="fa fa-li fa-warning"></i>This item is on hold and being transferred for another patron.</li>
[% END %]
[% IF checkout_info.PROCESSING %]
<li><i class="fa fa-li fa-warning"></i>This item is on hold and being processed for another patron.</li>
[% END %]
[% IF checkout_info.ISSUED_TO_ANOTHER %]
<li><i class="fa fa-li fa-warning"></i>This item is checked out to another patron.
[% IF CAN_user_circulate_force_checkout %]
Check in and check out?
[% END %]</li>
[% END %]
[% IF checkout_info.TOO_MANY %]
<li><i class="fa fa-li fa-warning"></i>Too many checked out.</li>
[% END %]
[% IF checkout_info.BORRNOTSAMEBRANCH %]
<li><i class="fa fa-li fa-warning"></i>This patron is from a different library ([% Branches.GetName( checkout_info.BORRNOTSAMEBRANCH ) | html %]).</li>
[% END %]
[% IF checkout_info.PATRON_CANT %]
<li><i class="fa fa-li fa-warning"></i>This patron can't check out this item per library circulation policy.</li>
[% END %]
[% IF checkout_info.NOT_FOR_LOAN_FORCING %]
[% IF checkout_info.itemtype_notforloan %]
<li><i class="fa fa-li fa-warning"></i>Item type is normally not for loan.</li>
[% ELSIF checkout_info.item_notforloan %]
[% item_notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => checkout_info.item_notforloan ) %]
<li><i class="fa fa-li fa-warning"></i>Item is normally not for loan [% IF item_notforloan_lib %]([% item_notforloan_lib | html %])[% END %].</li>
[% END %]
[% END %]
[% IF checkout_info.USERBLOCKEDOVERDUE %]
<li><i class="fa fa-li fa-warning"></i>Patron has [% checkout_info.USERBLOCKEDOVERDUE | html %] overdue item(s).</li>
[% END %]
[% IF checkout_info.ITEM_LOST %]
<li><i class="fa fa-li fa-warning"></i>This item has been lost with a status of "[% checkout_info.ITEM_LOST | html %]."</li>
[% END %]
[% IF checkout_info.HIGHHOLDS %]
<li><i class="fa fa-li fa-warning"></i>High demand item. Loan period shortened to [% checkout_info.HIGHHOLDS.duration | html %] days (due [% checkout_info.HIGHHOLDS.returndate | html %]).</li>
[% END %]
[% IF checkout_info.HIGHHOLDS %] <!-- FIXME -->
<script>
$(document).ready(function() {
$("input[name=duedatespec]:hidden").val('[% checkout_info.HIGHHOLDS.returndate | html %]');
});
</script>
[% END %]
[% IF NOT checkout_info.IMPOSSIBLE && ( CAN_user_circulate_force_checkout || checkout_info.HIGHHOLDS ) && ( checkout_info.RESERVED || checkout_info.RESERVE_WAITING || checkout_info.TRANSFERRED || checkout_info.PROCESSING ) %] <!-- arbitrary choice, revert the reserve is not possible-->
<li><i class="fa fa-li fa-warning"></i>This item is on hold for another patron. The hold will be overridden, but not cancelled.</li>
[% ELSIF checkout_info.RESERVED %]
<li><i class="fa fa-li fa-warning"></i>This item is on hold for another patron.</li>
[% END %]
[% IF checkout_info.PREVISSUE %]
<li>This item has previously been checked out to this patron.</li>
[% END %]
</ul>
[% END %]
[% IF checkout_info.alert.ITEM_LOST || checkout_info.alert.OTHER_CHARGES %]
<ul class="info">
[% IF checkout_info.alert.ITEM_LOST %]
<li>This item has been lost with a status of "[% checkout_info.alert.ITEM_LOST | html %]."</li>
[% END %]
[% IF checkout_info.alert.OTHER_CHARGES %]
<li>The patron has unpaid charges for holds, rentals etc of [% checkout_info.alert.OTHER_CHARGES | $Price %].</li>
[% END %]
</ul>
[% END %]
[% IF checkout_info.alert.RETURNED_FROM_ANOTHER %]
<div class="dialog alert">Item was checked out to [% INCLUDE 'patron-title.inc' patron = checkout_info.alert.RETURNED_FROM_ANOTHER.patron %] and was returned automatically.</div>
[% END %]
[% IF checkout_info.IMPOSSIBLE %]
<ul class="fa-ul error">
[% IF checkout_info.STATS %]
<li><i class="fa fa-li fa-exclamation"></i>Local use recorded.</li>
[% END %]
[% IF checkout_info.NOT_FOR_LOAN %]
[% IF checkout_info.itemtype_notforloan %]
<li><i class="fa fa-li fa-exclamation"></i>Item type not for loan.</li>
[% ELSIF checkout_info.item_notforloan %]
[% item_notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => checkout_info.item_notforloan ) %]
<li><i class="fa fa-li fa-exclamation"></i>Item not for loan [% IF item_notforloan_lib %]([% item_notforloan_lib | html %])[% END %].</li>
[% END %]
[% END %]
[% IF checkout_info.WTHDRAWN %]
<li><i class="fa fa-li fa-exclamation"></i>Item has been withdrawn.</li>
[% END %]
[% IF checkout_info.RESTRICTED %]
<li><i class="fa fa-li fa-exclamation"></i>Item is restricted.</li>
[% END %]
[% IF checkout_info.GNA %]
<li><i class="fa fa-li fa-exclamation"></i>Patron's address is in doubt.</li>
[% END %]
[% IF checkout_info.CARD_LOST %]
<li><i class="fa fa-li fa-exclamation"></i>Patron's card is lost.</li>
[% END %]
[% IF checkout_info.DEBARRED %]
<li><i class="fa fa-li fa-exclamation"></i>Patron is restricted.</li>
[% END %]
[% IF checkout_info.NO_MORE_RENEWALS %]
<li><i class="fa fa-li fa-exclamation"></i>No more renewals possible.</li>
[% END %]
[% IF checkout_info.EXPIRED %]
<li><i class="fa fa-li fa-exclamation"></i>Patron's card is expired.</li>
[% END %]
[% IF checkout_info.ITEMNOTSAMEBRANCH %]
<li><i class="fa fa-li fa-exclamation"></i>This item belongs to [% Branches.GetName( checkout_info.itemhomebranch ) | html %] and cannot be checked out from this location.</li>
[% END %]
[% IF checkout_info.USERBLOCKEDREMAINING %]
<li><i class="fa fa-li fa-exclamation"></i>Patron has had overdue items and is blocked for [% checkout_info.USERBLOCKEDREMAINING | html %] day(s).</li>
[% END %]
[% IF checkout_info.USERBLOCKEDOVERDUE %]
<li><i class="fa fa-li fa-exclamation"></i>Checkouts are BLOCKED because patron has overdue items.</li>
[% END %]
[% IF checkout_info.TOO_MANY %]
<li><i class="fa fa-li fa-exclamation"></i>Too many checked out.</li>
[% END %]
[% IF checkout_info.UNKNOWN_BARCODE %]
<li><i class="fa fa-li fa-exclamation"></i>The barcode was not found [% checkout_info.barcode | html %].</li>
[% END %]
[% IF checkout_info.DEBT %]
<li><i class="fa fa-li fa-exclamation"></i>The patron has a debt of [% checkout_info.DEBT | $Price %].</li> <!-- Need debt_confirmed -->
[% END %]
</p>
[% END %]
[% IF checkout_info.issue.date_due %]
<li>Due on [% checkout_info.issue.date_due | $KohaDates as_due_date => 1 %]</li>
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
[% IF confirmation_needed && CAN_user_circulate_force_checkout %]
<fieldset>
<legend>Please confirm checkout</legend>
<input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
<input type="hidden" name="issueconfirmed" value="1" />
<input type="hidden" name="debt_confirmed" value="1" />
<input type="hidden" name="branch" value="[% branch | html %]" />
<input type="hidden" name="duedatespec" value="[% duedatespec | html %]" />
<input type="hidden" name="batch" value="1" />
<input type="submit" id="checkoutrenew" class="approve" value="Checkout or renew" />
</fieldset>
</form>
[% END %]
[% ELSE %]
<div class="dialog message">This patron does not exist. <a href="/cgi-bin/koha/members/members-home.pl">Find another patron?</a></div>
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
[% IF patron %]
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'circ-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
[% END %]
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'datatables.inc' %]
[% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
<script>
$(document).ready(function() {
if($('#barcodelist').length) {
$('#barcodelist').focus();
} else if ($('#checkoutrenew').length) {
$('#checkoutrenew').focus();
}
$("#checkout_infos").dataTable($.extend(true, {}, dataTablesDefaults, {
"sDom": 't',
"aaSorting": [],
"aoColumnDefs": [
{ "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] }
],
"bPaginate": false
}));
[% IF Koha.Preference('SpecifyDueDate') %]
$("#duedatespec").flatpickr({
enableTime: true,
dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string,
defaultDate: new Date().setHours(23, 59, 0, 0) /* Today a 11:59PM */
});
[% END %]
});
</script>
[% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") | $raw %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]