Bugzilla – Attachment 102650 Details for
Bug 25101
Add ability to skip previewing results when batch extending due dates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25101: Add ability to skip previewing results when batch extending due dates
Bug-25101-Add-ability-to-skip-previewing-results-w.patch (text/plain), 5.34 KB, created by
Kyle M Hall (khall)
on 2020-04-09 17:24:20 UTC
(
hide
)
Description:
Bug 25101: Add ability to skip previewing results when batch extending due dates
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-04-09 17:24:20 UTC
Size:
5.34 KB
patch
obsolete
>From 3a8d036e3d8ed26a387a461f13c171ad090bcb09 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 9 Apr 2020 13:22:01 -0400 >Subject: [PATCH] Bug 25101: Add ability to skip previewing results when batch > extending due dates > >For sites with very large amounts of due dates to extend ( tens of thousands ), it can take a very long time of the results to load ( if at all ). It would be good to have a way to bypass the confirmation screen, instead directly updating the due dates before displaying the results. > >Test Plan: >1) Apply this patch >2) Browse to tools/batch_extend_due_dates.pl >3) Note the new "Preview results" checkbox >4) Submit form with the checkbox unchecked, due dates should be updated > without previewing the checkouts >5) Submit form with the checkbox checked, tool should function as > it did previously >--- > .../modules/tools/batch_extend_due_dates.tt | 9 +++ > tools/batch_extend_due_dates.pl | 60 +++++++++++++------ > 2 files changed, 50 insertions(+), 19 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_extend_due_dates.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_extend_due_dates.tt >index e572b2b3d7..623108a21c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_extend_due_dates.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_extend_due_dates.tt >@@ -97,6 +97,15 @@ > </li> > </ol> > </fieldset> >+ <fieldset class="rows"> >+ <legend>Options:</legend> >+ <ol> >+ <li> >+ <label for="preview_results">Preview results:</label> >+ <input type="checkbox" name="preview_results" id="preview_results" /> >+ </li> >+ </ol> >+ </fieldset> > <fieldset class="action"> > <input type="hidden" name="op" value="list" /> > <input type="submit" value="Continue" class="button" /> >diff --git a/tools/batch_extend_due_dates.pl b/tools/batch_extend_due_dates.pl >index 46f97a25bb..1b9f239ed4 100755 >--- a/tools/batch_extend_due_dates.pl >+++ b/tools/batch_extend_due_dates.pl >@@ -30,6 +30,7 @@ use Koha::DateUtils qw( dt_from_string output_pref ); > > my $input = new CGI; > my $op = $input->param('op') // q|form|; >+my $preview_results = $input->param('preview_results'); > > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { >@@ -41,6 +42,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >+my @issue_ids; >+ > if ( $op eq 'form' ) { > $template->param( view => 'form', ); > } >@@ -103,33 +106,52 @@ elsif ( $op eq 'list' ) { > > my @new_due_dates; > while ( my $checkout = $checkouts->next ) { >- push @new_due_dates, >- output_pref({ dt => calc_new_due_date( >- { >- due_date => dt_from_string($checkout->date_due), >- new_hard_due_date => $new_hard_due_date, >- add_days => $due_date_days >- } >- ), dateformat => 'iso' }); >+ if ($preview_results) { >+ push( >+ @new_due_dates, >+ output_pref( >+ { >+ dt => calc_new_due_date( >+ { >+ due_date => >+ dt_from_string( $checkout->date_due ), >+ new_hard_due_date => $new_hard_due_date, >+ add_days => $due_date_days >+ } >+ ), >+ dateformat => 'iso' >+ } >+ ) >+ ); >+ } else { >+ push( @issue_ids, $checkout->id ); >+ } > } > >- $template->param( >- checkouts => $checkouts, >- new_hard_due_date => $new_hard_due_date >- ? dt_from_string($new_hard_due_date) >- : undef, >- due_date_days => $due_date_days, >- new_due_dates => \@new_due_dates, >- view => 'list', >- ); >+ if ( $preview_results ) { >+ $template->param( >+ checkouts => $checkouts, >+ new_hard_due_date => $new_hard_due_date >+ ? dt_from_string($new_hard_due_date) >+ : undef, >+ due_date_days => $due_date_days, >+ new_due_dates => \@new_due_dates, >+ view => 'list', >+ ); >+ } else { >+ $op = 'modify'; >+ } > } >-elsif ( $op eq 'modify' ) { >+ >+if ( $op eq 'modify' ) { > > # We want to modify selected checkouts! >- my @issue_ids = $input->multi_param('issue_id'); > my $new_hard_due_date = $input->param('new_hard_due_date'); > my $due_date_days = $input->param('due_date_days'); > >+ # @issue_ids will already be populated if we are skipping the results display >+ @issue_ids = $input->multi_param('issue_id') unless @issue_ids; >+ > $new_hard_due_date &&= dt_from_string($new_hard_due_date); > my $checkouts = > Koha::Checkouts->search( { issue_id => { -in => \@issue_ids } } ); >-- >2.24.1 (Apple Git-126)
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 25101
:
102650
|
102654
|
106937
|
109292
|
109293
|
109294
|
109425
|
109529
|
109530