Bugzilla – Attachment 106598 Details for
Bug 23258
Batch tool for placing and cancelling holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23258: (follow-up) Batch holds template followup
Bug-23258-follow-up-Batch-holds-template-followup.patch (text/plain), 22.30 KB, created by
Owen Leonard
on 2020-07-06 16:07:34 UTC
(
hide
)
Description:
Bug 23258: (follow-up) Batch holds template followup
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-07-06 16:07:34 UTC
Size:
22.30 KB
patch
obsolete
>From 11f9630401336792beaf6fc6b88ea5fa5b0e9089 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 6 Jul 2020 15:28:11 +0000 >Subject: [PATCH] Bug 23258: (follow-up) Batch holds template followup > >This patch revises the batch holds template to bring it up to date with >current guidelines including corrected indentation, Bootstrap grid, >terminology fixes ("hold" instead of "reserve") and JavaScript in the >footer. > >Also changed: >- Add specificity to page title and breadcrumbs >- Add "Select all" and "Clear all" links to confirmation page >- Add jQuery validation of the form, enforcing barcode and patron entry >- Swith from "Batch holding" to "Batch place and cancel holds." >- Made suggested change to avoid errors in the log: > my $op = $input->param('op') // ''; >- Fixed some other QA tool errors > >To test, apply the patch and test the process of placing and cancelling >holds in batches: > > - By uploading a file of barcodes > - By submitting barcodes in the textarea > - Confirm that holds are placed and cancelled > > At each step of the process confirm that everything looks good and > works properly. >--- > circ/batch_holding.pl | 6 +- > .../prog/en/modules/circ/batch_holding.tt | 408 +++++++++++++-------- > .../prog/en/modules/circ/circulation-home.tt | 5 +- > 3 files changed, 263 insertions(+), 156 deletions(-) > >diff --git a/circ/batch_holding.pl b/circ/batch_holding.pl >index dcbed73e27..400eb53ff4 100755 >--- a/circ/batch_holding.pl >+++ b/circ/batch_holding.pl >@@ -28,11 +28,9 @@ use List::MoreUtils qw/uniq/; > > > my $input = new CGI; >-my $op = $input->param('op'); >+my $op = $input->param('op') // ''; > my @itemnumbers; > >-my @errors; >- > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { > template_name => "circ/batch_holding.tt", >@@ -104,6 +102,7 @@ if ($op eq "show"){ > borrowernumber => $borrowernumber, > branch => $branch, > action => $action, >+ op => $op > ); > } > >@@ -146,6 +145,7 @@ elsif ($op eq "result") { > holdloop => \@holdloop, > cancel => $action eq "cancel" ? 1 : 0, > place => $action eq "place" ? 1 : 0, >+ op => $op > ); > > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/batch_holding.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/batch_holding.tt >index 9ecc04fb7a..c46e604d48 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/batch_holding.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/batch_holding.tt >@@ -1,165 +1,271 @@ >+[% USE Koha %] > [% USE Branches %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] >-<title>Koha › Circulation › Batch holding</title> >+<title> >+ Koha › >+ Circulation › >+ [% IF ( op == "show" ) %] >+ Batch place or cancel holds › >+ Confirm selection >+ [% ELSIF ( op == "result") %] >+ Batch place or cancel holds › >+ Results >+ [% ELSE %] >+ Batch place or cancel holds >+ [% END %] >+</title> > [% INCLUDE 'doc-head-close.inc' %] >-<script> >- // <![CDATA[ >- $(document).ready(function() { >- $("#batchholdform").submit(function() { >- if (!$("#borrowernumber").val()) { >- alert(_("Please select a valid borrower.")); >- return false; >- } >- }); >- $("#findborrowerhold").autocomplete({ >- source: "/cgi-bin/koha/circ/ysearch.pl", >- minLength: 3, >- select: function( event, ui ) { >- $( "#findborrowerhold" ).val( ui.item.surname + ', ' + ui.item.firstname + ' (' + ui.item.cardnumber + ')' ); >- $( "#borrowernumber").val( ui.item.borrowernumber ); >- return false; >- } >- }) >- .data( "ui-autocomplete" )._renderItem = function( ul, item ) { >- return $( "<li></li>" ) >- .data( "ui-autocomplete-item", item ) >- .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >- .appendTo( ul ); >- }; >- }); >- // ]]> >-</script> > </head> > <body id="batch_holding"> > > [% INCLUDE 'header.inc' %] > [% INCLUDE 'cataloging-search.inc' %] >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> › Batch holding</div> >- >-<div id="doc" class="yui-t7"> >- >-<div id="bd"> >- <div id="yui-main"> >-[% IF show %] >- [% IF ( notfoundbarcodes ) %] >- <div class="dialog alert"><p>Warning, the following barcodes were not found:</p></div> >- <table style="margin:auto;"> >- <thead> >- <tr><th>Barcodes not found</th></tr> >- </thead> >- <tbody> >- [% FOREACH notfoundbarcode IN notfoundbarcodes %] >- <tr><td>[% notfoundbarcode.barcode %]</td></td> >- [% END %] >- </tbody> >- </table> >- [% END %] <!-- /notfoundbarcodes --> >- >- [% IF (holdloop) %] >- <h1>[% action %] holds on the following barcodes</h1> >- <form action="batch_holding.pl" method="POST"> >- <ul> >- [% FOREACH hold IN holdloop %] >- <li> >- [% IF hold.holdable %] >- <input type="checkbox" name="holdable" checked="checked" value="[% hold.itemnumber %]" /> >- [% hold.barcode %] >- [% ELSE %] >- [% hold.barcode %] (This item cannot be reserved) >- [% END %] >- </li> >+<div id="breadcrumbs"> >+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> › >+ <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> › >+ [% IF ( op == "show" ) %] >+ <a href="/cgi-bin/koha/circ/batch_holding.pl">Batch place or cancel holds</a> › >+ Confirm selection >+ [% ELSIF ( op == "result") %] >+ <a href="/cgi-bin/koha/circ/batch_holding.pl">Batch place or cancel holds</a> › >+ Results >+ [% ELSE %] >+ Batch place or cancel holds > [% END %] >- </ul> >- <input type="hidden" name="op" value="result" /> >- <input type="hidden" name="action" value="[% action %]" /> >- <input type="hidden" name="branch" value="[% branch %]" /> >- <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" /> >- <input type="submit" /> >- </form> >- [% ELSE %] >- <p>No reservation can be placed or cancelled.</p> >- <a href="batch_holding.pl">Batch place or cancel other items</a> >- [% END %] >- >-[% ELSIF result %] >- [% IF (holdloop) %] >- <h1>Results</h1> >- <ul> >- [% IF place %] >- The following items have been reserved: >- <ul> >- [% FOREACH hold IN holdloop %] >- <li>itemnumber [% hold.itemnumber %], reserve_id [% hold.reserve_id %]</li> >+</div> >+ >+<div class="main container-fluid"> >+ <div class="row"> >+ [% IF Koha.Preference('CircSidebar') %] >+ <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 %] >- </ul> >- [% END %] >- [% IF cancel %] >- The following reservations were cancelled: >- <ul> >- [% FOREACH hold IN holdloop %] >- <li>itemnumber [% hold.itemnumber %]</li> >+ <main> >+ >+ [% IF show %] >+ [% IF ( notfoundbarcodes ) %] >+ <div class="dialog alert"><p>Warning, the following barcodes were not found:</p></div> >+ >+ <table> >+ <thead> >+ <tr><th>Barcodes not found</th></tr> >+ </thead> >+ <tbody> >+ [% FOREACH notfoundbarcode IN notfoundbarcodes %] >+ <tr><td>[% notfoundbarcode.barcode | html %]</td></td> >+ [% END %] >+ </tbody> >+ </table> >+ [% END #/IF notfoundbarcodes %] >+ >+ [% IF (holdloop) %] >+ [% IF ( action == "place" ) %] >+ <h1>Place holds on the following barcodes</h1> >+ [% ELSE %] >+ <h1>Cancel holds on the following barcodes</h1> >+ [% END %] >+ >+ <div id="toolbar"> >+ <a id="SelectAll" href="#"><i class="fa fa-check"></i> Select all</a> | >+ <a id="ClearAll" href="#"><i class="fa fa-remove"></i> Clear all</a> >+ </div> >+ >+ <form action="batch_holding.pl" id="hold_selections" method="POST"> >+ <table> >+ <tbody> >+ [% FOREACH hold IN holdloop %] >+ <tr> >+ <td> >+ [% IF hold.holdable %] >+ <label> >+ <input type="checkbox" name="holdable" checked="checked" value="[% hold.itemnumber | html %]" /> >+ [% hold.barcode | html %] >+ </label> >+ [% ELSE %] >+ <i class="fa fa-warning"></i> >+ [% hold.barcode | html %] (This item cannot be placed on hold) >+ [% END %] >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ <input type="hidden" name="op" value="result" /> >+ <input type="hidden" name="action" value="[% action | html %]" /> >+ <input type="hidden" name="branch" value="[% branch | html %]" /> >+ <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" /> >+ <fieldset class="action"> >+ <input type="submit" class="submit" value="Submit" /> >+ <a href="/cgi-bin/koha/circ/circulation-home.pl" class="cancel">Cancel</a> >+ </fieldset> >+ </form> >+ [% ELSE %] >+ <p>No holds can be placed or cancelled.</p> >+ <a href="batch_holding.pl">Batch place or cancel other holds</a> >+ [% END # /IF holdloop %] >+ >+ [% ELSIF result %] >+ >+ [% IF (holdloop) %] >+ <h1>Results</h1> >+ [% IF place %] >+ The following items have been placed on hold: >+ <ul> >+ [% FOREACH hold IN holdloop %] >+ <li>itemnumber [% hold.itemnumber | html %], reserve_id [% hold.reserve_id | html %]</li> >+ [% END %] >+ </ul> >+ [% END %] >+ [% IF cancel %] >+ The following holds were cancelled: >+ <ul> >+ [% FOREACH hold IN holdloop %] >+ <li>itemnumber [% hold.itemnumber | html %]</li> >+ [% END %] >+ </ul> >+ [% END %] >+ [% ELSE %] >+ <p>No holds could be placed or cancelled.</p> >+ [% END %] >+ <a href="batch_holding.pl">Batch place or cancel other holds</a> >+ >+ [% ELSE %] >+ >+ <h1>Batch place or cancel holds</h1> >+ <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/circ/batch_holding.pl" id="batchholdform"> >+ <fieldset class="rows"> >+ <legend>Use a barcode file</legend> >+ <label for="uploadfile">File: </label> >+ <input type="file" id="uploadfile" name="uploadfile" /> >+ </fieldset> >+ >+ <fieldset class="rows"> >+ <legend>Or scan items 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> >+ >+ <fieldset class="rows"> >+ <legend>Place hold for</legend> >+ <ol> >+ <li> >+ <label class="required" for="findborrowerhold">Patron:</label> >+ <input type="hidden" id="borrowernumber" name="borrowernumber" /> >+ <div class="autocomplete"> >+ <input autocomplete="on" id="findborrowerhold" name="findborrowerhold" size="40" class="required" type="text" required="required" /> >+ <span class="required">Required</span> >+ </div> >+ <div class="hint"> >+ Enter patron card number or partial name >+ </div> >+ </li> >+ <li> >+ <label for="branch">Pickup at:</label> >+ <select name="branch" id="branch"> >+ [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %] >+ </select> >+ </li> >+ </ol> >+ </fieldset> >+ >+ <fieldset class="rows"> >+ <legend>Action</legend> >+ <ol> >+ <li> >+ <input type="radio" name="action" id="action_place_holds" value="place" checked="checked"> >+ <label for="action_place_holds">Place holds</label> >+ </li> >+ <li> >+ <input type="radio" name="action" id="action_cancel_holds" value="cancel"> >+ <label for="action_cancel_holds">Cancel holds</label> >+ </li> >+ </ol> >+ </fieldset> >+ >+ <fieldset class="action"> >+ <input type="hidden" name="op" value="show" /> >+ <input type="submit" value="Continue" class="submit" /> >+ </fieldset> >+ </form> <!-- /#batchholdform --> >+ [% END # /IF show %] >+ >+ </main> >+ </div> <!-- /.col-sm-10.col-sm-push-2 --> >+ [% IF Koha.Preference('CircSidebar') %] >+ <div class="col-sm-2 col-sm-pull-10"> >+ <aside> >+ [% INCLUDE 'circ-nav.inc' %] >+ </aside> >+ </div> <!-- /.col-sm-2.col-sm-pull-10 --> > [% END %] >- </ul> >- [% END %] >- </ul> >- [% ELSE %] >- <p>No reservation could be placed or cancelled.</p> >- [% END %] >- <a href="batch_holding.pl">Batch place or cancel other items</a> >-[% ELSE %] >- <h1>Batch holding</h1> >- <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/circ/batch_holding.pl" id="batchholdform"> >- <fieldset class="rows"> >- <legend>Use a barcode file</legend> >- <label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li> >- </fieldset> >- <fieldset class="rows"> >- <legend>Or scan items 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> >- <fieldset class="rows"> >- <legend>Holding informations</legend> >- <ol> >- <li> >- <label for="findborrowerhold">Borrower:</label> >- <input type="hidden" id="borrowernumber" name="borrowernumber" /> >- <div class="autocomplete"> >- <input autocomplete="on" id="findborrowerhold" name="findborrowerhold" size="40" class="focus" type="text" /> >- </div> >- </li> >- <li> >- <label for="branch">Holding branch:</label> >- <select name="branch" id="branch" style="width:10em;"> >- [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %] >- </select> >- >- </li> >- </ol> >- </fieldset> >- <fieldset class="rows"> >- <legend>Action</legend> >- <ol> >- <li> >- <input type="radio" name="action" id="action_place_holds" value="place" checked="checked"> >- <label for="action_place_holds">Place holds</label> >- </li> >- <li> >- <input type="radio" name="action" id="action_cancel_holds" value="cancel"> >- <label for="action_cancel_holds">Cancel holds</label> >- </li> >- </ol> >- </fieldset> >- <input type="hidden" name="op" value="show" /> >- <input type="submit" value="Continue" class="button" /> >- </form> >+ </div> <!-- /.row --> >+ >+[% MACRO jsinclude BLOCK %] >+ <script> >+ $(document).ready(function() { >+ if( $("#findborrowerhold").length > 0 ){ >+ $("#findborrowerhold").autocomplete({ >+ source: "/cgi-bin/koha/circ/ysearch.pl", >+ minLength: 3, >+ select: function( event, ui ) { >+ $( "#findborrowerhold" ).val( ui.item.surname + ', ' + ui.item.firstname + ' (' + ui.item.cardnumber + ')' ); >+ $( "#borrowernumber").val( ui.item.borrowernumber ); >+ return false; >+ } >+ }) >+ .data( "ui-autocomplete" )._renderItem = function( ul, item ) { >+ return $( "<li></li>" ) >+ .data( "ui-autocomplete-item", item ) >+ .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >+ .appendTo( ul ); >+ }; >+ } >+ >+ $("#batchholdform").validate({ >+ rules: { >+ uploadfile: { >+ required: function(element){ >+ return $("#barcodelist").val() === ""; >+ } >+ }, >+ barcodelist: { >+ required: function(element){ >+ return $("#uploadfile").val() === ""; >+ } >+ }, >+ }, >+ messages: { >+ uploadfile: { >+ required: _("Submit barcodes in a file or by entering them below") >+ }, >+ barcodelist: { >+ required: _("Submit barcodes by entering them here or by submitting a file above") >+ } >+ }, >+ findborrowerhold: { >+ required: true >+ } >+ >+ }); >+ >+ $("#SelectAll").on("click",function(e){ >+ e.preventDefault(); >+ $("#hold_selections input[type='checkbox']").prop('checked', true); >+ }); >+ >+ $("#ClearAll").on("click",function(e){ >+ e.preventDefault(); >+ $("#hold_selections input[type='checkbox']").prop('checked', false); >+ }); >+ >+ }); >+ </script> > [% END %] >-</div> >-</div> >-</div> > > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >index a16f72ca27..6f75fdff65 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >@@ -9,7 +9,8 @@ > [% INCLUDE 'header.inc' %] > [% INCLUDE 'circ-search.inc' %] > >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › Circulation</div> >+<div id="breadcrumbs"> >+<a href="/cgi-bin/koha/mainpage.pl">Home</a> › Circulation</div> > > <div class="main container-fluid"> > >@@ -70,7 +71,7 @@ > <a class="circ-button" href="/cgi-bin/koha/circ/reserveratios.pl"><i class="fa fa-line-chart"></i> Hold ratios</a> > </li> > <li> >- <a class="circ-button" href="/cgi-bin/koha/circ/batch_holding.pl"><i class="fa fa-tasks"></i> Batch holding</a> >+ <a class="circ-button" href="/cgi-bin/koha/circ/batch_holding.pl"><i class="fa fa-bookmark"></i> Batch place or cancel holds</a> > </li> > </ul> > </div> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23258
:
91230
|
106055
|
106077
|
106091
|
106598
|
107408
|
108498
|
108504
|
108628
|
108630
|
180199
|
180231