View | Details | Raw Unified | Return to bug 11565
Collapse All | Expand All

(-)a/C4/Circulation.pm (-3 / +3 lines)
Lines 604-610 sub itemissues { Link Here
604
=head2 CanBookBeIssued
604
=head2 CanBookBeIssued
605
605
606
  ( $issuingimpossible, $needsconfirmation ) =  CanBookBeIssued( $borrower, 
606
  ( $issuingimpossible, $needsconfirmation ) =  CanBookBeIssued( $borrower, 
607
                      $barcode, $duedatespec, $inprocess, $ignore_reserves );
607
                      $barcode, $duedatespec, $inprocess, $ignore_reserves, $override_high_holds );
608
608
609
Check if a book can be issued.
609
Check if a book can be issued.
610
610
Lines 696-702 if the borrower borrows to much things Link Here
696
=cut
696
=cut
697
697
698
sub CanBookBeIssued {
698
sub CanBookBeIssued {
699
    my ( $borrower, $barcode, $duedate, $inprocess, $ignore_reserves ) = @_;
699
    my ( $borrower, $barcode, $duedate, $inprocess, $ignore_reserves, $override_high_holds ) = @_;
700
    my %needsconfirmation;    # filled with problems that needs confirmations
700
    my %needsconfirmation;    # filled with problems that needs confirmations
701
    my %issuingimpossible;    # filled with problems that causes the issue to be IMPOSSIBLE
701
    my %issuingimpossible;    # filled with problems that causes the issue to be IMPOSSIBLE
702
    my %alerts;               # filled with messages that shouldn't stop issuing, but the librarian should be aware of.
702
    my %alerts;               # filled with messages that shouldn't stop issuing, but the librarian should be aware of.
Lines 1010-1016 sub CanBookBeIssued { Link Here
1010
    }
1010
    }
1011
1011
1012
    ## check for high holds decreasing loan period
1012
    ## check for high holds decreasing loan period
1013
    if ( C4::Context->preference('decreaseLoanHighHolds') ) {
1013
    if ( !$override_high_holds && C4::Context->preference('decreaseLoanHighHolds') ) {
1014
        my $check = checkHighHolds( $item, $borrower );
1014
        my $check = checkHighHolds( $item, $borrower );
1015
1015
1016
        if ( $check->{exceeded} ) {
1016
        if ( $check->{exceeded} ) {
(-)a/circ/circulation.pl (-1 / +5 lines)
Lines 65-70 my $query = new CGI; Link Here
65
my $sessionID = $query->cookie("CGISESSID") ;
65
my $sessionID = $query->cookie("CGISESSID") ;
66
my $session = get_session($sessionID);
66
my $session = get_session($sessionID);
67
67
68
my $override_high_holds     = $query->param('override_high_holds');
69
my $override_high_holds_tmp = $query->param('override_high_holds_tmp');
70
68
# branch and printer are now defined by the userenv
71
# branch and printer are now defined by the userenv
69
# but first we have to check if someone has tried to change them
72
# but first we have to check if someone has tried to change them
70
73
Lines 301-307 if ($borrowernumber) { Link Here
301
if ($barcode) {
304
if ($barcode) {
302
    # always check for blockers on issuing
305
    # always check for blockers on issuing
303
    my ( $error, $question, $alerts ) =
306
    my ( $error, $question, $alerts ) =
304
    CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess );
307
    CanBookBeIssued( $borrower, $barcode, $datedue, $inprocess, undef, $override_high_holds || $override_high_holds_tmp );
305
    my $blocker = $invalidduedate ? 1 : 0;
308
    my $blocker = $invalidduedate ? 1 : 0;
306
309
307
    $template->param( alert => $alerts );
310
    $template->param( alert => $alerts );
Lines 573-578 $template->param( Link Here
573
    canned_bor_notes_loop     => $canned_notes,
576
    canned_bor_notes_loop     => $canned_notes,
574
    debarments                => GetDebarments({ borrowernumber => $borrowernumber }),
577
    debarments                => GetDebarments({ borrowernumber => $borrowernumber }),
575
    todaysdate                => output_pref( { dt => dt_from_string()->set(hour => 23)->set(minute => 59), dateformat => 'sql' } ),
578
    todaysdate                => output_pref( { dt => dt_from_string()->set(hour => 23)->set(minute => 59), dateformat => 'sql' } ),
579
    override_high_holds       => $override_high_holds,
576
);
580
);
577
581
578
output_html_with_http_headers $query, $cookie, $template->output;
582
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-6 / +38 lines)
Lines 294-300 $(document).ready(function() { Link Here
294
    </li>
294
    </li>
295
[% END %]
295
[% END %]
296
296
297
[% IF  HIGHHOLDS %]
297
[% IF HIGHHOLDS %]
298
    <li>High demand item. Loan period shortened to [% HIGHHOLDS.duration %] days (due [% HIGHHOLDS.returndate %]). Check out anyway?</li>
298
    <li>High demand item. Loan period shortened to [% HIGHHOLDS.duration %] days (due [% HIGHHOLDS.returndate %]). Check out anyway?</li>
299
[% END %]
299
[% END %]
300
300
Lines 309-319 $(document).ready(function() { Link Here
309
</ul>
309
</ul>
310
310
311
[% IF HIGHHOLDS %]
311
[% IF HIGHHOLDS %]
312
	<script language="JavaScript" type="text/javascript">
312
<script language="JavaScript" type="text/javascript">
313
	$(document).ready(function() {
313
$(document).ready(function() {
314
		$("input[name=duedatespec]:hidden").val('[% HIGHHOLDS.returndate %]');
314
    [% IF !override_high_holds %]
315
	});
315
        $("input[name=duedatespec]:hidden").val('[% HIGHHOLDS.returndate %]');
316
	</script>
316
    [% END %]
317
318
    $("#override_high_holds_tmp").on( 'change', function() {
319
        if ( this.checked ) {
320
            $("input[name=duedatespec]:hidden").val('');
321
        }
322
    });
323
});
324
</script>
317
[% END %]
325
[% END %]
318
326
319
[% IF CAN_user_circulate_force_checkout or HIGHHOLDS %]
327
[% IF CAN_user_circulate_force_checkout or HIGHHOLDS %]
Lines 321-326 $(document).ready(function() { Link Here
321
329
322
[% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
330
[% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
323
331
332
[% IF HIGHHOLDS %]
333
    <p>
334
    <input type="checkbox" name="override_high_holds_tmp" id="override_high_holds_tmp" value="1" />
335
    <label for="override_high_holds_tmp">Don't decrease loan length based on holds</label>
336
    </p>
337
[% END %]
338
324
[% IF ( RESERVED ) %]
339
[% IF ( RESERVED ) %]
325
    <p>
340
    <p>
326
    <input type="checkbox" id="cancelreserve" name="cancelreserve" value="cancel" />
341
    <input type="checkbox" id="cancelreserve" name="cancelreserve" value="cancel" />
Lines 632-637 No patron matched <span class="ex">[% message %]</span> Link Here
632
            <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" />
647
            <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" />
633
        [% END %]
648
        [% END %]
634
        <label for="auto_renew">Automatic renewal</label>
649
        <label for="auto_renew">Automatic renewal</label>
650
651
        [% IF Koha.Preference('decreaseLoanHighHolds') %]
652
            [% IF NEEDSCONFIRMATION %]
653
                [% IF override_high_holds %]
654
                    <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" disabled="disabled" checked="checked"/>
655
                [% ELSE %]
656
                    <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" disabled="disabled"/>
657
                [% END %]
658
            [% ELSE %]
659
                [% IF override_high_holds %]
660
                    <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" checked="checked" />
661
                [% ELSE %]
662
                    <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" />
663
                [% END %]
664
            [% END %]
665
            <label for="override_high_holds">Don't decrease loan length based on holds</label>
666
        [% END %]
635
    </div>
667
    </div>
636
668
637
    [% UNLESS ( noissues && Koha.Preference('OnSiteCheckoutsForce') ) %]
669
    [% UNLESS ( noissues && Koha.Preference('OnSiteCheckoutsForce') ) %]
(-)a/t/db_dependent/DecreaseLoanHighHolds.t (-4 / +17 lines)
Lines 27-33 use Koha::Item; Link Here
27
use Koha::Holds;
27
use Koha::Holds;
28
use Koha::Hold;
28
use Koha::Hold;
29
29
30
use Test::More tests => 12;
30
use Test::More tests => 14;
31
31
32
my $dbh    = C4::Context->dbh;
32
my $dbh    = C4::Context->dbh;
33
my $schema = Koha::Database->new()->schema();
33
my $schema = Koha::Database->new()->schema();
Lines 60-66 my $biblioitem = Link Here
60
60
61
my @items;
61
my @items;
62
for my $i ( 1 .. 10 ) {
62
for my $i ( 1 .. 10 ) {
63
    my $item = Koha::Item->new( { biblionumber => $biblio->id(), biblioitemnumber => $biblioitem->id(), } )->store();
63
    my $item = Koha::Item->new(
64
        {
65
            biblionumber     => $biblio->id(),
66
            biblioitemnumber => $biblioitem->id(),
67
            barcode          => $i,
68
        }
69
    )->store();
64
    push( @items, $item );
70
    push( @items, $item );
65
}
71
}
66
72
Lines 88-94 C4::Context->set_preference( 'decreaseLoanHighHoldsValue', 1 ); Link Here
88
C4::Context->set_preference( 'decreaseLoanHighHoldsControl',        'static' );
94
C4::Context->set_preference( 'decreaseLoanHighHoldsControl',        'static' );
89
C4::Context->set_preference( 'decreaseLoanHighHoldsIgnoreStatuses', 'damaged,itemlost,notforloan,withdrawn' );
95
C4::Context->set_preference( 'decreaseLoanHighHoldsIgnoreStatuses', 'damaged,itemlost,notforloan,withdrawn' );
90
96
91
my $item_hr = { itemnumber => $item->id, biblionumber => $biblio->id, homebranch => 'MPL', holdingbranch => 'MPL' };
97
my $item_hr = { itemnumber => $item->id, biblionumber => $biblio->id, homebranch => 'MPL', holdingbranch => 'MPL', barcode => $item->barcode };
92
my $patron_hr = { borrower => $patron->id, branchcode => 'MPL' };
98
my $patron_hr = { borrower => $patron->id, branchcode => 'MPL' };
93
99
94
my $data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr );
100
my $data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr );
Lines 147-151 $unholdable->store(); Link Here
147
$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr );
153
$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr );
148
is( $data->{exceeded}, 1, "Should exceed threshold" );
154
is( $data->{exceeded}, 1, "Should exceed threshold" );
149
155
156
C4::Context->set_preference('CircControl', 'PatronLibrary');
157
158
my ( undef, $needsconfirmation ) = CanBookBeIssued( $patron_hr, $item->barcode );
159
ok( $needsconfirmation->{HIGHHOLDS}, "High holds checkout needs confirmation" );
160
161
( undef, $needsconfirmation ) = CanBookBeIssued( $patron_hr, $item->barcode, undef, undef, undef, 1 );
162
ok( !$needsconfirmation->{HIGHHOLDS}, "High holds checkout does not need confirmation" );
163
150
$schema->storage->txn_rollback();
164
$schema->storage->txn_rollback();
151
1;
165
1;
152
- 

Return to bug 11565