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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-39 / +96 lines)
Lines 415-436 Link Here
415
                                    <strong>Too many holds: </strong> Patron can only place a maximum of [% maxreserves | html %] total holds.
415
                                    <strong>Too many holds: </strong> Patron can only place a maximum of [% maxreserves | html %] total holds.
416
                                </div>
416
                                </div>
417
                            [% END %]
417
                            [% END %]
418
                            [% IF ( patron.is_expired ) %]
418
                            [% FOREACH message IN messages %]
419
                                <div>
419
                                <div>
420
                                    <i class="fa-solid fa-triangle-exclamation"></i>
420
                                    <i class="fa-solid fa-triangle-exclamation"></i>
421
                                    <strong>Account has expired</strong>
421
                                    [% IF message.message == 'expired' %]
422
                                </div>
422
                                        <strong>Account has expired</strong>
423
                            [% END %]
423
                                    [% ELSIF message.message == 'restricted' %]
424
                            [% IF patron.is_debarred %]
424
                                        <strong>Patron has restrictions</strong>
425
                                <div>
425
                                    [% ELSIF message.message == 'debt_limit' %]
426
                                    <i class="fa-solid fa-triangle-exclamation"></i>
426
                                        <strong>Patron has outstanding fines: [% message.payload.total_outstanding | $Price %]</strong>
427
                                    <strong>Patron has restrictions</strong>
427
                                    [% ELSIF message.message == 'bad_address' %]
428
                                </div>
428
                                        <strong>Patron's address is flagged as incorrect</strong>
429
                            [% END %]
429
                                    [% ELSIF message.message == 'card_lost' %]
430
                            [% IF member.amount_outstanding && Koha.Preference('maxoutstanding') && member.amount_outstanding > Koha.Preference('maxoutstanding') %]
430
                                        <strong>Patron's library card is marked as lost</strong>
431
                                <div>
431
                                    [% ELSIF message.message == 'hold_limit' %]
432
                                    <i class="fa-solid fa-triangle-exclamation"></i>
432
                                        <strong>Too many holds: </strong> Patron can only place a maximum of [% message.payload.max_holds | html %] total holds.
433
                                    <strong>Patron has outstanding fines: [% member.amount_outstanding | $Price %]</strong>
433
                                    [% END %]
434
                                </div>
434
                                </div>
435
                            [% END %]
435
                            [% END %]
436
436
Lines 445-451 Link Here
445
                </ol>
445
                </ol>
446
                [% UNLESS ( multi_hold ) %]
446
                [% UNLESS ( multi_hold ) %]
447
                    <fieldset class="action">
447
                    <fieldset class="action">
448
                        <input type="submit" class="btn btn-primary" value="Place hold" />
448
                        [% IF messages.size && Koha.Preference('AllowHoldPolicyOverride') %]
449
                            [% FOREACH message IN messages %]
450
                                <input type="hidden" name="override_[% message.message | html %]" value="1" />
451
                            [% END %]
452
                            <input type="submit" class="btn btn-danger" value="Place hold with overrides" />
453
                        [% ELSE %]
454
                            <input type="submit" class="btn btn-primary" value="Place hold" />
455
                        [% END %]
449
                    </fieldset>
456
                    </fieldset>
450
                [% ELSE %]
457
                [% ELSE %]
451
                    <table id="requesttitles">
458
                    <table id="requesttitles">
Lines 594-615 Link Here
594
            </div>
601
            </div>
595
        [% END # /IF ( exceeded_maxreserves || ... %]
602
        [% END # /IF ( exceeded_maxreserves || ... %]
596
603
597
        [% IF ( patron.is_expired || diffbranch || patron.is_debarred || ( amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') ) ) %]
604
        [% IF messages.size || diffbranch %]
598
            <div class="alert alert-info">
605
            <div class="alert alert-info">
599
                <ul>
606
                <ul>
600
                    [% IF ( patron.is_expired ) %]
607
                    [% FOREACH message IN messages %]
601
                        <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]: <strong>Account has expired</strong></li>
608
                        <li>
602
                    [% END %]
609
                            [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]:
603
610
                            [% IF message.message == 'expired' %]
604
                    [% IF patron.is_debarred %]
611
                                <strong>Account has expired</strong>
605
                        <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]: <strong>Patron has restrictions</strong></li>
612
                            [% ELSIF message.message == 'restricted' %]
606
                    [% END %]
613
                                <strong>Patron has restrictions</strong>
607
614
                            [% ELSIF message.message == 'debt_limit' %]
608
                    [% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
615
                                <strong>Patron has outstanding fines: [% message.payload.total_outstanding | $Price %]</strong>
609
                        <li
616
                            [% ELSIF message.message == 'bad_address' %]
610
                            >[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 link_to => 'members_pay' %]:
617
                                <strong>Patron's address is flagged as incorrect</strong>
611
                            <strong>Patron has outstanding fines: [% amount_outstanding | $Price %]</strong></li
618
                            [% ELSIF message.message == 'card_lost' %]
612
                        >
619
                                <strong>Patron's library card is marked as lost</strong>
620
                            [% ELSIF message.message == 'hold_limit' %]
621
                                <strong>Too many holds: </strong> Patron can only place a maximum of [% message.payload.max_holds | html %] total holds.
622
                            [% END %]
623
                        </li>
613
                    [% END %]
624
                    [% END %]
614
625
615
                    [% IF ( diffbranch ) %]
626
                    [% IF ( diffbranch ) %]
Lines 621-627 Link Here
621
                </ul>
632
                </ul>
622
                <!-- /.dialog.message -->
633
                <!-- /.dialog.message -->
623
            </div>
634
            </div>
624
        [% END # /IF patron.is_expired || diffbranch ... %]
635
        [% END # /IF messages.size || diffbranch %]
625
636
626
        [% IF ( messageborrower ) %]
637
        [% IF ( messageborrower ) %]
627
            <div class="alert alert-warning">
638
            <div class="alert alert-warning">
Lines 756-763 Link Here
756
767
757
                        <fieldset class="action">
768
                        <fieldset class="action">
758
                            [% IF ( patron.borrowernumber ) %]
769
                            [% IF ( patron.borrowernumber ) %]
759
                                [% IF ( override_required ) %]
770
                                [% IF Koha.Preference('AllowHoldPolicyOverride') && (messages.size || override_required) %]
760
                                    <button type="submit" id="hold_grp_btn" class="btn btn-primary"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
771
                                    [% FOREACH message IN messages %]
772
                                        <input type="hidden" name="override_[% message.message | html %]" value="1" />
773
                                    [% END %]
774
                                    [% IF ( override_required ) %]
775
                                        <button type="submit" id="hold_grp_btn" class="btn btn-danger"><i class="fa fa-exclamation-triangle "></i> Place hold with overrides</button>
776
                                    [% ELSIF ( none_available ) %]
777
                                        <button type="submit" id="hold_grp_btn" disabled="disabled" class="btn btn-danger btn-disabled">Place hold with overrides</button>
778
                                    [% ELSE %]
779
                                        <button type="submit" id="hold_grp_btn" class="btn btn-danger">Place hold with overrides</button>
780
                                    [% END %]
781
                                [% ELSIF ( override_required ) %]
782
                                    <button type="submit" id="hold_grp_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
761
                                [% ELSIF ( none_available ) %]
783
                                [% ELSIF ( none_available ) %]
762
                                    <button type="submit" id="hold_grp_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
784
                                    <button type="submit" id="hold_grp_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
763
                                [% ELSE %]
785
                                [% ELSE %]
Lines 851-858 Link Here
851
                            [% END %]
873
                            [% END %]
852
                            <fieldset class="action">
874
                            <fieldset class="action">
853
                                [% IF ( patron.borrowernumber ) %]
875
                                [% IF ( patron.borrowernumber ) %]
854
                                    [% IF ( override_required ) %]
876
                                    [% IF Koha.Preference('AllowHoldPolicyOverride') && (messages.size || override_required) %]
855
                                        <button type="submit" id="hold_any_btn" class="btn btn-primary"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
877
                                        [% FOREACH message IN messages %]
878
                                            <input type="hidden" name="override_[% message.message | html %]" value="1" />
879
                                        [% END %]
880
                                        [% IF ( override_required ) %]
881
                                            <button type="submit" id="hold_any_btn" class="btn btn-danger"><i class="fa fa-exclamation-triangle "></i> Place hold with overrides</button>
882
                                        [% ELSIF ( none_available ) %]
883
                                            <button type="submit" id="hold_any_btn" disabled="disabled" class="btn btn-danger btn-disabled">Place hold with overrides</button>
884
                                        [% ELSE %]
885
                                            <button type="submit" id="hold_any_btn" class="btn btn-danger">Place hold with overrides</button>
886
                                        [% END %]
887
                                    [% ELSIF ( override_required ) %]
888
                                        <button type="submit" id="hold_any_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
856
                                    [% ELSIF ( none_available ) %]
889
                                    [% ELSIF ( none_available ) %]
857
                                        <button type="submit" id="hold_any_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
890
                                        <button type="submit" id="hold_any_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
858
                                    [% ELSE %]
891
                                    [% ELSE %]
Lines 1109-1116 Link Here
1109
                        [% END # /IF hiddencount %]
1142
                        [% END # /IF hiddencount %]
1110
                        <fieldset class="action">
1143
                        <fieldset class="action">
1111
                            [% IF ( patron.borrowernumber ) %]
1144
                            [% IF ( patron.borrowernumber ) %]
1112
                                [% IF ( override_required ) %]
1145
                                [% IF Koha.Preference('AllowHoldPolicyOverride') && (messages.size || override_required) %]
1113
                                    <button type="submit" id="hold_item_btn" class="btn btn-primary"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
1146
                                    [% FOREACH message IN messages %]
1147
                                        <input type="hidden" name="override_[% message.message | html %]" value="1" />
1148
                                    [% END %]
1149
                                    [% IF ( override_required ) %]
1150
                                        <button type="submit" id="hold_item_btn" class="btn btn-danger"><i class="fa fa-exclamation-triangle "></i> Place hold with overrides</button>
1151
                                    [% ELSIF ( none_available ) %]
1152
                                        <button type="submit" id="hold_item_btn" disabled="disabled" class="btn btn-danger btn-disabled">Place hold with overrides</button>
1153
                                    [% ELSE %]
1154
                                        <button type="submit" id="hold_item_btn" class="btn btn-danger">Place hold with overrides</button>
1155
                                    [% END %]
1156
                                [% ELSIF ( override_required ) %]
1157
                                    <button type="submit" id="hold_item_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
1114
                                [% ELSIF ( none_available ) %]
1158
                                [% ELSIF ( none_available ) %]
1115
                                    <button type="submit" id="hold_item_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
1159
                                    <button type="submit" id="hold_item_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
1116
                                [% ELSE %]
1160
                                [% ELSE %]
Lines 1279-1292 Link Here
1279
                </fieldset>
1323
                </fieldset>
1280
                <fieldset class="action">
1324
                <fieldset class="action">
1281
                    [% IF ( patron AND patron.borrowernumber ) %]
1325
                    [% IF ( patron AND patron.borrowernumber ) %]
1282
                        [% IF ( override_required ) %]
1326
                        [% IF Koha.Preference('AllowHoldPolicyOverride') && (messages.size || override_required) %]
1283
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary "><i class="fa fa-exclamation-triangle "></i> Place holds</button>
1327
                            [% FOREACH message IN messages %]
1328
                                <input type="hidden" name="override_[% message.message | html %]" value="1" />
1329
                            [% END %]
1330
                            [% IF ( override_required ) %]
1331
                                <button type="submit" id="hold_multi_btn" class="btn btn-danger"><i class="fa fa-exclamation-triangle "></i> Place holds with overrides</button>
1332
                            [% ELSIF ( no_bibs_available ) %]
1333
                                <button type="submit" id="hold_multi_btn" class="btn btn-danger btn-disabled" disabled="disabled">Place holds with overrides</button>
1334
                            [% ELSIF ( none_available ) %]
1335
                                <button type="submit" id="hold_multi_btn" class="btn btn-danger">Place holds with overrides</button>
1336
                            [% ELSE %]
1337
                                <button type="submit" id="hold_multi_btn" class="btn btn-danger">Place holds with overrides</button>
1338
                            [% END %]
1339
                        [% ELSIF ( override_required ) %]
1340
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place holds</button>
1284
                        [% ELSIF ( no_bibs_available ) %]
1341
                        [% ELSIF ( no_bibs_available ) %]
1285
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary btn-disabled" disabled="disabled">Place holds</button>
1342
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary btn-disabled" disabled="disabled">Place holds</button>
1286
                        [% ELSIF ( none_available ) %]
1343
                        [% ELSIF ( none_available ) %]
1287
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary">Place holds</button>
1344
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary">Place holds</button>
1288
                        [% ELSE %]
1345
                        [% ELSE %]
1289
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary" id="multi_hold_submit">Place holds</button>
1346
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary">Place holds</button>
1290
                        [% END %]
1347
                        [% END %]
1291
                    [% END # /IF patron %]
1348
                    [% END # /IF patron %]
1292
                </fieldset>
1349
                </fieldset>
(-)a/reserve/request.pl (-22 / +38 lines)
Lines 85-91 my $club_hold = $input->param('club') || ''; Link Here
85
my $messageborrower;
85
my $messageborrower;
86
my $messageclub;
86
my $messageclub;
87
my $warnings;
87
my $warnings;
88
my $messages;
89
my $exceeded_maxreserves;
88
my $exceeded_maxreserves;
90
my $exceeded_holds_per_record;
89
my $exceeded_holds_per_record;
91
my @failed_holds   = $input->multi_param('failed_holds');
90
my @failed_holds   = $input->multi_param('failed_holds');
Lines 243-272 if ( $borrowernumber_hold && !$op ) { Link Here
243
    # we check the reserves of the user, and if they can reserve a document
242
    # we check the reserves of the user, and if they can reserve a document
244
    # FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
243
    # FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
245
244
246
    my $reserves_count = $patron->holds->count_holds;
245
    # Check for staff overrides
246
    my %overrides = ();
247
    if ( C4::Context->preference('AllowHoldPolicyOverride') ) {
248
        $overrides{expired}     = 1 if $input->param('override_expired');
249
        $overrides{debt_limit}  = 1 if $input->param('override_debt_limit');
250
        $overrides{bad_address} = 1 if $input->param('override_bad_address');
251
        $overrides{card_lost}   = 1 if $input->param('override_card_lost');
252
        $overrides{restricted}  = 1 if $input->param('override_restricted');
253
        $overrides{hold_limit}  = 1 if $input->param('override_hold_limit');
254
    }
247
255
248
    my $new_reserves_count = scalar(@biblionumbers);
256
    # Check if we can place holds for this patron
257
    my $can_place_holds_result = $patron->can_place_holds(
258
        {
259
            no_short_circuit => 1,            # Collect all validation errors for staff review
260
            overrides        => \%overrides
261
        }
262
    );
249
263
250
    my $maxreserves = C4::Context->preference('maxreserves');
264
    my @hold_validation_messages = @{ $can_place_holds_result->messages };
251
    $template->param( maxreserves => $maxreserves );
252
265
253
    if ( $maxreserves
266
    # Set warnings flag if there are any validation issues
254
        && ( $reserves_count + $new_reserves_count > $maxreserves ) )
267
    if (@hold_validation_messages) {
255
    {
268
        $warnings = 1;
256
        my $new_reserves_allowed =
269
257
              $maxreserves - $reserves_count > 0
270
        # Check specifically for hold limit exceeded to set legacy variable
258
            ? $maxreserves - $reserves_count
271
        for my $message (@hold_validation_messages) {
259
            : 0;
272
            if ( $message->message eq 'hold_limit' ) {
260
        $warnings             = 1;
273
                $exceeded_maxreserves = 1;
261
        $exceeded_maxreserves = 1;
274
                last;
262
        $template->param(
275
            }
263
            new_reserves_allowed => $new_reserves_allowed,
276
        }
264
            new_reserves_count   => $new_reserves_count,
265
            reserves_count       => $reserves_count,
266
            maxreserves          => $maxreserves,
267
        );
268
    }
277
    }
269
278
279
    # Basic counts for template use
280
    my $reserves_count     = $patron->holds->count;
281
    my $new_reserves_count = scalar(@biblionumbers);
282
    my $maxreserves        = C4::Context->preference('maxreserves');
283
270
    # check if the borrower make the reserve in a different branch
284
    # check if the borrower make the reserve in a different branch
271
    if ( $patron->branchcode ne C4::Context->userenv->{'branch'} ) {
285
    if ( $patron->branchcode ne C4::Context->userenv->{'branch'} ) {
272
        $diffbranch = 1;
286
        $diffbranch = 1;
Lines 276-284 if ( $borrowernumber_hold && !$op ) { Link Here
276
    $template->param(
290
    $template->param(
277
        patron             => $patron,
291
        patron             => $patron,
278
        diffbranch         => $diffbranch,
292
        diffbranch         => $diffbranch,
279
        messages           => $messages,
293
        messages           => \@hold_validation_messages,
280
        warnings           => $warnings,
294
        warnings           => $warnings,
281
        amount_outstanding => $amount_outstanding,
295
        amount_outstanding => $amount_outstanding,
296
        reserves_count     => $reserves_count,
297
        new_reserves_count => $new_reserves_count,
298
        maxreserves        => $maxreserves,
282
    );
299
    );
283
}
300
}
284
301
285
- 

Return to bug 40237