Bugzilla – Attachment 183771 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: Make modified_holds table not use the API
Bug-36135-Make-modifiedholds-table-not-use-the-API.patch (text/plain), 11.73 KB, created by
Lucas Gass (lukeg)
on 2025-07-03 17:04:09 UTC
(
hide
)
Description:
Bug 36135: Make modified_holds table not use the API
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-07-03 17:04:09 UTC
Size:
11.73 KB
patch
obsolete
>From 5c8ab275027f85f0c082e88c5ae5af4ccf89275a Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Thu, 3 Jul 2025 17:03:17 +0000 >Subject: [PATCH] Bug 36135: Make modified_holds table not use the API > >--- > .../en/modules/tools/batch_modify_holds.tt | 177 +++++------------- > tools/batch_modify_holds.pl | 8 +- > 2 files changed, 57 insertions(+), 128 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 1b3c2ca8f7d..4850a8a01a3 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 >@@ -103,7 +103,53 @@ > [% ELSIF view == "report" %] > <div id="modified_holds_results-wrapper"> > <div id="modified_holds_results" class="page-section"> >- <table id="modified_holds"></table> >+ <table id="modified_holds"> >+ <thead> >+ <tr> >+ <th>Title</th> >+ <th>Patron</th> >+ <th>Pickup Location</th> >+ <th>Priority</th> >+ <th>Expiration Date</th> >+ <th>Status</th> >+ <th>Suspended</th> >+ <th>Suspended Until</th> >+ <th>Notes</th> >+ <!-- Add other columns as needed --> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH hold IN updated_holds_obj %] >+ <tr> >+ <td>[% hold.biblio.title | html %]</td> >+ <td>[% hold.borrower.firstname | html %] [% hold.borrower.surname | html %]</td> >+ <td>[% hold.branch.branchname | html %]</td> >+ <td>[% hold.priority | html %]</td> >+ <td>[% hold.expirationdate | $KohaDates %]</td> >+ <td> >+ [% IF hold.found == 'F' %] >+ <span>Fulfilled</span> >+ [% ELSIF hold.cancellationdate %] >+ <span>Cancelled</span> >+ [% ELSIF hold.found == 'W' %] >+ [% IF hold.cancellation_requests.count == 0 %] >+ <span>Waiting</span> >+ [% ELSE %] >+ <span>Cancelled</span> >+ [% END %] >+ [% ELSIF hold.found == 'T' %] >+ <span>In transit</span> >+ [% ELSE %] >+ <span>Pending</span> >+ [% END %] >+ </td> >+ <td>[% IF hold.suspend %]Yes[% ELSE %]No[% END %]</td> >+ <td>[% IF hold.suspend_until %][% hold.suspend_until | $KohaDates %][% ELSE %]-[% END %]</td> >+ <td>[% hold.reservenotes | html %]</td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> > </div> > <!-- /#modified_holds_results --> > <fieldset class="action"> >@@ -582,131 +628,10 @@ > > //Modified holds table > var table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'modified_holds', 'json' ) | $raw %]; >- var filters = { >- "me.hold_id": function(){ >- return {"-in": hold_ids}; >- } >- } >- >- var holds_modified_table = $("#modified_holds").kohaTable({ >- "ajax": { >- "url": "/api/v1/holds" >- }, >- "embed": [ >- "biblio", >- "item", >- "pickup_library", >- "patron" >- ], >- "destroy": true, >- "autoWidth": false, >- "processing": true, >- "columns": [ >- { >- "data": "expiration_date", >- "name": "expiration_date", >- "type": "date", >- "title": _("Expiration date"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- return $date(data); >- } >- }, >- { >- "data": "biblio.title", >- "name": "title", >- "title": _("Title"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- return '<a href="/cgi-bin/koha/catalogue/detail.pl?' + >- 'biblionumber=' + encodeURIComponent( row.biblio_id ) + '">' + escape_str( data ) + '</a>'; >- } >- }, >- { >- "data": "item.external_id", >- "name": "barcode", >- "title": _("Barcode"), >- "defaultContent": _(""), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- if( row.item ){ >- let item_id = encodeURIComponent( row.item_id ); >- let biblio_id = encodeURIComponent( row.biblio_id ); >- return '<a href="/cgi-bin/koha/catalogue/moredetail.pl?' + >- 'itemnumber='+ item_id +'&biblionumber='+ biblio_id +'&' + >- 'bi='+ biblio_id +'#item'+ item_id +'">' + escape_str( data ) + '</a>' >- } >- } >- }, >- { >- "data": "patron_id", >- "name": "patron", >- "title": _("Patron"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- let patron_to_html = $patron_to_html(row.patron, { url: true, display_cardnumber: true, hide_patron_name }); >- return patron_to_html; >- } >- }, >- { >- "data": "status", >- "name": "status", >- "className": "found_status", >- "title": _("Status"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- let status = _("No status"); >- if ( data == "T" ) { >- status = _("In transit"); >- } else if( data == "P" ) { >- status = _("In processing"); >- } else if( data == "W" ) { >- status = _("Waiting"); >- } >- return status; >- } >- }, >- { >- "data": "pickup_library_id", >- "name": "pickup_library", >- "title": _("Hold pickup library"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- return escape_str( row.pickup_library.name ); >- } >- }, >- { >- "data": "suspended", >- "name": "suspended", >- "title": _("Suspended"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- return data == 0 ? _("No") : _("Yes"); >- } >- }, >- { >- "data": "suspended_until", >- "name": "suspended_until", >- "title": _("Suspended until"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- return $date( data ); >- } >- }, >- { >- "data": "notes", >- "name": "notes", >- "title": _("Notes"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- return escape_str( data ); >- } >- } >- ] >- }, table_settings, 0, filters); >- >- var modified_message = '<div class="alert alert-info">'+hold_ids.length+' hold(s) have been modified!</div>'; >- $("#modified_holds_results-wrapper").prepend(modified_message); >+ $("#modified_holds").kohaTable({ >+ pagingType: "full", >+ autoWidth: false >+ }, table_settings); > > }); > </script> >diff --git a/tools/batch_modify_holds.pl b/tools/batch_modify_holds.pl >index c73b1f332e8..ea0ab14f091 100755 >--- a/tools/batch_modify_holds.pl >+++ b/tools/batch_modify_holds.pl >@@ -59,6 +59,7 @@ if ( $op eq 'cud-form' ) { > my $clear_hold_notes = $input->param('clear_hold_notes'); > > @hold_ids = $input->multi_param('hold_id'); >+ my @holds_data = (); > > my $holds_to_update = > Koha::Holds->search( { reserve_id => { -in => \@hold_ids } }, { join => [ "item", "biblio" ] } ); >@@ -95,11 +96,14 @@ if ( $op eq 'cud-form' ) { > if ($clear_hold_notes) { > $hold->reservenotes(undef)->store; > } >+ push @holds_data, $hold; > } > > $template->param( >- updated_holds => to_json( \@hold_ids ), >- view => 'report', >+ updated_holds => to_json( \@hold_ids ), >+ updated_holds_obj => \@holds_data, >+ total_updated => scalar @holds_data, >+ view => 'report', > ); > > } >-- >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