From d2d97ae0589c03761be824664eace999f5b3baf9 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Mon, 25 Mar 2024 09:56:25 +0200 Subject: [PATCH] Bug 36135: Add several new features This patch adds following new features to batch modify holds tool. - Do not automatically select login library as search param - Add biblios title and items barcode to found holds table - Add count of found holds at top of the table - Add ability to do not change pick up library - Display those hold rows with some found status in different color Sponsored-by: Koha-Suomi Oy Signed-off-by: Lucas Gass --- .../en/modules/tools/batch_modify_holds.tt | 28 ++++++++++++------- tools/batch_modify_holds.pl | 7 +++-- 2 files changed, 23 insertions(+), 12 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 2b7220a5ee8..07d3cba20e7 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 @@ -61,7 +61,7 @@
  • @@ -108,6 +108,7 @@
    [% INCLUDE 'csrf-token.inc' %] [% IF holds.count %] +

    Found [% holds.count | html %][% IF holds.count > 1 %] holds [% ELSE %] hold [% END %]to modify.

    Select all @@ -119,6 +120,8 @@   Expiration date Patron expiration date + Title + Barcode Status Hold pickup library Suspended @@ -128,10 +131,12 @@ [% FOREACH hold IN holds %] - + [% hold.expirationdate | $KohaDates %] [% hold.patron_expiration_date | $KohaDates %] + [% hold.item.biblio.title | html %] + [% hold.item.barcode | html %] [% IF hold.found == "T" %] In transit @@ -169,8 +174,9 @@ - + + [% PROCESS options_for_libraries libraries => Branches.pickup_locations(selected = "") %] @@ -206,10 +212,6 @@ Holds have been modified!
    - @@ -282,6 +284,7 @@ $("#process").on('submit', function(e) { var reserve_ids = $("input[type=checkbox][name='hold_id']:checked"); + var new_pickup_loc = $("#new_pickup_loc").val(); var new_suspend_status = $("#new_suspend_status").val(); var new_suspend_date = $("#new_suspend_date").val(); @@ -290,11 +293,16 @@ alert(_("Please select at least one hold to process.")); return false; } - if( new_suspend_status ){ + if( new_pickup_loc || new_suspend_status ){ reserve_ids.each(function(){ if($(this).parents("tr").children(".found_status").data("found") != ""){ e.preventDefault(); - alert(_("One or more holds have found status and can't be suspended.")); + if( new_suspend_status ){ + alert(_("One or more holds have found status and can't be suspended.")); + } + if( new_pickup_loc ){ + alert(_("One or more holds have found status and their pick up location can't be changed.")); + } return false; } }) diff --git a/tools/batch_modify_holds.pl b/tools/batch_modify_holds.pl index b69b8dd80ac..0762ad1f3fb 100644 --- a/tools/batch_modify_holds.pl +++ b/tools/batch_modify_holds.pl @@ -118,7 +118,10 @@ if ( $op eq 'form' ) { } } - my $holds = Koha::Holds->search($search_params); + my $holds = Koha::Holds->search( + $search_params, + { join => ["item"] } + ); $template->param( holds => $holds, @@ -144,7 +147,7 @@ if ( $op eq 'cud-modify' ) { $hold->expirationdate($new_expiration_date)->store; } - unless ( $hold->branchcode eq $new_pickup_loc ) { + if ( $new_pickup_loc && ( $hold->branchcode ne $new_pickup_loc ) ) { $hold->branchcode($new_pickup_loc)->store; } -- 2.39.5