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

(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 1296-1302 sub ModReserveAffect { Link Here
1296
    $sth = $dbh->prepare($query);
1296
    $sth = $dbh->prepare($query);
1297
    $sth->execute( $itemnumber, $borrowernumber,$biblionumber);
1297
    $sth->execute( $itemnumber, $borrowernumber,$biblionumber);
1298
    _koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) if ( !$transferToDo && !$already_on_shelf );
1298
    _koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) if ( !$transferToDo && !$already_on_shelf );
1299
1299
    _FixPriority( { biblionumber => $biblionumber } );
1300
    if ( C4::Context->preference("ReturnToShelvingCart") ) {
1300
    if ( C4::Context->preference("ReturnToShelvingCart") ) {
1301
      CartToShelf( $itemnumber );
1301
      CartToShelf( $itemnumber );
1302
    }
1302
    }
(-)a/t/db_dependent/Reserves.t (-2 / +26 lines)
Lines 2-8 Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use Test::More tests => 31;
5
use Test::More tests => 34;
6
use MARC::Record;
6
use MARC::Record;
7
use DateTime::Duration;
7
use DateTime::Duration;
8
8
Lines 15-20 use t::lib::Mocks; Link Here
15
15
16
use Koha::DateUtils;
16
use Koha::DateUtils;
17
17
18
use Data::Dumper;
18
BEGIN {
19
BEGIN {
19
    use_ok('C4::Reserves');
20
    use_ok('C4::Reserves');
20
}
21
}
Lines 199-204 my ($itemnum_cpl, $itemnum_fpl); Link Here
199
        barcode => 'bug10272_FPL'
200
        barcode => 'bug10272_FPL'
200
    } , $bibnum2);
201
    } , $bibnum2);
201
202
203
# Ensure that priorities are numbered correcly when a hold is moved to waiting
204
# (bug 11947)
205
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
206
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
207
           $constraint, $bibitems,  1, $resdate, $expdate, $notes,
208
           $title,      $checkitem, $found);
209
AddReserve('FPL',  $requesters{'FPL'}, $bibnum2,
210
           $constraint, $bibitems,  2, $resdate, $expdate, $notes,
211
           $title,      $checkitem, $found);
212
AddReserve('CPL',  $requesters{'CPL'}, $bibnum2,
213
           $constraint, $bibitems,  3, $resdate, $expdate, $notes,
214
           $title,      $checkitem, $found);
215
ModReserveAffect($itemnum_cpl, $requesters{'RPL'}, 0);
216
217
# Now it should have different priorities.
218
my $title_reserves = GetReservesFromBiblionumber({biblionumber => $bibnum2});
219
# Sort by reserve number in case the database gives us oddly ordered results
220
my @reserves = sort { $a->{reserve_id} <=> $b->{reserve_id} } @$title_reserves;
221
is($reserves[0]{priority}, 0, 'Item is correctly waiting');
222
is($reserves[1]{priority}, 1, 'Item is correctly priority 1');
223
is($reserves[2]{priority}, 2, 'Item is correctly priority 2');
224
225
226
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
202
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
227
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
203
           $constraint, $bibitems,  1, $resdate, $expdate, $notes,
228
           $constraint, $bibitems,  1, $resdate, $expdate, $notes,
204
           $title,      $checkitem, $found);
229
           $title,      $checkitem, $found);
205
- 

Return to bug 11947