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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-9 / +61 lines)
Lines 168-173 Link Here
168
                </div>
168
                </div>
169
            [% END %]
169
            [% END %]
170
170
171
            [% IF ( failed_holds ) %]
172
                <div class="dialog alert">
173
                    <strong>One or more holds were not placed due to following errors:</strong>
174
                    <ul>
175
                    [% FOREACH fail IN failed_holds %]
176
                        <li>
177
                        [% SWITCH fail %]
178
                        [% CASE 'damaged' %]
179
                            <span>Item is damaged</span>
180
                        [% CASE 'ageRestricted' %]
181
                            <span>The record and its items are age restricted</span>
182
                        [% CASE 'tooManyHoldsForThisRecord' %]
183
                            <span>Patron exceeded the number of concurrent holds for this record</span>
184
                        [% CASE 'tooManyReservesToday' %]
185
                            <span>Patron reached daily holds limit</span>
186
                        [% CASE 'tooManyReserves' %]
187
                            <span>Too many holds already</span>
188
                        [% CASE 'notReservable' %]
189
                            <span>Not holdable</span>
190
                        [% CASE 'cannotReserveFromOtherBranches' %]
191
                            <span>Patron from a different library</span>
192
                        [% CASE 'branchNotInHoldGroup' %]
193
                            <span>Holds are not allowed from patron's library</span>
194
                        [% CASE 'itemAlreadyOnHold' %]
195
                            <span>Patron already has a hold for failed item(s)</span>
196
                        [% CASE 'cannotBeTransferred' %]
197
                            <span>Cannot be transferred to pickup library</span>
198
                        [% CASE 'pickupNotInHoldGroup' %]
199
                            <span>The chosen pickup location is not allowed</span>
200
                        [% CASE 'noReservesAllowed' %]
201
                            <span>No holds are allowed on failed item(s)</span>
202
                        [% CASE 'libraryNotPickupLocation' %]
203
                            <span>Library is not a valid pickup location</span>
204
                        [% CASE 'no_valid_pickup_location' %]
205
                            <span>No valid pickup location</span>
206
                        [% CASE 'notforloan' %]
207
                            <span>Not for loan</span>
208
                        [% CASE 'items_available' %]
209
                            <span>There are items available in the library</span>
210
                        [% CASE 'not_placed' %]
211
                            <span>Error when placing hold</span>
212
                        [% CASE %]
213
                            <span>Error: [% fail | html %]</span>
214
                        [% END %]
215
                        </li>
216
                    [% END %]
217
                    </ul>
218
                </div>
219
            [% END %]
220
171
            [% IF ( messagetransfert ) %]
221
            [% IF ( messagetransfert ) %]
172
                <div class="dialog message">
222
                <div class="dialog message">
173
                    <h2>Hold found for ([% nextreservtitle | html %]), please transfer</h2>
223
                    <h2>Hold found for ([% nextreservtitle | html %]), please transfer</h2>
Lines 745-753 Link Here
745
                                                            Hold must be item group level
795
                                                            Hold must be item group level
746
                                                        </span>
796
                                                        </span>
747
                                                    [% ELSIF ( itemloo.available ) %]
797
                                                    [% ELSIF ( itemloo.available ) %]
748
                                                        <input type="radio" name="checkitem" value="[% itemloo.itemnumber | html %]" />
798
                                                        <input type="checkbox" name="checkitem" value="[% itemloo.itemnumber | html %]" />
749
                                                    [% ELSIF ( itemloo.override ) %]
799
                                                    [% ELSIF ( itemloo.override ) %]
750
                                                        <input type="radio" name="checkitem" class="needsoverride" value="[% itemloo.itemnumber | html %]" />
800
                                                        <input type="checkbox" name="checkitem" class="needsoverride" value="[% itemloo.itemnumber | html %]" />
751
                                                        <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"/></i>
801
                                                        <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"/></i>
752
                                                    [% ELSE %]
802
                                                    [% ELSE %]
753
                                                        <span class="error">
803
                                                        <span class="error">
Lines 1502-1512 Link Here
1502
1552
1503
            if ( ! $("#requestany").is(":checked") ) {
1553
            if ( ! $("#requestany").is(":checked") ) {
1504
                // requestany not selected, go through the item-specific cases
1554
                // requestany not selected, go through the item-specific cases
1505
                if ( $('input[type="radio"]:checked').length > 0 ) {
1555
                if ( $('input[name="checkitem"]:checked').length > 0 ) {
1506
                    // got item-specific hold requests in the form!
1556
                    // got item-specific hold requests in the form!
1507
                    // verify they have a pickup location selected
1557
                    // verify they have a pickup location selected
1508
1558
1509
                    if (table.find('input[type="radio"]:checked')
1559
                    if (table.find('input[name="checkitem"]:checked')
1510
                                .closest('tr')
1560
                                .closest('tr')
1511
                                .find(".pickup_locations").val() === null) {
1561
                                .find(".pickup_locations").val() === null) {
1512
1562
Lines 1597-1611 Link Here
1597
                }
1647
                }
1598
            });
1648
            });
1599
            $("input[name=checkitem]").click(function() {
1649
            $("input[name=checkitem]").click(function() {
1600
                onechecked = 0;
1650
                let onechecked = 0;
1601
                $("input[name=checkitem]").each(function() {
1651
                $("input[name=checkitem]").each(function() {
1602
                    if(this.checked){
1652
                    if(this.checked){
1603
                        onechecked = 1;
1653
                        onechecked++;
1604
                    }
1654
                    }
1605
                });
1655
                });
1606
                if(onechecked == 1){
1656
                if(onechecked > 0){
1607
                    $("#requestany").prop("checked", false);
1657
                    $("#requestany").prop("checked", false);
1608
                    $("#holds_to_place_count").prop('disabled', true);
1658
                    $("#holds_to_place_count").prop('disabled', true);
1659
1660
                    $("#holds_to_place_count").val(onechecked);
1609
                } else {
1661
                } else {
1610
                    $("#requestany").prop("checked",true);
1662
                    $("#requestany").prop("checked",true);
1611
                    $("#holds_to_place_count").prop('disabled', false);
1663
                    $("#holds_to_place_count").prop('disabled', false);
Lines 1683-1692 Link Here
1683
1735
1684
            [% IF Koha.Preference('EnableItemGroupHolds') %]
1736
            [% IF Koha.Preference('EnableItemGroupHolds') %]
1685
                $(':radio[name="item_group_id"]').change(function(){
1737
                $(':radio[name="item_group_id"]').change(function(){
1686
                    $(':radio[name="checkitem"]').prop('checked', false);
1738
                    $('input[name="checkitem"]').prop('checked', false);
1687
                });
1739
                });
1688
1740
1689
                $(':radio[name="checkitem"]').change(function(){
1741
                $('input[name="checkitem"]').change(function(){
1690
                    $(':radio[name="item_group_id"]').prop('checked', false);
1742
                    $(':radio[name="item_group_id"]').prop('checked', false);
1691
                });
1743
                });
1692
            [% END %]
1744
            [% END %]
(-)a/reserve/placerequest.pl (-35 / +43 lines)
Lines 44-50 my $branch = $input->param('pickup'); Link Here
44
my $startdate      = $input->param('reserve_date') || '';
44
my $startdate      = $input->param('reserve_date') || '';
45
my @rank           = $input->multi_param('rank-request');
45
my @rank           = $input->multi_param('rank-request');
46
my $title          = $input->param('title');
46
my $title          = $input->param('title');
47
my $checkitem      = $input->param('checkitem');
47
my @checkitems      = $input->multi_param('checkitem');
48
my $item_group_id  = $input->param('item_group_id');
48
my $item_group_id  = $input->param('item_group_id');
49
my $expirationdate = $input->param('expiration_date');
49
my $expirationdate = $input->param('expiration_date');
50
my $itemtype       = $input->param('itemtype') || undef;
50
my $itemtype       = $input->param('itemtype') || undef;
Lines 63-105 foreach my $bibnum ( @holdable_bibs ) { Link Here
63
    $bibinfos{$bibnum} = \%bibinfo;
63
    $bibinfos{$bibnum} = \%bibinfo;
64
}
64
}
65
65
66
my $found;
67
68
if ( $patron ) {
66
if ( $patron ) {
69
67
    my %failed_holds;
70
    foreach my $biblionumber ( keys %bibinfos ) {
68
    foreach my $biblionumber ( keys %bibinfos ) {
71
69
72
        my $can_override = C4::Context->preference('AllowHoldPolicyOverride');
70
        my $can_override = C4::Context->preference('AllowHoldPolicyOverride');
73
        if ( defined $checkitem && $checkitem ne '' ) {
71
        if ( @checkitems ) {
74
72
            for ( my $i = 0; $i < scalar @checkitems; $i++ ){
75
            if ( my $item_pickup_location = $input->param("item_pickup_$checkitem") ) {
73
                my $checkitem = $checkitems[$i];
74
                if ( my $item_pickup_location = $input->param("item_pickup_$checkitem") ) {
76
75
77
                my $item = Koha::Items->find($checkitem);
76
                    my $item = Koha::Items->find($checkitem);
78
77
79
                if ( $item->biblionumber ne $biblionumber ) {
78
                    if ( $item->biblionumber ne $biblionumber ) {
80
                    $biblionumber = $item->biblionumber;
79
                        $biblionumber = $item->biblionumber;
81
                }
80
                    }
82
83
                my $can_item_be_reserved = CanItemBeReserved($patron, $item, $item_pickup_location)->{status};
84
81
85
                if ( $can_item_be_reserved eq 'OK' || ( $can_item_be_reserved ne 'itemAlreadyOnHold' && $can_override ) ) {
82
                    my $can_item_be_reserved = CanItemBeReserved($patron, $item, $item_pickup_location)->{status};
86
                    AddReserve(
83
87
                        {
84
                    if ( $can_item_be_reserved eq 'OK' || ( $can_item_be_reserved ne 'itemAlreadyOnHold' && $can_override ) ) {
88
                            branchcode       => $item_pickup_location,
85
                        AddReserve(
89
                            borrowernumber   => $patron->borrowernumber,
86
                            {
90
                            biblionumber     => $biblionumber,
87
                                branchcode       => $item_pickup_location,
91
                            priority         => $rank[0],
88
                                borrowernumber   => $patron->borrowernumber,
92
                            reservation_date => $startdate,
89
                                biblionumber     => $biblionumber,
93
                            expiration_date  => $expirationdate,
90
                                priority         => $rank[$i],
94
                            notes            => $notes,
91
                                reservation_date => $startdate,
95
                            title            => $title,
92
                                expiration_date  => $expirationdate,
96
                            itemnumber       => $checkitem,
93
                                notes            => $notes,
97
                            found            => $found,
94
                                title            => $title,
98
                            itemtype         => $itemtype,
95
                                itemnumber       => $checkitem,
99
                            non_priority     => $non_priority,
96
                                found            => undef,
100
                        }
97
                                itemtype         => $itemtype,
101
                    );
98
                                non_priority     => $non_priority,
99
                            }
100
                        );
102
101
102
                    }
103
                    else {
104
                        $failed_holds{$can_item_be_reserved} = 1;
105
                    }
103
                }
106
                }
104
            }
107
            }
105
108
Lines 116-123 if ( $patron ) { Link Here
116
                        expiration_date  => $expirationdate,
119
                        expiration_date  => $expirationdate,
117
                        notes            => $notes,
120
                        notes            => $notes,
118
                        title            => $bibinfo->{title},
121
                        title            => $bibinfo->{title},
119
                        itemnumber       => $checkitem,
122
                        itemnumber       => undef,
120
                        found            => $found,
123
                        found            => undef,
121
                        itemtype         => $itemtype,
124
                        itemtype         => $itemtype,
122
                        non_priority     => $non_priority,
125
                        non_priority     => $non_priority,
123
                    }
126
                    }
Lines 137-144 if ( $patron ) { Link Here
137
                            expiration_date  => $expirationdate,
140
                            expiration_date  => $expirationdate,
138
                            notes            => $notes,
141
                            notes            => $notes,
139
                            title            => $title,
142
                            title            => $title,
140
                            itemnumber       => $checkitem,
143
                            itemnumber       => undef,
141
                            found            => $found,
144
                            found            => undef,
142
                            itemtype         => $itemtype,
145
                            itemtype         => $itemtype,
143
                            non_priority     => $non_priority,
146
                            non_priority     => $non_priority,
144
                            item_group_id    => $item_group_id,
147
                            item_group_id    => $item_group_id,
Lines 150-156 if ( $patron ) { Link Here
150
    }
153
    }
151
154
152
    my $redirect_url = URI->new("request.pl");
155
    my $redirect_url = URI->new("request.pl");
153
    $redirect_url->query_form( biblionumber => [@biblionumbers]);
156
    my @failed_hold_msgs = ();
157
    #NOTE: Deduplicate failed hold reason statuses/codes
158
    foreach my $msg (keys %failed_holds){
159
        push(@failed_hold_msgs,$msg);
160
    }
161
    $redirect_url->query_form( biblionumber => [@biblionumbers], failed_holds => \@failed_hold_msgs);
154
    print $input->redirect($redirect_url);
162
    print $input->redirect($redirect_url);
155
}
163
}
156
elsif ( $borrowernumber eq '' ) {
164
elsif ( $borrowernumber eq '' ) {
(-)a/reserve/request.pl (-1 / +3 lines)
Lines 88-93 my $warnings; Link Here
88
my $messages;
88
my $messages;
89
my $exceeded_maxreserves;
89
my $exceeded_maxreserves;
90
my $exceeded_holds_per_record;
90
my $exceeded_holds_per_record;
91
my @failed_holds = $input->multi_param('failed_holds');
91
92
92
my $action = $input->param('action');
93
my $action = $input->param('action');
93
$action ||= q{};
94
$action ||= q{};
Lines 709-714 $template->param( pickup => $pickup || C4::Context->userenv->{branch} ); Link Here
709
710
710
$template->param(borrowernumber => $borrowernumber_hold);
711
$template->param(borrowernumber => $borrowernumber_hold);
711
712
713
$template->param( failed_holds => \@failed_holds );
714
712
# printout the page
715
# printout the page
713
output_html_with_http_headers $input, $cookie, $template->output;
716
output_html_with_http_headers $input, $cookie, $template->output;
714
717
715
- 

Return to bug 15565