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

(-)a/C4/Reserves.pm (+9 lines)
Lines 252-257 sub AddReserve { Link Here
252
252
253
    $res = GetReserve( $reserve_id );
253
    $res = GetReserve( $reserve_id );
254
254
255
    Return the current reserve or the old reserve.
256
255
=cut
257
=cut
256
258
257
sub GetReserve {
259
sub GetReserve {
Lines 262-267 sub GetReserve { Link Here
262
    my $sth = $dbh->prepare( $query );
264
    my $sth = $dbh->prepare( $query );
263
    $sth->execute( $reserve_id );
265
    $sth->execute( $reserve_id );
264
    my $res = $sth->fetchrow_hashref();
266
    my $res = $sth->fetchrow_hashref();
267
268
    unless ( $res ) {
269
        $res = $dbh->selectrow_hashref(q|
270
            SELECT * FROM old_reserves WHERE reserve_id = ?
271
        |, {}, $reserve_id);
272
    }
273
265
    return $res;
274
    return $res;
266
}
275
}
267
276
(-)a/t/db_dependent/Holds.t (-4 / +45 lines)
Lines 1-13 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use strict;
3
use Modern::Perl;
4
use warnings;
5
4
6
use t::lib::Mocks;
5
use t::lib::Mocks;
7
use C4::Context;
6
use C4::Context;
8
use C4::Branch;
7
use C4::Branch;
9
8
10
use Test::More tests => 22;
9
use Test::More tests => 23;
11
use MARC::Record;
10
use MARC::Record;
12
use C4::Biblio;
11
use C4::Biblio;
13
use C4::Items;
12
use C4::Items;
Lines 215-220 ok( Link Here
215
    '... unless canreservefromotherbranches is ON (bug 2394)'
214
    '... unless canreservefromotherbranches is ON (bug 2394)'
216
);
215
);
217
216
217
# Regression test for bug 11336
218
($bibnum, $title, $bibitemnum) = create_helper_biblio();
219
my ( $hold1, $hold2 );
220
($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum);
221
AddReserve(
222
    $branch,
223
    $borrowernumbers[0],
224
    $bibnum,
225
    'a',
226
    '',
227
    1,
228
);
229
230
my $reserveid1 = C4::Reserves::GetReserveId(
231
    {
232
        biblionumber => $bibnum,
233
        borrowernumber => $borrowernumbers[0]
234
    }
235
);
236
237
($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum);
238
AddReserve(
239
    $branch,
240
    $borrowernumbers[1],
241
    $bibnum,
242
    'a',
243
    '',
244
    2,
245
);
246
my $reserveid2 = C4::Reserves::GetReserveId(
247
    {
248
        biblionumber => $bibnum,
249
        borrowernumber => $borrowernumbers[1]
250
    }
251
);
252
253
CancelReserve({ reserve_id => $reserveid1 });
254
255
$reserve2 = GetReserve( $reserveid2 );
256
is( $reserve2->{priority}, 1, "After cancelreserve, the 2nd reserve become the first on the waiting list" );
257
258
259
218
# Helper method to set up a Biblio.
260
# Helper method to set up a Biblio.
219
sub create_helper_biblio {
261
sub create_helper_biblio {
220
    my $bib = MARC::Record->new();
262
    my $bib = MARC::Record->new();
221
- 

Return to bug 11336