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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-35 / +92 lines)
Lines 342-363 Link Here
342
                                    <strong>Too many holds: </strong> Patron can only place a maximum of [% maxreserves | html %] total holds.
342
                                    <strong>Too many holds: </strong> Patron can only place a maximum of [% maxreserves | html %] total holds.
343
                                </div>
343
                                </div>
344
                            [% END %]
344
                            [% END %]
345
                            [% IF ( patron.is_expired ) %]
345
                            [% FOREACH message IN messages %]
346
                                <div>
346
                                <div>
347
                                    <i class="fa-solid fa-triangle-exclamation"></i>
347
                                    <i class="fa-solid fa-triangle-exclamation"></i>
348
                                    <strong>Account has expired</strong>
348
                                    [% IF message.message == 'expired' %]
349
                                </div>
349
                                        <strong>Account has expired</strong>
350
                            [% END %]
350
                                    [% ELSIF message.message == 'restricted' %]
351
                            [% IF patron.is_debarred %]
351
                                        <strong>Patron has restrictions</strong>
352
                                <div>
352
                                    [% ELSIF message.message == 'debt_limit' %]
353
                                    <i class="fa-solid fa-triangle-exclamation"></i>
353
                                        <strong>Patron has outstanding fines: [% message.payload.total_outstanding | $Price %]</strong>
354
                                    <strong>Patron has restrictions</strong>
354
                                    [% ELSIF message.message == 'bad_address' %]
355
                                </div>
355
                                        <strong>Patron's address is flagged as incorrect</strong>
356
                            [% END %]
356
                                    [% ELSIF message.message == 'card_lost' %]
357
                            [% IF member.amount_outstanding && Koha.Preference('maxoutstanding') && member.amount_outstanding > Koha.Preference('maxoutstanding') %]
357
                                        <strong>Patron's library card is marked as lost</strong>
358
                                <div>
358
                                    [% ELSIF message.message == 'hold_limit' %]
359
                                    <i class="fa-solid fa-triangle-exclamation"></i>
359
                                        <strong>Too many holds: </strong> Patron can only place a maximum of [% message.payload.max_holds | html %] total holds.
360
                                    <strong>Patron has outstanding fines: [% member.amount_outstanding | $Price %]</strong>
360
                                    [% END %]
361
                                </div>
361
                                </div>
362
                            [% END %]
362
                            [% END %]
363
363
Lines 372-378 Link Here
372
                </ol>
372
                </ol>
373
                [% UNLESS ( multi_hold ) %]
373
                [% UNLESS ( multi_hold ) %]
374
                    <fieldset class="action">
374
                    <fieldset class="action">
375
                        <input type="submit" class="btn btn-primary" value="Place hold" />
375
                        [% IF messages.size && Koha.Preference('AllowHoldPolicyOverride') %]
376
                            [% FOREACH message IN messages %]
377
                                <input type="hidden" name="override_[% message.message | html %]" value="1" />
378
                            [% END %]
379
                            <input type="submit" class="btn btn-danger" value="Place hold with overrides" />
380
                        [% ELSE %]
381
                            <input type="submit" class="btn btn-primary" value="Place hold" />
382
                        [% END %]
376
                    </fieldset>
383
                    </fieldset>
377
                [% ELSE %]
384
                [% ELSE %]
378
                    <table id="requesttitles">
385
                    <table id="requesttitles">
Lines 509-530 Link Here
509
            </div>
516
            </div>
510
        [% END # /IF ( exceeded_maxreserves || ... %]
517
        [% END # /IF ( exceeded_maxreserves || ... %]
511
518
512
        [% IF ( patron.is_expired || diffbranch || patron.is_debarred || ( amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') ) ) %]
519
        [% IF messages.size || diffbranch %]
513
            <div class="alert alert-info">
520
            <div class="alert alert-info">
514
                <ul>
521
                <ul>
515
                    [% IF ( patron.is_expired ) %]
522
                    [% FOREACH message IN messages %]
516
                        <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>
523
                        <li>
517
                    [% END %]
524
                            [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]:
518
525
                            [% IF message.message == 'expired' %]
519
                    [% IF patron.is_debarred %]
526
                                <strong>Account has expired</strong>
520
                        <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>
527
                            [% ELSIF message.message == 'restricted' %]
521
                    [% END %]
528
                                <strong>Patron has restrictions</strong>
522
529
                            [% ELSIF message.message == 'debt_limit' %]
523
                    [% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
530
                                <strong>Patron has outstanding fines: [% message.payload.total_outstanding | $Price %]</strong>
524
                        <li
531
                            [% ELSIF message.message == 'bad_address' %]
525
                            >[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 link_to => 'members_pay' %]:
532
                                <strong>Patron's address is flagged as incorrect</strong>
526
                            <strong>Patron has outstanding fines: [% amount_outstanding | $Price %]</strong></li
533
                            [% ELSIF message.message == 'card_lost' %]
527
                        >
534
                                <strong>Patron's library card is marked as lost</strong>
535
                            [% ELSIF message.message == 'hold_limit' %]
536
                                <strong>Too many holds: </strong> Patron can only place a maximum of [% message.payload.max_holds | html %] total holds.
537
                            [% END %]
538
                        </li>
528
                    [% END %]
539
                    [% END %]
529
540
530
                    [% IF ( diffbranch ) %]
541
                    [% IF ( diffbranch ) %]
Lines 536-542 Link Here
536
                </ul>
547
                </ul>
537
                <!-- /.dialog.message -->
548
                <!-- /.dialog.message -->
538
            </div>
549
            </div>
539
        [% END # /IF patron.is_expired || diffbranch ... %]
550
        [% END # /IF messages.size || diffbranch %]
540
551
541
        [% IF ( messageborrower ) %]
552
        [% IF ( messageborrower ) %]
542
            <div class="alert alert-warning">
553
            <div class="alert alert-warning">
Lines 671-677 Link Here
671
682
672
                        <fieldset class="action">
683
                        <fieldset class="action">
673
                            [% IF ( patron.borrowernumber ) %]
684
                            [% IF ( patron.borrowernumber ) %]
674
                                [% IF ( override_required ) %]
685
                                [% IF Koha.Preference('AllowHoldPolicyOverride') && (messages.size || override_required) %]
686
                                    [% FOREACH message IN messages %]
687
                                        <input type="hidden" name="override_[% message.message | html %]" value="1" />
688
                                    [% END %]
689
                                    [% IF ( override_required ) %]
690
                                        <button type="submit" id="hold_grp_btn" class="btn btn-danger"><i class="fa fa-exclamation-triangle "></i> Place hold with overrides</button>
691
                                    [% ELSIF ( none_available ) %]
692
                                        <button type="submit" id="hold_grp_btn" disabled="disabled" class="btn btn-danger btn-disabled">Place hold with overrides</button>
693
                                    [% ELSE %]
694
                                        <button type="submit" id="hold_grp_btn" class="btn btn-danger">Place hold with overrides</button>
695
                                    [% END %]
696
                                [% ELSIF ( override_required ) %]
675
                                    <button type="submit" id="hold_grp_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
697
                                    <button type="submit" id="hold_grp_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
676
                                [% ELSIF ( none_available ) %]
698
                                [% ELSIF ( none_available ) %]
677
                                    <button type="submit" id="hold_grp_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
699
                                    <button type="submit" id="hold_grp_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
Lines 766-772 Link Here
766
                            [% END %]
788
                            [% END %]
767
                            <fieldset class="action">
789
                            <fieldset class="action">
768
                                [% IF ( patron.borrowernumber ) %]
790
                                [% IF ( patron.borrowernumber ) %]
769
                                    [% IF ( override_required ) %]
791
                                    [% IF Koha.Preference('AllowHoldPolicyOverride') && (messages.size || override_required) %]
792
                                        [% FOREACH message IN messages %]
793
                                            <input type="hidden" name="override_[% message.message | html %]" value="1" />
794
                                        [% END %]
795
                                        [% IF ( override_required ) %]
796
                                            <button type="submit" id="hold_any_btn" class="btn btn-danger"><i class="fa fa-exclamation-triangle "></i> Place hold with overrides</button>
797
                                        [% ELSIF ( none_available ) %]
798
                                            <button type="submit" id="hold_any_btn" disabled="disabled" class="btn btn-danger btn-disabled">Place hold with overrides</button>
799
                                        [% ELSE %]
800
                                            <button type="submit" id="hold_any_btn" class="btn btn-danger">Place hold with overrides</button>
801
                                        [% END %]
802
                                    [% ELSIF ( override_required ) %]
770
                                        <button type="submit" id="hold_any_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
803
                                        <button type="submit" id="hold_any_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
771
                                    [% ELSIF ( none_available ) %]
804
                                    [% ELSIF ( none_available ) %]
772
                                        <button type="submit" id="hold_any_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
805
                                        <button type="submit" id="hold_any_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
Lines 1016-1022 Link Here
1016
                        [% END # /IF hiddencount %]
1049
                        [% END # /IF hiddencount %]
1017
                        <fieldset class="action">
1050
                        <fieldset class="action">
1018
                            [% IF ( patron.borrowernumber ) %]
1051
                            [% IF ( patron.borrowernumber ) %]
1019
                                [% IF ( override_required ) %]
1052
                                [% IF Koha.Preference('AllowHoldPolicyOverride') && (messages.size || override_required) %]
1053
                                    [% FOREACH message IN messages %]
1054
                                        <input type="hidden" name="override_[% message.message | html %]" value="1" />
1055
                                    [% END %]
1056
                                    [% IF ( override_required ) %]
1057
                                        <button type="submit" id="hold_item_btn" class="btn btn-danger"><i class="fa fa-exclamation-triangle "></i> Place hold with overrides</button>
1058
                                    [% ELSIF ( none_available ) %]
1059
                                        <button type="submit" id="hold_item_btn" disabled="disabled" class="btn btn-danger btn-disabled">Place hold with overrides</button>
1060
                                    [% ELSE %]
1061
                                        <button type="submit" id="hold_item_btn" class="btn btn-danger">Place hold with overrides</button>
1062
                                    [% END %]
1063
                                [% ELSIF ( override_required ) %]
1020
                                    <button type="submit" id="hold_item_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
1064
                                    <button type="submit" id="hold_item_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
1021
                                [% ELSIF ( none_available ) %]
1065
                                [% ELSIF ( none_available ) %]
1022
                                    <button type="submit" id="hold_item_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
1066
                                    <button type="submit" id="hold_item_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
Lines 1166-1179 Link Here
1166
                </fieldset>
1210
                </fieldset>
1167
                <fieldset class="action">
1211
                <fieldset class="action">
1168
                    [% IF ( patron AND patron.borrowernumber ) %]
1212
                    [% IF ( patron AND patron.borrowernumber ) %]
1169
                        [% IF ( override_required ) %]
1213
                        [% IF Koha.Preference('AllowHoldPolicyOverride') && (messages.size || override_required) %]
1214
                            [% FOREACH message IN messages %]
1215
                                <input type="hidden" name="override_[% message.message | html %]" value="1" />
1216
                            [% END %]
1217
                            [% IF ( override_required ) %]
1218
                                <button type="submit" id="hold_multi_btn" class="btn btn-danger"><i class="fa fa-exclamation-triangle "></i> Place holds with overrides</button>
1219
                            [% ELSIF ( no_bibs_available ) %]
1220
                                <button type="submit" id="hold_multi_btn" class="btn btn-danger btn-disabled" disabled="disabled">Place holds with overrides</button>
1221
                            [% ELSIF ( none_available ) %]
1222
                                <button type="submit" id="hold_multi_btn" class="btn btn-danger">Place holds with overrides</button>
1223
                            [% ELSE %]
1224
                                <button type="submit" id="hold_multi_btn" class="btn btn-danger">Place holds with overrides</button>
1225
                            [% END %]
1226
                        [% ELSIF ( override_required ) %]
1170
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place holds</button>
1227
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place holds</button>
1171
                        [% ELSIF ( no_bibs_available ) %]
1228
                        [% ELSIF ( no_bibs_available ) %]
1172
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary btn-disabled" disabled="disabled">Place holds</button>
1229
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary btn-disabled" disabled="disabled">Place holds</button>
1173
                        [% ELSIF ( none_available ) %]
1230
                        [% ELSIF ( none_available ) %]
1174
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary">Place holds</button>
1231
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary">Place holds</button>
1175
                        [% ELSE %]
1232
                        [% ELSE %]
1176
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary" id="multi_hold_submit">Place holds</button>
1233
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary">Place holds</button>
1177
                        [% END %]
1234
                        [% END %]
1178
                    [% END # /IF patron %]
1235
                    [% END # /IF patron %]
1179
                </fieldset>
1236
                </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 188-217 if ( $borrowernumber_hold && !$op ) { Link Here
188
    # we check the reserves of the user, and if they can reserve a document
187
    # we check the reserves of the user, and if they can reserve a document
189
    # FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
188
    # FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
190
189
191
    my $reserves_count = $patron->holds->count;
190
    # Check for staff overrides
191
    my %overrides = ();
192
    if ( C4::Context->preference('AllowHoldPolicyOverride') ) {
193
        $overrides{expired}     = 1 if $input->param('override_expired');
194
        $overrides{debt_limit}  = 1 if $input->param('override_debt_limit');
195
        $overrides{bad_address} = 1 if $input->param('override_bad_address');
196
        $overrides{card_lost}   = 1 if $input->param('override_card_lost');
197
        $overrides{restricted}  = 1 if $input->param('override_restricted');
198
        $overrides{hold_limit}  = 1 if $input->param('override_hold_limit');
199
    }
192
200
193
    my $new_reserves_count = scalar(@biblionumbers);
201
    # Check if we can place holds for this patron
202
    my $can_place_holds_result = $patron->can_place_holds(
203
        {
204
            no_short_circuit => 1,            # Collect all validation errors for staff review
205
            overrides        => \%overrides
206
        }
207
    );
194
208
195
    my $maxreserves = C4::Context->preference('maxreserves');
209
    my @hold_validation_messages = $can_place_holds_result->messages;
196
    $template->param( maxreserves => $maxreserves );
197
210
198
    if ( $maxreserves
211
    # Set warnings flag if there are any validation issues
199
        && ( $reserves_count + $new_reserves_count > $maxreserves ) )
212
    if (@hold_validation_messages) {
200
    {
213
        $warnings = 1;
201
        my $new_reserves_allowed =
214
202
              $maxreserves - $reserves_count > 0
215
        # Check specifically for hold limit exceeded to set legacy variable
203
            ? $maxreserves - $reserves_count
216
        for my $message (@hold_validation_messages) {
204
            : 0;
217
            if ( $message->message eq 'hold_limit' ) {
205
        $warnings             = 1;
218
                $exceeded_maxreserves = 1;
206
        $exceeded_maxreserves = 1;
219
                last;
207
        $template->param(
220
            }
208
            new_reserves_allowed => $new_reserves_allowed,
221
        }
209
            new_reserves_count   => $new_reserves_count,
210
            reserves_count       => $reserves_count,
211
            maxreserves          => $maxreserves,
212
        );
213
    }
222
    }
214
223
224
    # Basic counts for template use
225
    my $reserves_count     = $patron->holds->count;
226
    my $new_reserves_count = scalar(@biblionumbers);
227
    my $maxreserves        = C4::Context->preference('maxreserves');
228
215
    # check if the borrower make the reserve in a different branch
229
    # check if the borrower make the reserve in a different branch
216
    if ( $patron->branchcode ne C4::Context->userenv->{'branch'} ) {
230
    if ( $patron->branchcode ne C4::Context->userenv->{'branch'} ) {
217
        $diffbranch = 1;
231
        $diffbranch = 1;
Lines 221-229 if ( $borrowernumber_hold && !$op ) { Link Here
221
    $template->param(
235
    $template->param(
222
        patron             => $patron,
236
        patron             => $patron,
223
        diffbranch         => $diffbranch,
237
        diffbranch         => $diffbranch,
224
        messages           => $messages,
238
        messages           => \@hold_validation_messages,
225
        warnings           => $warnings,
239
        warnings           => $warnings,
226
        amount_outstanding => $amount_outstanding,
240
        amount_outstanding => $amount_outstanding,
241
        reserves_count     => $reserves_count,
242
        new_reserves_count => $new_reserves_count,
243
        maxreserves        => $maxreserves,
227
    );
244
    );
228
}
245
}
229
246
230
- 

Return to bug 40237