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

(-)a/C4/ILSDI/Services.pm (-13 / +3 lines)
Lines 624-630 sub HoldTitle { Link Here
624
624
625
    # Add the reserve
625
    # Add the reserve
626
    #          $branch, $borrowernumber, $biblionumber, $constraint, $bibitems,  $priority, $notes, $title, $checkitem,  $found
626
    #          $branch, $borrowernumber, $biblionumber, $constraint, $bibitems,  $priority, $notes, $title, $checkitem,  $found
627
    AddReserve( $branch, $borrowernumber, $biblionumber, 'a', undef, 0, undef, $title, undef, undef );
627
    AddReserve( $branch, $borrowernumber, $biblionumber, 'a', undef, undef, undef, $title, undef, undef );
628
628
629
    # Hashref building
629
    # Hashref building
630
    my $out;
630
    my $out;
Lines 686-694 sub HoldItem { Link Here
686
    my $canbookbereserved = C4::Reserves::CanBookBeReserved( $borrowernumber, $biblionumber );
686
    my $canbookbereserved = C4::Reserves::CanBookBeReserved( $borrowernumber, $biblionumber );
687
    return { code => 'NotHoldable' } unless $canbookbereserved and $canitembereserved;
687
    return { code => 'NotHoldable' } unless $canbookbereserved and $canitembereserved;
688
688
689
    my $branch;
690
691
    # Pickup branch management
689
    # Pickup branch management
690
    my $branch;
692
    if ( $cgi->param('pickup_location') ) {
691
    if ( $cgi->param('pickup_location') ) {
693
        $branch = $cgi->param('pickup_location');
692
        $branch = $cgi->param('pickup_location');
694
        my $branches = GetBranches();
693
        my $branches = GetBranches();
Lines 697-714 sub HoldItem { Link Here
697
        $branch = $$borrower{branchcode};
696
        $branch = $$borrower{branchcode};
698
    }
697
    }
699
698
700
    my $rank;
701
    my $found;
702
703
    # Get rank and found
704
    $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
705
    if ( $item->{'holdingbranch'} eq $branch ) {
706
        $found = 'W' unless C4::Context->preference('ReservesNeedReturns');
707
    }
708
709
    # Add the reserve
699
    # Add the reserve
710
    # $branch,$borrowernumber,$biblionumber,$constraint,$bibitems,$priority,$resdate,$expdate,$notes,$title,$checkitem,$found
700
    # $branch,$borrowernumber,$biblionumber,$constraint,$bibitems,$priority,$resdate,$expdate,$notes,$title,$checkitem,$found
711
    AddReserve( $branch, $borrowernumber, $biblionumber, 'a', undef, $rank, '', '', '', $title, $itemnumber, $found );
701
    AddReserve( $branch, $borrowernumber, $biblionumber, 'a', undef, undef, '', '', '', $title, $itemnumber );
712
702
713
    # Hashref building
703
    # Hashref building
714
    my $out;
704
    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 2236-2241 sub GetReservesControlBranch { Link Here
2236
    return $branchcode;
2259
    return $branchcode;
2237
}
2260
}
2238
2261
2262
=head2 GetReserveNextRank
2263
2264
    my $next_rank = GetReserveNextRank($biblionumber);
2265
2266
Calculate the next available reseve rank for a biblionumber.
2267
2268
=cut
2269
2270
sub GetReserveNextRank {
2271
    my ($biblionumber) = @_;
2272
2273
    my ( $count, $reserves ) = GetReservesFromBiblionumber($biblionumber,1);
2274
    foreach my $res (@$reserves) {
2275
        $count-- if (defined $res->{found} and $res->{found} eq 'W');
2276
    }
2277
    my $rank = $count + 1;
2278
2279
    return $rank;
2280
}
2281
2282
2239
=head1 AUTHOR
2283
=head1 AUTHOR
2240
2284
2241
Koha Development Team <http://koha-community.org/>
2285
Koha Development Team <http://koha-community.org/>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +1 lines)
Lines 436-442 Circulation: Link Here
436
              choices:
436
              choices:
437
                  yes: "Don't automatically"
437
                  yes: "Don't automatically"
438
                  no: Automatically
438
                  no: Automatically
439
            - mark holds as found and waiting when a hold is placed specifically on them and they are already checked in.
439
            - mark a hold as found and waiting when a hold is placed on a specific item and that item is already checked in.
440
        -
440
        -
441
            - Patrons can only have
441
            - Patrons can only have
442
            - pref: maxreserves
442
            - 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