Bug 36135: (follow-up) Fix suspension search and other improvements

This patch tries to fix the hold suspension search by copying the code
from the expiration date search function.

The patch also makes these changes:

- Change page title to use i18n functions
- Add specific breadcrumb for results page
- Update headings between search and results page
- Correct table settings (definition was missing from
  columns_settings.yml
- Correct capitalization (e.g. "Pickup location" instead of "Pickup
  Location"
- Use include files for displaying title and patron in update results
- Add subtitle and medium to title in search results
- Remove quotes from DataTables option names
- Add hold date to the search results view.
  - Without a specified default sort, the table will sort the first
    column. Since the first column is checkboxes, we ought to explicitly
    set a default sorting column. I thought hold date seemed like a
    better default than title.

Signed-off-by: Jason Robb <jrobb@sekls.org>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit dc74b4821d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Owen Leonard 2025-07-09 19:51:33 +00:00 committed by Paul Derscheid
parent 645a4fd7c5
commit 2248ac8544
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
2 changed files with 84 additions and 52 deletions

View File

@ -2046,31 +2046,7 @@ modules:
columnname: suspend
-
columnname: print_slip
holds_to_modify:
default_display_length: 20
columns:
-
columnname: checkbox
cannot_be_toggled: 1
cannot_be_modified: 1
-
columnname: expiration_date
-
columnname: title
-
columnname: barcode
-
columnname: patron
-
columnname: status
-
columnname: pickup_library
-
columnname: suspended
-
columnname: suspended_until
-
columnname: notes
modified_holds:
default_display_length: 20
columns:
@ -2523,6 +2499,35 @@ modules:
-
columnname: batch_patron_edit_debarredcomment
batch_hold_modification:
holds_to_modify:
default_display_length: 20
columns:
-
columnname: batch_hold_edit_selections
cannot_be_toggled: 1
cannot_be_modified: 1
-
columnname: batch_hold_edit_hold_date
-
columnname: batch_hold_edit_expiration_date
-
columnname: batch_hold_edit_title
-
columnname: batch_hold_edit_barcode
-
columnname: batch_hold_edit_patron
-
columnname: batch_hold_edit_status
-
columnname: batch_hold_edit_hold_pickup_library
-
columnname: batch_hold_edit_suspended
-
columnname: batch_hold_edit_suspended_until
-
columnname: batch_hold_edit_note
logviewer:
logst:
default_display_length: 20

View File

@ -8,9 +8,11 @@
[% USE TablesSettings %]
[% USE To %]
[% PROCESS 'html_helpers.inc' %]
[% PROCESS 'i18n.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Batch modify holds &rsaquo; Tools &rsaquo; Koha</title>
[% FILTER collapse %]
<title> [% t("Batch modify holds") | html %] &rsaquo; [% t("Tools") | html %] &rsaquo; [% t("Koha") | html %] </title>
[% END %]
[% INCLUDE 'doc-head-close.inc' %]
[% Asset.css("css/humanmsg.css") | $raw %]
</head>
@ -25,12 +27,15 @@
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
[% END %]
[% IF ( view == 'form' || view == 'report' ) %]
[% IF ( view == 'report' ) %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/tools/batch_modify_holds.pl">Batch modify holds</a>
[% END %]
[% ELSE %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Modified holds</span>
[% END %]
[% ELSE %]
[% WRAPPER breadcrumb_item %]
<span>Batch modify holds</span>
[% END %]
[% END %]
@ -41,8 +46,8 @@
<div class="row">
<div class="col-sm-10 col-sm-push-2 order-sm-1">
<main>
<h1>Batch modify holds</h1>
[% IF view == "cud-form" %]
<h1>Batch modify holds</h1>
<div id="modify_holds_search">
<form method="get" action="/cgi-bin/koha/tools/batch_modify_holds.pl" id="modify_holds_form">
<fieldset class="rows">
@ -101,6 +106,7 @@
</div>
<!-- /#modify_holds_search -->
[% ELSIF view == "report" %]
<h1>Modified holds</h1>
<div id="modified_holds_results-wrapper">
<div id="modified_holds_results" class="page-section">
<table id="modified_holds">
@ -108,12 +114,12 @@
<tr>
<th>Title</th>
<th>Patron</th>
<th>Pickup Location</th>
<th>Pickup location</th>
<th>Priority</th>
<th>Expiration Date</th>
<th>Expiration date</th>
<th>Status</th>
<th>Suspended</th>
<th>Suspended Until</th>
<th>Suspended until</th>
<th>Notes</th>
<!-- Add other columns as needed -->
</tr>
@ -121,8 +127,8 @@
<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>[% INCLUDE 'biblio-title.inc' biblio=hold.biblio link = 1 %]</td>
<td>[% INCLUDE 'patron-title.inc' invert_name=1 patron=hold.borrower hide_patron_infos_if_needed=1 link_to="circulation_reserves" %]</td>
<td>[% hold.branch.branchname | html %]</td>
<td>[% hold.priority | html %]</td>
<td>[% hold.expirationdate | $KohaDates %]</td>
@ -247,6 +253,7 @@
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'select2.inc' %]
[% INCLUDE 'js-biblio-format.inc' %]
[% INCLUDE 'js-patron-format.inc' %]
[% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
<script>
@ -347,7 +354,7 @@
}
function search_holds(modify_holds_form){
var table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'holds_to_modify', 'json' ) | $raw %];
var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'batch_hold_modification', 'holds_to_modify', 'json' ) | $raw %];
var searchpattern = "";
var filters = {
"me.expirationdate": function(){
@ -410,12 +417,20 @@
}
},
"me.suspend_until": function(){
var suspend_until_from = modify_holds_form.find("#suspend_until_from").val();
var suspend_until_to = modify_holds_form.find("#suspend_until_to").val();
var suspend_until_from = modify_holds_form.find("#suspend_until_from").val();
var suspend_until_to = modify_holds_form.find("#suspend_until_to").val();
searchpattern += suspend_until_from && suspend_until_to ? _("suspend date between ")+ suspend_until_from +" and "+suspend_until_to : "";
return suspend_until_from && suspend_until_to ? {"-between": [suspend_until_from, suspend_until_to]} : "";
if (suspend_until_from && suspend_until_to){
searchpattern += _("suspend date between ") + suspend_until_from + " and " + suspend_until_to + " ";
return {"-between": [suspend_until_from, suspend_until_to]};
}
else if (suspend_until_from && !suspend_until_to){
searchpattern += _("suspend date from ") + suspend_until_from + " ";
return {">=": suspend_until_from };
} else if (!suspend_until_from && suspend_until_to){
searchpattern += _("suspend date to ") + suspend_until_to + " ";
return {"<=": suspend_until_to };
}
},
"me.notes": function(){
var holdnotes = modify_holds_form.find("#holdnotes").val();
@ -430,19 +445,22 @@
}
var holds_modify_table = $("#holds_to_modify").kohaTable({
"ajax": {
ajax: {
"url": "/api/v1/holds"
},
"embed": [
embed: [
"biblio",
"item",
"pickup_library",
"patron"
],
"destroy": true,
"autoWidth": false,
"processing": true,
"columns": [
destroy: true,
autoWidth: false,
processing: true,
order: [
[1, 'asc']
],
columns: [
{
"data": "hold_id",
"name": "checkbox",
@ -451,6 +469,16 @@
return '<input class="selection" type="checkbox" value="'+ encodeURIComponent(data) +'"/>'
}
},
{
"data": "hold_date",
"name": "hold_date",
"type": "date",
"title": _("Hold date"),
"orderable": true,
"render": function( data, type, row, meta ) {
return $date(data);
}
},
{
"data": "expiration_date",
"name": "expiration_date",
@ -462,13 +490,12 @@
}
},
{
"data": "biblio.title",
"name": "title",
"data": "biblio.title:biblio.subtitle:biblio.medium",
"title": _("Title"),
"searchable": true,
"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>';
"render": function(data, type, row, meta) {
return $biblio_to_html(row.biblio, { link: 1 });
}
},
{