Bugzilla – Attachment 177975 Details for
Bug 36135
Add tool to batch modify holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36135: API the found_holds table
Bug-36135-API-the-foundholds-table.patch (text/plain), 29.37 KB, created by
Lucas Gass (lukeg)
on 2025-02-12 21:16:05 UTC
(
hide
)
Description:
Bug 36135: API the found_holds table
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-02-12 21:16:05 UTC
Size:
29.37 KB
patch
obsolete
>From b946f4b3b18f1921cd3b618d4d93ab89438353d6 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Wed, 12 Feb 2025 21:13:39 +0000 >Subject: [PATCH] Bug 36135: API the found_holds table > >--- > .../en/modules/tools/batch_modify_holds.tt | 416 ++++++++++-------- > 1 file changed, 225 insertions(+), 191 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_modify_holds.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_modify_holds.tt >index 166bdd04bc9..7a926bfb93d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_modify_holds.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_modify_holds.tt >@@ -35,75 +35,75 @@ > [% END #/ WRAPPER breadcrumbs %] > [% END #/ WRAPPER sub-header.inc %] > >- <div class="main container-fluid"> >- <div class="row"> >- <div class="col-sm-10 order-md-2 order-sm-1"> >- <main> >+<div class="main container-fluid"> >+ <div class="row"> >+ <div class="col-sm-10 order-md-2 order-sm-1"> >+ <main> >+ <h1>Batch modify holds</h1> > >- <h1>Batch modify holds</h1> >- >- [% IF view == 'form' %] >- <form method="get" action="/cgi-bin/koha/tools/batch_modify_holds.pl" id="modify_holds_form"> >- <fieldset class="rows"> >- <legend>Hold search criteria:</legend> >- <span class="hint">NOTE! Column patron_expiration_date is used as a main filter for expiration date field. Otherwise column expirationdate is used.</span> >- <ol> >- <li> >- <label for="expirationdate_from">Expiration date from:</label> >- <input type="text" size="10" id="expirationdate_from" name="expirationdate_from" class="flatpickr" data-date_to="to" /> >- </li> >- <li> >- <label for="expirationdate_to">Expiration date to:</label> >- <input type="text" size="10" id="expirationdate_to" name="expirationdate_to" class="flatpickr"/> >- </li> >- <li> >- <label for="branchcodes">Libraries:</label> >- <select name="branchcodes" id="branchcodes" multiple="multiple"> >- [% PROCESS options_for_libraries libraries => Branches.all(selected => "") %] >- </select> >- </li> >- <li> >- <label for="found_status">Found status:</label> >- <select name="found_status" id="found_status" multiple="multiple"> >- <option value="NULL">No status</option> >- <option value="T">In transit</option> >- <option value="P">In processing</option> >- <option value="W">Waiting</option> >- </select> >- </li> >- <li> >- <label for="suspend_status">Suspended:</label> >- <select name="suspend_status" id="suspend_status"> >- <option value="none" selected="selected"></option> >- <option value="0">Not suspended</option> >- <option value="1">Suspended</option> >- </select> >- </li> >- <li> >- <label for="suspend_until_from">Suspended until from:</label> >- <input type="text" size="10" id="suspend_until_from" name="suspend_until_from" class="flatpickr" data-date_to="to" /> >- </li> >- <li> >- <label for="suspend_until_to">Suspended until to:</label> >- <input type="text" size="10" id="suspend_until_to" name="suspend_until_to" class="flatpickr"/> >- </li> >- <li> >- <label for="reservenotes">Hold note:</label> >- <input type="text" id="reservenotes" name="reservenotes"/> >- </li> >- </ol> >- </fieldset> >- <fieldset class="action"> >- <input type="hidden" name="op" value="list"/> >- <input type="submit" class="btn btn-primary" value="Continue"/> >- <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a> >- </fieldset> >- </form> <!-- /#modify_holds_form --> >- [% ELSIF view == 'list' %] >+ [% IF view == 'form' %] >+ <form method="get" action="/cgi-bin/koha/tools/batch_modify_holds.pl" id="modify_holds_form"> >+ <fieldset class="rows"> >+ <legend>Hold search criteria:</legend> >+ <span class="hint">NOTE! Column patron_expiration_date is used as a main filter for expiration date field. Otherwise column expirationdate is used.</span> >+ <ol> >+ <li> >+ <label for="expirationdate_from">Expiration date from:</label> >+ <input type="text" size="10" id="expirationdate_from" name="expirationdate_from" class="flatpickr" data-date_to="to" /> >+ </li> >+ <li> >+ <label for="expirationdate_to">Expiration date to:</label> >+ <input type="text" size="10" id="expirationdate_to" name="expirationdate_to" class="flatpickr" /> >+ </li> >+ <li> >+ <label for="branchcodes">Libraries:</label> >+ <select name="branchcodes" id="branchcodes" multiple="multiple"> >+ [% PROCESS options_for_libraries libraries => Branches.all(selected => "") %] >+ </select> >+ </li> >+ <li> >+ <label for="found_status">Found status:</label> >+ <select name="found_status" id="found_status" multiple="multiple"> >+ <option value="NULL">No status</option> >+ <option value="T">In transit</option> >+ <option value="P">In processing</option> >+ <option value="W">Waiting</option> >+ </select> >+ </li> >+ <li> >+ <label for="suspend_status">Suspended:</label> >+ <select name="suspend_status" id="suspend_status"> >+ <option value="none" selected="selected"></option> >+ <option value="0">Not suspended</option> >+ <option value="1">Suspended</option> >+ </select> >+ </li> >+ <li> >+ <label for="suspend_until_from">Suspended until from:</label> >+ <input type="text" size="10" id="suspend_until_from" name="suspend_until_from" class="flatpickr" data-date_to="to" /> >+ </li> >+ <li> >+ <label for="suspend_until_to">Suspended until to:</label> >+ <input type="text" size="10" id="suspend_until_to" name="suspend_until_to" class="flatpickr" /> >+ </li> >+ <li> >+ <label for="reservenotes">Hold note:</label> >+ <input type="text" id="reservenotes" name="reservenotes" /> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="action"> >+ <input type="hidden" name="op" value="list" /> >+ <input type="submit" class="btn btn-primary" value="Continue" /> >+ <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a> >+ </fieldset> >+ </form> >+ <!-- /#modify_holds_form --> >+ [% ELSIF view == 'list' %] >+ [% IF holds.count %] > <form action="/cgi-bin/koha/tools/batch_modify_holds.pl" method="post" id="process"> >- [% INCLUDE 'csrf-token.inc' %] >- [% IF holds.count %] >- <div><p>Found [% holds.count | html %][% IF holds.count > 1 %] holds [% ELSE %] hold [% END %]to modify.</p></div> >+ [% INCLUDE 'csrf-token.inc' %] >+ <div><p>Found [% holds.count | html %][% IF holds.count > 1 %]holds[% ELSE %]hold[% END %]to modify.</p></div> > <div class="page-section"> > <div class="btn-toolbar selections-toolbar"> > <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a> >@@ -112,9 +112,8 @@ > <table id="found_holds"> > <thead> > <tr> >- <th> </th> >+ <th>Hold ID</th> > <th>Expiration date</th> >- <th>Patron expiration date</th> > <th>Title</th> > <th>Barcode</th> > <th>Status</th> >@@ -124,34 +123,10 @@ > <th>Note</th> > </tr> > </thead> >- <tbody> >- [% FOREACH hold IN holds %] >- <tr> >- <td><input type="checkbox" name="hold_id" value="[% hold.reserve_id | html %]"/></td> >- <td>[% hold.expirationdate | $KohaDates %]</td> >- <td>[% hold.patron_expiration_date | $KohaDates %]</td> >- <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% hold.biblionumber | uri %]">[% hold.biblio.title | html %]</a></td> >- <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% hold.itemnumber | uri %]&biblionumber=[% hold.biblionumber | uri %]&bi=[% hold.biblionumber | uri %]#item[% hold.itemnumber | uri %]">[% hold.item.barcode | html %]</a></td> >- <td class="found_status" data-found="[% hold.found | html %]"> >- [% IF hold.found == "T" %] >- In transit >- [% ELSIF hold.found == "P" %] >- In processing >- [% ELSIF hold.found == "W" %] >- Waiting >- [% ELSE %] >- No status >- [% END %] >- </td> >- <td>[% Branches.GetName( hold.branchcode ) | html %]</td> >- <td>[% IF hold.suspend %]Yes[% ELSE %]No[% END %]</td> >- <td>[% hold.suspend_until | $KohaDates %]</td> >- <td>[% hold.reservenotes | html %]</td> >- </tr> >- [% END %] >- </tbody> >- </table> <!-- /#holds --> >- </div> <!-- /.page-section --> >+ </table> >+ <!-- /#holds --> >+ </div> >+ <!-- /.page-section --> > <h2>Modify holds</h2> > <div class="page-section"> > <table id="hold_modifies"> >@@ -167,7 +142,7 @@ > <tbody> > <tr> > <td> >- <input type="text" id="new_expiration_date" name="new_expiration_date" class="flatpickr" data-flatpickr-futuredate="true"/> >+ <input type="text" id="new_expiration_date" name="new_expiration_date" class="flatpickr" data-flatpickr-futuredate="true" /> > </td> > <td> > <select id="new_pickup_loc" name="new_pickup_loc"> >@@ -183,106 +158,170 @@ > </select> > </td> > <td> >- <input type="text" id="new_suspend_date" name="new_suspend_date" class="flatpickr" data-flatpickr-futuredate="true"/> >+ <input type="text" id="new_suspend_date" name="new_suspend_date" class="flatpickr" data-flatpickr-futuredate="true" /> > </td> > <td> >- <input type="text" id="new_reserve_note" name="new_reserve_note"/> >+ <input type="text" id="new_reserve_note" name="new_reserve_note" /> > </td> > </tr> > </tbody> >- </table> <!-- /#hold_modifies --> >+ </table> >+ <!-- /#hold_modifies --> > </div> > <fieldset class="action"> >- <input type="hidden" name="op" value="cud-modify"/> >- <input type="submit" class="btn btn-primary" value="Modify selected holds"/> >+ <input type="hidden" name="op" value="cud-modify" /> >+ <input type="submit" class="btn btn-primary" value="Modify holds" /> > <a class="cancel" href="/cgi-bin/koha/tools/batch_modify_holds.pl">Cancel</a> > </fieldset> >- </form> <!-- /#process --> >- [% ELSE %] >- <div class="dialog message"> >- No holds were found for the selected filters. >- </div> >- <a class="cancel" href="/cgi-bin/koha/tools/batch_modify_holds.pl">Return</a> >- [% END %] >- [% ELSIF view == 'report' %] >- <div class="dialog message"> >- [% updated_holds.count | html %] holds have been modified! >- </div> >- <div class="page-section"> >- <table id="holds"> >- <thead> >+ </form> >+ <!-- /#process --> >+ [% ELSE %] >+ <div class="dialog message"> No holds were found for the selected filters. </div> >+ <a class="cancel" href="/cgi-bin/koha/tools/batch_modify_holds.pl">Return</a> >+ [% END %] >+ [% ELSIF view == 'report' %] >+ <div class="dialog message"> [% updated_holds.count | html %] holds have been modified! </div> >+ <div class="page-section"> >+ <table id="holds"> >+ <thead> >+ <tr> >+ <th>Expiration date</th> >+ <th>Title</th> >+ <th>Barcode</th> >+ <th>Hold pickup library</th> >+ <th>Suspended</th> >+ <th>Suspended until</th> >+ <th>Note</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH hold IN updated_holds %] > <tr> >- <th>Expiration date</th> >- <th>Title</th> >- <th>Barcode</th> >- <th>Hold pickup library</th> >- <th>Suspended</th> >- <th>Suspended until</th> >- <th>Note</th> >+ <td>[% hold.expirationdate | $KohaDates %]</td> >+ <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% hold.biblionumber | uri %]">[% hold.biblio.title | html %]</a></td> >+ <td >+ ><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% hold.itemnumber | uri %]&biblionumber=[% hold.biblionumber | uri %]&bi=[% hold.biblionumber | uri %]#item[% hold.itemnumber | uri %]" >+ >[% hold.item.barcode | html %]</a >+ ></td >+ > >+ <td>[% Branches.GetName( hold.branchcode ) | html %]</td> >+ <td>[% IF hold.suspend == 0 %]No[% ELSE %]Yes[% END %]</td> >+ <td>[% hold.suspend_until | $KohaDates %]</td> >+ <td>[% hold.reservenotes | html %]</td> > </tr> >- </thead> >- <tbody> >- [% FOREACH hold IN updated_holds %] >- <tr> >- <td>[% hold.expirationdate | $KohaDates %]</td> >- <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% hold.biblionumber | uri %]">[% hold.biblio.title | html %]</a></td> >- <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% hold.itemnumber | uri %]&biblionumber=[% hold.biblionumber | uri %]&bi=[% hold.biblionumber | uri %]#item[% hold.itemnumber | uri %]">[% hold.item.barcode | html %]</a></td> >- <td>[% Branches.GetName( hold.branchcode ) | html %]</td> >- <td>[% IF hold.suspend == 0 %]No[% ELSE %]Yes[% END %]</td> >- <td>[% hold.suspend_until | $KohaDates %]</td> >- <td>[% hold.reservenotes | html %]</td> >- </tr> >- [% END %] >- </tbody> >- </table> <!-- /#holds --> >- </div> <!-- /.page-section --> >- <a class="cancel" href="/cgi-bin/koha/tools/batch_modify_holds.pl">Return to batch hold modification</a> >- [% END %] >- </main> >- </div> <!-- /.col-sm-10 col-sm-push-2 --> >+ [% END %] >+ </tbody> >+ </table> >+ <!-- /#holds --> >+ </div> >+ <!-- /.page-section --> >+ <a class="cancel" href="/cgi-bin/koha/tools/batch_modify_holds.pl">Return to batch hold modification</a> >+ [% END %] >+ </main> >+ </div> >+ <!-- /.col-sm-10 col-sm-push-2 --> > >- >- <div class="col-sm-2 col-sm-pull-10"> >- <aside> >- [% INCLUDE 'tools-menu.inc' %] >- </aside> >- </div> <!-- /.col-sm-2 col-sm-pull-10 --> >- </div> <!-- /.row --> >+ <div class="col-sm-2 col-sm-pull-10"> >+ <aside> [% INCLUDE 'tools-menu.inc' %] </aside> >+ </div> >+ <!-- /.col-sm-2 col-sm-pull-10 --> > </div> >+ <!-- /.row --> >+</div> > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/tools-menu.js") | $raw %] > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'datatables.inc' %] > [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] > <script> >- $(document).ready(function() { >- >- $("#selectall").click(function(e){ >- e.preventDefault(); >- $("#found_holds input[type='checkbox']").each(function(){ >- $(this).prop("checked", true); >- }); >- }); >- >- $("#clearall").click(function(e){ >- e.preventDefault(); >- $("#found_holds input[type='checkbox']").each(function(){ >- $(this).prop("checked", false); >- }); >- }); >- >- $("#selectall").click(); >- >- $("#found_holds").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumnDefs": [ >- { "aTargets": [0], "bSortable": false, "bSearchable": false }, >+ $(document).ready(function () { >+ var holds_table_url = "/api/v1/holds"; >+ var table = $("#found_holds").kohaTable({ >+ ajax: { >+ url: holds_table_url, >+ }, >+ autoWidth: false, >+ embed: ["biblio", "pickup_library", "item"], >+ columns: [ >+ { >+ data: "hold_id", >+ searchable: true, >+ orderable: true, >+ }, >+ { >+ data: "expiration_date", >+ title: "Expiration date", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return $date(row.expiration_date); >+ }, >+ }, >+ { >+ data: "", >+ title: "Title", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return row.biblio.title; >+ }, >+ }, >+ { >+ data: "", >+ title: "Barcode", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ if (row.item_level) { >+ return row.item.external_id; >+ } else { >+ return "Bibliographic level hold"; >+ } >+ }, >+ }, >+ { >+ data: "status", >+ title: "Status", >+ searchable: true, >+ orderable: true, >+ }, >+ { >+ data: "pickup_library_id", >+ title: "Pickup library", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return row.pickup_library.name; >+ }, >+ }, >+ { >+ data: "suspended", >+ title: "Suspended", >+ searchable: true, >+ orderable: true, >+ render: function (data) { >+ return data ? "Yes" : "No"; >+ }, >+ }, >+ { >+ data: "suspended_until", >+ title: "Suspended until", >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return $date(row.suspended_until); >+ }, >+ }, >+ { >+ data: "notes", >+ title: "Notes", >+ searchable: true, >+ orderable: true, >+ }, > ], >- "sDom": 't', >- "aaSorting": [], >- "bPaginate": false >- })); >+ }); > >- $("#process").on('submit', function(e) { >+ $("#process").on("submit", function (e) { > var errors = []; > var reserve_ids = $("input[type=checkbox][name='hold_id']:checked"); > >@@ -290,26 +329,21 @@ > var new_suspend_status = $("#new_suspend_status").val(); > var new_suspend_date = $("#new_suspend_date").val(); > >- if ( reserve_ids.length == 0 ) { >- e.preventDefault(); >- errors.push(_("Please select at least one hold to process.")); >- return false; >- } >- if( new_pickup_loc || new_suspend_status ){ >- reserve_ids.each(function(){ >- if($(this).parents("tr").children(".found_status").data("found") != ""){ >+ if (new_pickup_loc || new_suspend_status) { >+ reserve_ids.each(function () { >+ if ($(this).parents("tr").children(".found_status").data("found") != "") { > e.preventDefault(); >- if( new_suspend_status ){ >+ if (new_suspend_status) { > errors.push(_("One or more holds have found status and can't be suspended.")); > } >- if( new_pickup_loc ){ >+ if (new_pickup_loc) { > errors.push(_("One or more holds have found status and their pick up location can't be changed.")); > } > return false; > } >- }) >+ }); > } >- if( ( !new_suspend_status || new_suspend_status == "not_suspended") && new_suspend_date ){ >+ if ((!new_suspend_status || new_suspend_status == "not_suspended") && new_suspend_date) { > e.preventDefault(); > errors.push(_("You have to suspend holds if new suspend until date is set.")); > return false; >@@ -318,7 +352,7 @@ > if (errors.length > 0) { > e.preventDefault(); > $("#errorList").html(errors.map(error => `<li>${error}</li>`).join("")); >- $("#errorModal").modal('show'); >+ $("#errorModal").modal("show"); > return false; > } > >@@ -328,4 +362,4 @@ > </script> > [% END %] > >-[% INCLUDE 'intranet-bottom.inc' %] >\ No newline at end of file >+[% INCLUDE 'intranet-bottom.inc' %] >-- >2.39.5
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 36135
:
163021
|
163022
|
163023
|
163024
|
163529
|
163530
|
163540
|
163541
|
163542
|
163543
|
163544
|
163796
|
164037
|
164051
|
164057
|
164058
|
164059
|
164060
|
164061
|
164062
|
164063
|
177518
|
177519
|
177959
|
177960
|
177961
|
177962
|
177963
|
177964
|
177965
|
177966
|
177967
|
177968
|
177969
|
177975
|
177976
|
177981
|
177982
|
178154
|
178155
|
178156
|
178157
|
178158
|
178159
|
178160
|
178161
|
178162
|
178163
|
178164
|
178165
|
178166
|
178167
|
178954
|
179028
|
179029
|
179030
|
179031
|
179032
|
179033
|
179034
|
179035
|
179036
|
179037
|
179038
|
179039
|
179040
|
179041
|
179042
|
179081
|
179082
|
181049
|
183151
|
183294
|
183295
|
183296
|
183297
|
183298
|
183299
|
183300
|
183305
|
183306
|
183307
|
183308
|
183771