From 9d5cf0a66764324e190b04e74b9f49a7bbad2e17 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 7 Mar 2025 14:49:36 +0000 Subject: [PATCH] Bug 36135: (follow-up) Fix link style on guided report page Sponsored-by: Koha-Suomi Oy --- .../modules/reports/guided_reports_start.tt | 21 +- .../en/modules/tools/batch_modify_holds.tt | 780 +++++++++--------- tools/batch_modify_holds.pl | 30 +- 3 files changed, 436 insertions(+), 395 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index 406834a8463..76221287328 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -1071,17 +1071,14 @@ > -
- - [% FOREACH result IN results %] - [% FOREACH cells IN result.cells %] - [% place = loop.index %] - [% IF header_row.$place.cell == 'reserve_id' || header_types.item(header_row.$place.cell) == 'reserve_id' %] - [% SET batch_reserve_ids = 1 %] - - [% END %] - [% END %] - [% END %] + + [% INCLUDE 'csrf-token.inc' %] + +
[% BLOCK batch_list %] @@ -1227,7 +1224,7 @@ data-toggle="tooltip" data-placement="right" title="Send visible results to batch hold modification" - class="batch_op send_to_hold_mod" + class="batch_op send_to_hold_mod dropdown-item" >Batch hold modification 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 d1493f81a10..b0fe375af1b 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 @@ -42,7 +42,7 @@

Batch modify holds

- [% IF view == "form" %] + [% IF view == "cud-form" %] + + +
+ [% ELSIF view == "report" %]
-
+
+
Return to batch hold modification -
- + + + [% END %] +
[% INCLUDE 'csrf-token.inc' %]
@@ -122,10 +127,12 @@ Clear
- + +

Holds found for:

- + +

Modify holds

@@ -161,208 +168,427 @@ -
- + - +
-
+ + + +
Cancel
-
- + + + + - + +
- -
+ + + -[% MACRO jsinclude BLOCK %] - [% Asset.js("js/tools-menu.js") | $raw %] - [% INCLUDE 'calendar.inc' %] - [% INCLUDE 'datatables.inc' %] - [% INCLUDE 'select2.inc' %] - [% INCLUDE 'js-patron-format.inc' %] - [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] - + [% END %] - //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 '' + escape_str( data ) + ''; - } - }, - { - "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 '' + escape_str( data ) + '' - } - } - }, - { - "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 = '
'+hold_ids.length+' hold(s) have been modified!
'; - $("#modified_holds_results-wrapper").prepend(modified_message); - - }); - -[% END %] - -[% INCLUDE 'intranet-bottom.inc' %] \ No newline at end of file + [% INCLUDE 'intranet-bottom.inc' %] + diff --git a/tools/batch_modify_holds.pl b/tools/batch_modify_holds.pl index a5a95948e54..c73b1f332e8 100755 --- a/tools/batch_modify_holds.pl +++ b/tools/batch_modify_holds.pl @@ -30,7 +30,7 @@ use Koha::DateUtils qw( dt_from_string ); use Koha::Holds; my $input = CGI->new; -my $op = $input->param('op') // q|form|; +my $op = $input->param('op') // q|cud-form|; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -43,8 +43,13 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my @hold_ids; -if ( $op eq 'form' ) { - $template->param( view => 'form', ); +if ( $op eq 'cud-form' ) { + my $reserve_ids_list = $input->param('reserve_ids_list') || undef; + if ($reserve_ids_list) { + my @reserve_ids = split /\n/, $reserve_ids_list; + $template->param( reserve_ids_list => to_json( \@reserve_ids ), ); + } + $template->param( view => 'cud-form', ); } elsif ( $op eq 'cud-modify' ) { my $new_expiration_date = $input->param('new_expiration_date'); my $new_pickup_loc = $input->param('new_pickup_loc'); @@ -68,18 +73,19 @@ if ( $op eq 'form' ) { $hold->branchcode($new_pickup_loc)->store; } - if ( $new_suspend_status ne "" && !$hold->is_found ) { - if ($new_suspend_status) { - $hold->suspend(1)->store; - if ($new_suspend_date) { - $hold->suspend_until($new_suspend_date)->store; - } else { - $hold->suspend_until(undef)->store; - } + if ( $new_suspend_status && $new_suspend_status ne "" && !$hold->is_found ) { + $hold->suspend(1)->store; + if ($new_suspend_date) { + $hold->suspend_until($new_suspend_date)->store; } else { - $hold->suspend(0)->store; $hold->suspend_until(undef)->store; } + } elsif ( !$new_suspend_status && $new_suspend_date ) { + $hold->suspend(1)->store; + $hold->suspend_until($new_suspend_date)->store; + } else { + $hold->suspend(0)->store; + $hold->suspend_until(undef)->store; } if ($new_hold_note) { -- 2.39.5