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

(-)a/C4/ILSDI/Services.pm (-13 / +3 lines)
Lines 625-631 sub HoldTitle { Link Here
625
625
626
    # Add the reserve
626
    # Add the reserve
627
    #          $branch, $borrowernumber, $biblionumber, $constraint, $bibitems,  $priority, $notes, $title, $checkitem,  $found
627
    #          $branch, $borrowernumber, $biblionumber, $constraint, $bibitems,  $priority, $notes, $title, $checkitem,  $found
628
    AddReserve( $branch, $borrowernumber, $biblionumber, 'a', undef, 0, undef, $title, undef, undef );
628
    AddReserve( $branch, $borrowernumber, $biblionumber, 'a', undef, undef, undef, $title, undef, undef );
629
629
630
    # Hashref building
630
    # Hashref building
631
    my $out;
631
    my $out;
Lines 687-695 sub HoldItem { Link Here
687
    my $canbookbereserved = C4::Reserves::CanBookBeReserved( $borrowernumber, $biblionumber );
687
    my $canbookbereserved = C4::Reserves::CanBookBeReserved( $borrowernumber, $biblionumber );
688
    return { code => 'NotHoldable' } unless $canbookbereserved and $canitembereserved;
688
    return { code => 'NotHoldable' } unless $canbookbereserved and $canitembereserved;
689
689
690
    my $branch;
691
692
    # Pickup branch management
690
    # Pickup branch management
691
    my $branch;
693
    if ( $cgi->param('pickup_location') ) {
692
    if ( $cgi->param('pickup_location') ) {
694
        $branch = $cgi->param('pickup_location');
693
        $branch = $cgi->param('pickup_location');
695
        my $branches = GetBranches();
694
        my $branches = GetBranches();
Lines 698-715 sub HoldItem { Link Here
698
        $branch = $$borrower{branchcode};
697
        $branch = $$borrower{branchcode};
699
    }
698
    }
700
699
701
    my $rank;
702
    my $found;
703
704
    # Get rank and found
705
    $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
706
    if ( $item->{'holdingbranch'} eq $branch ) {
707
        $found = 'W' unless C4::Context->preference('ReservesNeedReturns');
708
    }
709
710
    # Add the reserve
700
    # Add the reserve
711
    # $branch,$borrowernumber,$biblionumber,$constraint,$bibitems,$priority,$resdate,$expdate,$notes,$title,$checkitem,$found
701
    # $branch,$borrowernumber,$biblionumber,$constraint,$bibitems,$priority,$resdate,$expdate,$notes,$title,$checkitem,$found
712
    AddReserve( $branch, $borrowernumber, $biblionumber, 'a', undef, $rank, '', '', '', $title, $itemnumber, $found );
702
    AddReserve( $branch, $borrowernumber, $biblionumber, 'a', undef, undef, '', '', '', $title, $itemnumber );
713
703
714
    # Hashref building
704
    # Hashref building
715
    my $out;
705
    my $out;
(-)a/C4/Reserves.pm (-3 / +47 lines)
Lines 134-140 BEGIN { Link Here
134
134
135
        &GetReservesControlBranch
135
        &GetReservesControlBranch
136
    );
136
    );
137
    @EXPORT_OK = qw( MergeHolds );
137
    @EXPORT_OK = qw(
138
        MergeHolds
139
        GetReserveNextRank
140
    );
138
}    
141
}    
139
142
140
=head2 AddReserve
143
=head2 AddReserve
Lines 161-169 sub AddReserve { Link Here
161
    } else {
164
    } else {
162
        undef $expdate; # make reserves.expirationdate default to null rather than '0000-00-00'
165
        undef $expdate; # make reserves.expirationdate default to null rather than '0000-00-00'
163
    }
166
    }
167
168
    # Calculate priority if not given
169
    if (not defined $priority) {
170
        if ($checkitem and not C4::Context->preference('ReservesNeedReturns')) {
171
            $priority = 0;
172
        } else {
173
            $priority = GetReserveNextRank($biblionumber);
174
        }
175
    }
176
177
    # Calculate found if not given
178
    if ($priority == 0 and not defined $found) {
179
        my $item = GetItem($checkitem);
180
        if ($item->{holdingbranch} eq $branch) {
181
            $found = 'W';
182
        } else {
183
            $found = 'T';
184
        }
185
    }
186
164
    if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
187
    if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
165
	# Make room in reserves for this before those of a later reserve date
188
        # Make room in reserves for this before those of a later reserve date
166
	$priority = _ShiftPriorityByDateAndPriority( $biblionumber, $resdate, $priority );
189
        $priority = _ShiftPriorityByDateAndPriority( $biblionumber, $resdate, $priority );
167
    }
190
    }
168
    my $waitingdate;
191
    my $waitingdate;
169
192
Lines 2214-2219 sub GetReservesControlBranch { Link Here
2214
    return $branchcode;
2237
    return $branchcode;
2215
}
2238
}
2216
2239
2240
=head2 GetReserveNextRank
2241
2242
    my $next_rank = GetReserveNextRank($biblionumber);
2243
2244
Calculate the next available reseve rank for a biblionumber.
2245
2246
=cut
2247
2248
sub GetReserveNextRank {
2249
    my ($biblionumber) = @_;
2250
2251
    my ( $count, $reserves ) = GetReservesFromBiblionumber($biblionumber,1);
2252
    foreach my $res (@$reserves) {
2253
        $count-- if (defined $res->{found} and $res->{found} eq 'W');
2254
    }
2255
    my $rank = $count + 1;
2256
2257
    return $rank;
2258
}
2259
2260
2217
=head1 AUTHOR
2261
=head1 AUTHOR
2218
2262
2219
Koha Development Team <http://koha-community.org/>
2263
Koha Development Team <http://koha-community.org/>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +1 lines)
Lines 435-441 Circulation: Link Here
435
              choices:
435
              choices:
436
                  yes: "Don't automatically"
436
                  yes: "Don't automatically"
437
                  no: Automatically
437
                  no: Automatically
438
            - mark holds as found and waiting when a hold is placed specifically on them and they are already checked in.
438
            - mark a hold as found and waiting when a hold is placed on a specific item and that item is already checked in.
439
        -
439
        -
440
            - Patrons can only have
440
            - Patrons can only have
441
            - pref: maxreserves
441
            - pref: maxreserves
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref (-1 / +2 lines)
Lines 35-43 Web services: Link Here
35
                no: Disable
35
                no: Disable
36
            - ILS-DI services for OPAC users
36
            - ILS-DI services for OPAC users
37
        -
37
        -
38
            - Allow IP addresses
38
            - pref: ILS-DI:AuthorizedIPs
39
            - pref: ILS-DI:AuthorizedIPs
39
              class: Text
40
              class: Text
40
            - allowed IPs to use the ILS-DI services
41
            - to use the ILS-DI services (when enabled). Separate the IP addresses with commas and without spaces. Leave the field blank to allow any IP address.
41
    Reporting:
42
    Reporting:
42
        -
43
        -
43
            - Only return
44
            - Only return
(-)a/opac/opac-reserve.pl (-12 / +2 lines)
Lines 223-229 if ( $query->param('place_reserve') ) { Link Here
223
        }
223
        }
224
224
225
        my $biblioData = $biblioDataHash{$biblioNum};
225
        my $biblioData = $biblioDataHash{$biblioNum};
226
        my $found;
227
226
228
        # Check for user supplied reserve date
227
        # Check for user supplied reserve date
229
        my $startdate;
228
        my $startdate;
Lines 235-251 if ( $query->param('place_reserve') ) { Link Here
235
234
236
        my $expiration_date = $query->param("expiration_date_$biblioNum");
235
        my $expiration_date = $query->param("expiration_date_$biblioNum");
237
236
238
      # If a specific item was selected and the pickup branch is the same as the
239
      # holdingbranch, force the value $rank and $found.
240
        my $rank = $biblioData->{rank};
241
        if ( $itemNum ne '' ) {
237
        if ( $itemNum ne '' ) {
242
            $canreserve = 1 if CanItemBeReserved( $borrowernumber, $itemNum );
238
            $canreserve = 1 if CanItemBeReserved( $borrowernumber, $itemNum );
243
            $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
244
            my $item = GetItem($itemNum);
245
            if ( $item->{'holdingbranch'} eq $branch ) {
246
                $found = 'W'
247
                  unless C4::Context->preference('ReservesNeedReturns');
248
            }
249
        }
239
        }
250
        else {
240
        else {
251
            $canreserve = 1 if CanBookBeReserved( $borrowernumber, $biblioNum );
241
            $canreserve = 1 if CanBookBeReserved( $borrowernumber, $biblioNum );
Lines 266-275 if ( $query->param('place_reserve') ) { Link Here
266
            AddReserve(
256
            AddReserve(
267
                $branch,      $borrowernumber,
257
                $branch,      $borrowernumber,
268
                $biblioNum,   'a',
258
                $biblioNum,   'a',
269
                [$biblioNum], $rank,
259
                [$biblioNum], undef,
270
                $startdate,   $expiration_date,
260
                $startdate,   $expiration_date,
271
                $notes,       $biblioData->{title},
261
                $notes,       $biblioData->{title},
272
                $itemNum,     $found
262
                $itemNum,     undef
273
            );
263
            );
274
            ++$reserve_cnt;
264
            ++$reserve_cnt;
275
        }
265
        }
(-)a/reserve/placerequest.pl (-18 / +4 lines)
Lines 68-86 foreach my $bibnum (@biblionumbers) { Link Here
68
    $bibinfos{$bibnum} = \%bibinfo;
68
    $bibinfos{$bibnum} = \%bibinfo;
69
}
69
}
70
70
71
my $found;
72
73
# if we have an item selectionned, and the pickup branch is the same as the holdingbranch
74
# of the document, we force the value $rank and $found .
75
if ($checkitem ne ''){
76
    $rank[0] = '0' unless C4::Context->preference('ReservesNeedReturns');
77
    my $item = $checkitem;
78
    $item = GetItem($item);
79
    if ( $item->{'holdingbranch'} eq $branch ){
80
        $found = 'W' unless C4::Context->preference('ReservesNeedReturns');
81
    }
82
}
83
84
if ($type eq 'str8' && $borrower){
71
if ($type eq 'str8' && $borrower){
85
72
86
    foreach my $biblionumber (keys %bibinfos) {
73
    foreach my $biblionumber (keys %bibinfos) {
Lines 110-126 if ($type eq 'str8' && $borrower){ Link Here
110
        if ($multi_hold) {
97
        if ($multi_hold) {
111
            my $bibinfo = $bibinfos{$biblionumber};
98
            my $bibinfo = $bibinfos{$biblionumber};
112
            AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,'a',[$biblionumber],
99
            AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,'a',[$biblionumber],
113
                       $bibinfo->{rank},$startdate,$expirationdate,$notes,$bibinfo->{title},$checkitem,$found);
100
                       $bibinfo->{rank},$startdate,$expirationdate,$notes,$bibinfo->{title},$checkitem, undef);
114
        } else {
101
        } else {
115
            if ($input->param('request') eq 'any'){
102
            if ($input->param('request') eq 'any'){
116
                # place a request on 1st available
103
                # place a request on 1st available
117
                AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem,$found);
104
                AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,'a',\@realbi,undef,$startdate,$expirationdate,$notes,$title,$checkitem,undef);
118
            } elsif ($reqbib[0] ne ''){
105
            } elsif ($reqbib[0] ne ''){
119
                # FIXME : elsif probably never reached, (see top of the script)
106
                # FIXME : elsif probably never reached, (see top of the script)
120
                # place a request on a given item
107
                # place a request on a given item
121
                AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,'o',\@reqbib,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem, $found);
108
                AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,'o',\@reqbib,undef,$startdate,$expirationdate,$notes,$title,$checkitem,undef);
122
            } else {
109
            } else {
123
                AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem, $found);
110
                AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,'a',\@realbi,undef,$startdate,$expirationdate,$notes,$title,$checkitem,undef);
124
            }
111
            }
125
        }
112
        }
126
    }
113
    }
127
- 

Return to bug 8918