Bugzilla – Attachment 42976 Details for
Bug 11565
decreaseLoanHighHolds needs Override
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11565 - decreaseLoanHighHolds needs Override
Bug-11565---decreaseLoanHighHolds-needs-Override.patch (text/plain), 9.35 KB, created by
Kyle M Hall (khall)
on 2015-09-30 16:37:46 UTC
(
hide
)
Description:
Bug 11565 - decreaseLoanHighHolds needs Override
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-09-30 16:37:46 UTC
Size:
9.35 KB
patch
obsolete
>From 0a66951dd45e645aadcfcf47163310b1966e28ef Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 30 Sep 2015 11:48:14 -0400 >Subject: [PATCH] Bug 11565 - decreaseLoanHighHolds needs Override > >This patch allows the high holds loan length decrease to be overridden >either by a checkbox that remembers its setting during a series of >checkouts, or by a one time use override checkbox that will show >in the warning popup if a checkout is affected by high holds. > >Test Plan: >1) Set up a checkout that will be affected by decreaseLoanHighHolds >2) Attempt to check out an item >3) Check the override checkbox >4) Note the checkout date is not reduced >5) Return the item >6) Start a new checkout for the patron >7) Check the "Don't decrease lean length based on holds" checkbox >8) Check out the item >9) Note you are not warned about the high holds decrease > and that the checkout length is not reduced >--- > C4/Circulation.pm | 6 +- > circ/circulation.pl | 6 ++- > .../prog/en/modules/circ/circulation.tt | 44 +++++++++++++++++--- > .../{ => Circulation}/DecreaseLoanHighHolds.t | 20 ++++++++- > 4 files changed, 63 insertions(+), 13 deletions(-) > rename t/db_dependent/{ => Circulation}/DecreaseLoanHighHolds.t (86%) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index eadaba6..59008d8 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -604,7 +604,7 @@ sub itemissues { > =head2 CanBookBeIssued > > ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $borrower, >- $barcode, $duedatespec, $inprocess, $ignore_reserves ); >+ $barcode, $duedatespec, $inprocess, $ignore_reserves, $override_high_holds ); > > Check if a book can be issued. > >@@ -696,7 +696,7 @@ if the borrower borrows to much things > =cut > > sub CanBookBeIssued { >- my ( $borrower, $barcode, $duedate, $inprocess, $ignore_reserves ) = @_; >+ my ( $borrower, $barcode, $duedate, $inprocess, $ignore_reserves, $override_high_holds ) = @_; > my %needsconfirmation; # filled with problems that needs confirmations > my %issuingimpossible; # filled with problems that causes the issue to be IMPOSSIBLE > my %alerts; # filled with messages that shouldn't stop issuing, but the librarian should be aware of. >@@ -1010,7 +1010,7 @@ sub CanBookBeIssued { > } > > ## check for high holds decreasing loan period >- if ( C4::Context->preference('decreaseLoanHighHolds') ) { >+ if ( !$override_high_holds && C4::Context->preference('decreaseLoanHighHolds') ) { > my $check = checkHighHolds( $item, $borrower ); > > if ( $check->{exceeded} ) { >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 8b2d8d8..153f6e3 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -65,6 +65,9 @@ my $query = new CGI; > my $sessionID = $query->cookie("CGISESSID") ; > my $session = get_session($sessionID); > >+my $override_high_holds = $query->param('override_high_holds'); >+my $override_high_holds_tmp = $query->param('override_high_holds_tmp'); >+ > # branch and printer are now defined by the userenv > # but first we have to check if someone has tried to change them > >@@ -301,7 +304,7 @@ if ($borrowernumber) { > if ($barcode) { > # always check for blockers on issuing > my ( $error, $question, $alerts ) = >- CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess ); >+ CanBookBeIssued( $borrower, $barcode, $datedue, $inprocess, undef, $override_high_holds || $override_high_holds_tmp ); > my $blocker = $invalidduedate ? 1 : 0; > > $template->param( alert => $alerts ); >@@ -573,6 +576,7 @@ $template->param( > canned_bor_notes_loop => $canned_notes, > debarments => GetDebarments({ borrowernumber => $borrowernumber }), > todaysdate => output_pref( { dt => dt_from_string()->set(hour => 23)->set(minute => 59), dateformat => 'sql' } ), >+ override_high_holds => $override_high_holds, > ); > > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 064e308..d8a5e3e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -294,7 +294,7 @@ $(document).ready(function() { > </li> > [% END %] > >-[% IF HIGHHOLDS %] >+[% IF HIGHHOLDS %] > <li>High demand item. Loan period shortened to [% HIGHHOLDS.duration %] days (due [% HIGHHOLDS.returndate %]). Check out anyway?</li> > [% END %] > >@@ -309,11 +309,19 @@ $(document).ready(function() { > </ul> > > [% IF HIGHHOLDS %] >- <script language="JavaScript" type="text/javascript"> >- $(document).ready(function() { >- $("input[name=duedatespec]:hidden").val('[% HIGHHOLDS.returndate %]'); >- }); >- </script> >+<script language="JavaScript" type="text/javascript"> >+$(document).ready(function() { >+ [% IF !override_high_holds %] >+ $("input[name=duedatespec]:hidden").val('[% HIGHHOLDS.returndate %]'); >+ [% END %] >+ >+ $("#override_high_holds_tmp").on( 'change', function() { >+ if ( this.checked ) { >+ $("input[name=duedatespec]:hidden").val(''); >+ } >+ }); >+}); >+</script> > [% END %] > > [% IF CAN_user_circulate_force_checkout or HIGHHOLDS %] >@@ -321,6 +329,13 @@ $(document).ready(function() { > > [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %] > >+[% IF HIGHHOLDS %] >+ <p> >+ <input type="checkbox" name="override_high_holds_tmp" id="override_high_holds_tmp" value="1" /> >+ <label for="override_high_holds_tmp">Don't decrease loan length based on holds</label> >+ </p> >+[% END %] >+ > [% IF ( RESERVED ) %] > <p> > <input type="checkbox" id="cancelreserve" name="cancelreserve" value="cancel" /> >@@ -632,6 +647,23 @@ No patron matched <span class="ex">[% message %]</span> > <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" /> > [% END %] > <label for="auto_renew">Automatic renewal</label> >+ >+ [% IF Koha.Preference('decreaseLoanHighHolds') %] >+ [% IF NEEDSCONFIRMATION %] >+ [% IF override_high_holds %] >+ <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" disabled="disabled" checked="checked"/> >+ [% ELSE %] >+ <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" disabled="disabled"/> >+ [% END %] >+ [% ELSE %] >+ [% IF override_high_holds %] >+ <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" checked="checked" /> >+ [% ELSE %] >+ <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" /> >+ [% END %] >+ [% END %] >+ <label for="override_high_holds">Don't decrease loan length based on holds</label> >+ [% END %] > </div> > > [% UNLESS ( noissues && Koha.Preference('OnSiteCheckoutsForce') ) %] >diff --git a/t/db_dependent/DecreaseLoanHighHolds.t b/t/db_dependent/Circulation/DecreaseLoanHighHolds.t >similarity index 86% >rename from t/db_dependent/DecreaseLoanHighHolds.t >rename to t/db_dependent/Circulation/DecreaseLoanHighHolds.t >index 5b1e592..ad1544e 100755 >--- a/t/db_dependent/DecreaseLoanHighHolds.t >+++ b/t/db_dependent/Circulation/DecreaseLoanHighHolds.t >@@ -27,7 +27,7 @@ use Koha::Item; > use Koha::Holds; > use Koha::Hold; > >-use Test::More tests => 12; >+use Test::More tests => 14; > > my $dbh = C4::Context->dbh; > my $schema = Koha::Database->new()->schema(); >@@ -60,7 +60,13 @@ my $biblioitem = > > my @items; > for my $i ( 1 .. 10 ) { >- my $item = Koha::Item->new( { biblionumber => $biblio->id(), biblioitemnumber => $biblioitem->id(), } )->store(); >+ my $item = Koha::Item->new( >+ { >+ biblionumber => $biblio->id(), >+ biblioitemnumber => $biblioitem->id(), >+ barcode => $i, >+ } >+ )->store(); > push( @items, $item ); > } > >@@ -88,7 +94,7 @@ C4::Context->set_preference( 'decreaseLoanHighHoldsValue', 1 ); > C4::Context->set_preference( 'decreaseLoanHighHoldsControl', 'static' ); > C4::Context->set_preference( 'decreaseLoanHighHoldsIgnoreStatuses', 'damaged,itemlost,notforloan,withdrawn' ); > >-my $item_hr = { itemnumber => $item->id, biblionumber => $biblio->id, homebranch => 'MPL', holdingbranch => 'MPL' }; >+my $item_hr = { itemnumber => $item->id, biblionumber => $biblio->id, homebranch => 'MPL', holdingbranch => 'MPL', barcode => $item->barcode }; > my $patron_hr = { borrower => $patron->id, branchcode => 'MPL' }; > > my $data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); >@@ -147,5 +153,13 @@ $unholdable->store(); > $data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); > is( $data->{exceeded}, 1, "Should exceed threshold" ); > >+C4::Context->set_preference('CircControl', 'PatronLibrary'); >+ >+my ( undef, $needsconfirmation ) = CanBookBeIssued( $patron_hr, $item->barcode ); >+ok( $needsconfirmation->{HIGHHOLDS}, "High holds checkout needs confirmation" ); >+ >+( undef, $needsconfirmation ) = CanBookBeIssued( $patron_hr, $item->barcode, undef, undef, undef, 1 ); >+ok( !$needsconfirmation->{HIGHHOLDS}, "High holds checkout does not need confirmation" ); >+ > $schema->storage->txn_rollback(); > 1; >-- >1.7.2.5
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 11565
:
42976
|
43160
|
43600
|
48679
|
49409
|
49937
|
50798
|
50799
|
50800
|
50815
|
50817
|
50818
|
50820
|
50821
|
50822
|
50828
|
50829