Bugzilla – Attachment 183151 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: Add several fixes
0001-Bug-36135-Add-several-fixes.patch (text/plain), 10.90 KB, created by
Emmi Takkinen
on 2025-06-11 10:47:46 UTC
(
hide
)
Description:
Bug 36135: Add several fixes
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2025-06-11 10:47:46 UTC
Size:
10.90 KB
patch
obsolete
>From b90e3d75e641576c26287b865a71527e9b15aef0 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Tue, 6 May 2025 11:55:42 +0300 >Subject: [PATCH] Bug 36135: Add several fixes > >This patch adds several fixes and improvements: > >-Allow open-ended search >To test: >1. Find holds to modify and fill either "Expiration date from" >field or "Expiration date to" field. >2. Click "Search" button. >=> Confirm that your search contains holds that match >your search. > >-Suspend hold if new suspend until date is set >To test: >1. Find some holds to modify which can be suspended. >2. Select holds to modify from your search and set >new suspended date for them. Do not select new suspended >status from "Suspend holds" dropdown. >3. Click "Modify holds" button. >=> Confirm that pop-up preventing modificating holds >suspend date without setting new suspend status is >not displayed and holds are now suspended with new >suspended until date. > >-Add word "and" to suspend date filter message >-Change "form" to "cud-form" in guided_reports_start.tt >to prevent programming error message > >Sponsored-by: Koha-Suomi Oy >--- > .../modules/reports/guided_reports_start.tt | 2 +- > .../en/modules/tools/batch_modify_holds.tt | 42 +++++++++++++------ > tools/batch_modify_holds.pl | 25 +++++------ > 3 files changed, 44 insertions(+), 25 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 cc191e2efc..7622128732 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 >@@ -1073,7 +1073,7 @@ > > <form method="post" action="/cgi-bin/koha/tools/batch_modify_holds.pl" id="batch_modify_holds" target="_blank"> > [% INCLUDE 'csrf-token.inc' %] >- <input type="hidden" name="op" value="form" /> >+ <input type="hidden" name="op" value="cud-form" /> > <textarea style="display:none" name="reserve_ids_list" id="reserve_ids_list"> > [%# Preserve the whitespace of the following textarea in order to format the values correctly %] > [%- reserve_ids = PROCESS batch_list results=results batch_type='reserve_id' | trim | html %][% IF reserve_ids %][% SET batch_reserve_ids = 1 %][% reserve_ids | html %][% END -%] >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 622dd1b84b..436732bcd6 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 @@ > <div class="col-sm-10 col-sm-push-2 order-sm-1"> > <main> > <h1>Batch modify holds</h1> >- [% IF view == "form" %] >+ [% IF view == "cud-form" %] > <div id="modify_holds_search"> > <form method="get" action="/cgi-bin/koha/tools/batch_modify_holds.pl" id="modify_holds_form"> > <fieldset class="rows"> >@@ -50,7 +50,7 @@ > <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="expirationdate_to" /> >+ <input type="text" size="10" id="expirationdate_from" name="expirationdate_from" class="flatpickr" /> > </li> > <li> > <label for="expirationdate_to">Expiration date to:</label> >@@ -303,9 +303,17 @@ > var expirationdate_from = modify_holds_form.find("#expirationdate_from").val(); > var expirationdate_to = modify_holds_form.find("#expirationdate_to").val(); > >- searchpattern += expirationdate_from && expirationdate_to ? _("expiration date between ")+ expirationdate_from + " and " + expirationdate_to + " ": ""; >- >- return expirationdate_from && expirationdate_to ? {"-between": [expirationdate_from, expirationdate_to]} : ""; >+ if (expirationdate_from && expirationdate_to){ >+ searchpattern += _("expiration date between ") + expirationdate_from + " and " + expirationdate_to + " "; >+ return {"-between": [expirationdate_from, expirationdate_to]}; >+ } >+ else if (expirationdate_from && !expirationdate_to){ >+ searchpattern += _("expiration date from ") + expirationdate_from + " "; >+ return {">=": expirationdate_from }; >+ } else if (!expirationdate_from && expirationdate_to){ >+ searchpattern += _("expiration date to ") + expirationdate_to + " "; >+ return {"<=": expirationdate_to }; >+ } > }, > "me.branchcode": function(){ > var branchcodes = modify_holds_form.find("#branchcodes").val(); >@@ -354,7 +362,7 @@ > 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 +"-"+suspend_until_to : ""; >+ 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]} : ""; > }, >@@ -468,10 +476,12 @@ > { > "data": "suspended", > "name": "suspended", >+ "className": "suspended", > "title": _("Suspended"), > "orderable": true, > "render": function( data, type, row, meta ) { >- return data == 0 ? _("No") : _("Yes"); >+ var suspended_string = data == 0 ? _("No") : _("Yes"); >+ return "<span data-suspended='" + data + "'>" + suspended_string + "</span>"; > } > }, > { >@@ -521,7 +531,7 @@ > errors.push(_("Please select at least one hold to process.")); > } > >- if( new_pickup_loc || new_suspend_status ){ >+ if( new_pickup_loc || new_suspend_status || new_suspend_date ){ > var found = false; > holds_checked.each(function(){ > if($(this).parents("tr").children(".found_status").children("span").data("found-status")){ >@@ -529,16 +539,24 @@ > found = true; > } > }); >- if( new_suspend_status && found ){ >+ if( ( new_suspend_status || new_suspend_date ) && found ){ > errors.push(_("One or more holds have found status and can't be suspended.")); > } > if( new_pickup_loc && found ){ > errors.push(_("One or more holds have found status and their pick up location can't be changed.")); > } > } >- if( ( !new_suspend_status || new_suspend_status == "0") && new_suspend_date ){ >- e.preventDefault(); >- errors.push(_("You have to suspend holds if new suspend until date is set.")); >+ >+ var suspended = false; >+ >+ holds_checked.each(function(){ >+ if($(this).parents("tr").children(".suspended").children("span").data("suspended")){ >+ suspended = true; >+ } >+ }); >+ >+ if( ( !new_suspend_status || new_suspend_status == "0" || !suspended ) && new_suspend_date ){ >+ new_suspend_status = 1; > } > > if (errors.length > 0) { >diff --git a/tools/batch_modify_holds.pl b/tools/batch_modify_holds.pl >index 58b1f45efc..fb3d7ef9d2 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,13 +43,13 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > > my @hold_ids; > >-if ( $op eq '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 => 'form', ); >+ $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'); >@@ -73,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.34.1 >
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