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
            [% UNLESS ( multi_hold ) %]
221
            [% UNLESS ( multi_hold ) %]
172
                <h2>Place a hold on [% INCLUDE 'biblio-title.inc' link = 1 %] [% IF biblio.author %] by [% biblio.author | html %][% END %]</h2>
222
                <h2>Place a hold on [% INCLUDE 'biblio-title.inc' link = 1 %] [% IF biblio.author %] by [% biblio.author | html %][% END %]</h2>
173
            [% ELSE %]
223
            [% ELSE %]
Lines 736-744 Link Here
736
                                                            Hold must be item group level
786
                                                            Hold must be item group level
737
                                                        </span>
787
                                                        </span>
738
                                                    [% ELSIF ( itemloo.available ) %]
788
                                                    [% ELSIF ( itemloo.available ) %]
739
                                                        <input type="radio" name="checkitem" value="[% itemloo.itemnumber | html %]" />
789
                                                        <input type="checkbox" name="checkitem" value="[% itemloo.itemnumber | html %]" />
740
                                                    [% ELSIF ( itemloo.override ) %]
790
                                                    [% ELSIF ( itemloo.override ) %]
741
                                                        <input type="radio" name="checkitem" class="needsoverride" value="[% itemloo.itemnumber | html %]" />
791
                                                        <input type="checkbox" name="checkitem" class="needsoverride" value="[% itemloo.itemnumber | html %]" />
742
                                                        <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"/></i>
792
                                                        <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"/></i>
743
                                                    [% ELSE %]
793
                                                    [% ELSE %]
744
                                                        <span class="error">
794
                                                        <span class="error">
Lines 1507-1517 Link Here
1507
1557
1508
            if ( ! $("#requestany").is(":checked") ) {
1558
            if ( ! $("#requestany").is(":checked") ) {
1509
                // requestany not selected, go through the item-specific cases
1559
                // requestany not selected, go through the item-specific cases
1510
                if ( $('input[type="radio"]:checked').length > 0 ) {
1560
                if ( $('input[name="checkitem"]:checked').length > 0 ) {
1511
                    // got item-specific hold requests in the form!
1561
                    // got item-specific hold requests in the form!
1512
                    // verify they have a pickup location selected
1562
                    // verify they have a pickup location selected
1513
1563
1514
                    if (table.find('input[type="radio"]:checked')
1564
                    if (table.find('input[name="checkitem"]:checked')
1515
                                .closest('tr')
1565
                                .closest('tr')
1516
                                .find(".pickup_locations").val() === null) {
1566
                                .find(".pickup_locations").val() === null) {
1517
1567
Lines 1602-1616 Link Here
1602
                }
1652
                }
1603
            });
1653
            });
1604
            $("input[name=checkitem]").click(function() {
1654
            $("input[name=checkitem]").click(function() {
1605
                onechecked = 0;
1655
                let onechecked = 0;
1606
                $("input[name=checkitem]").each(function() {
1656
                $("input[name=checkitem]").each(function() {
1607
                    if(this.checked){
1657
                    if(this.checked){
1608
                        onechecked = 1;
1658
                        onechecked++;
1609
                    }
1659
                    }
1610
                });
1660
                });
1611
                if(onechecked == 1){
1661
                if(onechecked > 0){
1612
                    $("#requestany").prop("checked", false);
1662
                    $("#requestany").prop("checked", false);
1613
                    $("#holds_to_place_count").prop('disabled', true);
1663
                    $("#holds_to_place_count").prop('disabled', true);
1664
1665
                    $("#holds_to_place_count").val(onechecked);
1614
                } else {
1666
                } else {
1615
                    $("#requestany").prop("checked",true);
1667
                    $("#requestany").prop("checked",true);
1616
                    $("#holds_to_place_count").prop('disabled', false);
1668
                    $("#holds_to_place_count").prop('disabled', false);
Lines 1676-1685 Link Here
1676
1728
1677
            [% IF Koha.Preference('EnableItemGroupHolds') %]
1729
            [% IF Koha.Preference('EnableItemGroupHolds') %]
1678
                $(':radio[name="item_group_id"]').change(function(){
1730
                $(':radio[name="item_group_id"]').change(function(){
1679
                    $(':radio[name="checkitem"]').prop('checked', false);
1731
                    $('input[name="checkitem"]').prop('checked', false);
1680
                });
1732
                });
1681
1733
1682
                $(':radio[name="checkitem"]').change(function(){
1734
                $('input[name="checkitem"]').change(function(){
1683
                    $(':radio[name="item_group_id"]').prop('checked', false);
1735
                    $(':radio[name="item_group_id"]').prop('checked', false);
1684
                });
1736
                });
1685
            [% END %]
1737
            [% END %]
(-)a/reserve/placerequest.pl (-34 / +44 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 64-106 foreach my $bibnum ( @holdable_bibs ) { Link Here
64
    $bibinfos{$bibnum} = \%bibinfo;
64
    $bibinfos{$bibnum} = \%bibinfo;
65
}
65
}
66
66
67
my $found;
68
67
69
if ( $op eq 'cud-placerequest' && $patron ) {
70
68
69
if ( $op eq 'cud-placerequest' && $patron ) {
70
    my %failed_holds;
71
    foreach my $biblionumber ( keys %bibinfos ) {
71
    foreach my $biblionumber ( keys %bibinfos ) {
72
72
73
        my $can_override = C4::Context->preference('AllowHoldPolicyOverride');
73
        my $can_override = C4::Context->preference('AllowHoldPolicyOverride');
74
        if ( defined $checkitem && $checkitem ne '' ) {
74
        if ( @checkitems ) {
75
75
            for ( my $i = 0; $i < scalar @checkitems; $i++ ){
76
            if ( my $item_pickup_location = $input->param("item_pickup_$checkitem") ) {
76
                my $checkitem = $checkitems[$i];
77
                if ( my $item_pickup_location = $input->param("item_pickup_$checkitem") ) {
77
78
78
                my $item = Koha::Items->find($checkitem);
79
                    my $item = Koha::Items->find($checkitem);
79
80
80
                if ( $item->biblionumber ne $biblionumber ) {
81
                    if ( $item->biblionumber ne $biblionumber ) {
81
                    $biblionumber = $item->biblionumber;
82
                        $biblionumber = $item->biblionumber;
82
                }
83
                    }
83
84
                my $can_item_be_reserved = CanItemBeReserved($patron, $item, $item_pickup_location)->{status};
85
84
86
                if ( $can_item_be_reserved eq 'OK' || ( $can_item_be_reserved ne 'itemAlreadyOnHold' && $can_override ) ) {
85
                    my $can_item_be_reserved = CanItemBeReserved($patron, $item, $item_pickup_location)->{status};
87
                    AddReserve(
86
88
                        {
87
                    if ( $can_item_be_reserved eq 'OK' || ( $can_item_be_reserved ne 'itemAlreadyOnHold' && $can_override ) ) {
89
                            branchcode       => $item_pickup_location,
88
                        AddReserve(
90
                            borrowernumber   => $patron->borrowernumber,
89
                            {
91
                            biblionumber     => $biblionumber,
90
                                branchcode       => $item_pickup_location,
92
                            priority         => $rank[0],
91
                                borrowernumber   => $patron->borrowernumber,
93
                            reservation_date => $startdate,
92
                                biblionumber     => $biblionumber,
94
                            expiration_date  => $expirationdate,
93
                                priority         => $rank[$i],
95
                            notes            => $notes,
94
                                reservation_date => $startdate,
96
                            title            => $title,
95
                                expiration_date  => $expirationdate,
97
                            itemnumber       => $checkitem,
96
                                notes            => $notes,
98
                            found            => $found,
97
                                title            => $title,
99
                            itemtype         => $itemtype,
98
                                itemnumber       => $checkitem,
100
                            non_priority     => $non_priority,
99
                                found            => undef,
101
                        }
100
                                itemtype         => $itemtype,
102
                    );
101
                                non_priority     => $non_priority,
102
                            }
103
                        );
103
104
105
                    }
106
                    else {
107
                        $failed_holds{$can_item_be_reserved} = 1;
108
                    }
104
                }
109
                }
105
            }
110
            }
106
111
Lines 117-124 if ( $op eq 'cud-placerequest' && $patron ) { Link Here
117
                        expiration_date  => $expirationdate,
122
                        expiration_date  => $expirationdate,
118
                        notes            => $notes,
123
                        notes            => $notes,
119
                        title            => $bibinfo->{title},
124
                        title            => $bibinfo->{title},
120
                        itemnumber       => $checkitem,
125
                        itemnumber       => undef,
121
                        found            => $found,
126
                        found            => undef,
122
                        itemtype         => $itemtype,
127
                        itemtype         => $itemtype,
123
                        non_priority     => $non_priority,
128
                        non_priority     => $non_priority,
124
                    }
129
                    }
Lines 138-145 if ( $op eq 'cud-placerequest' && $patron ) { Link Here
138
                            expiration_date  => $expirationdate,
143
                            expiration_date  => $expirationdate,
139
                            notes            => $notes,
144
                            notes            => $notes,
140
                            title            => $title,
145
                            title            => $title,
141
                            itemnumber       => $checkitem,
146
                            itemnumber       => undef,
142
                            found            => $found,
147
                            found            => undef,
143
                            itemtype         => $itemtype,
148
                            itemtype         => $itemtype,
144
                            non_priority     => $non_priority,
149
                            non_priority     => $non_priority,
145
                            item_group_id    => $item_group_id,
150
                            item_group_id    => $item_group_id,
Lines 151-157 if ( $op eq 'cud-placerequest' && $patron ) { Link Here
151
    }
156
    }
152
157
153
    my $redirect_url = URI->new("request.pl");
158
    my $redirect_url = URI->new("request.pl");
154
    $redirect_url->query_form( biblionumber => [@biblionumbers]);
159
    my @failed_hold_msgs = ();
160
    #NOTE: Deduplicate failed hold reason statuses/codes
161
    foreach my $msg (keys %failed_holds){
162
        push(@failed_hold_msgs,$msg);
163
    }
164
    $redirect_url->query_form( biblionumber => [@biblionumbers], failed_holds => \@failed_hold_msgs);
155
    print $input->redirect($redirect_url);
165
    print $input->redirect($redirect_url);
156
}
166
}
157
elsif ( $borrowernumber eq '' ) {
167
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 $op = $input->param('op') || q{};
93
my $op = $input->param('op') || q{};
93
94
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