|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 66; |
20 |
use Test::More tests => 67; |
| 21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
| 22 |
use Test::Warn; |
22 |
use Test::Warn; |
| 23 |
|
23 |
|
|
Lines 32-37
use C4::Items;
Link Here
|
| 32 |
use C4::Biblio; |
32 |
use C4::Biblio; |
| 33 |
use C4::Members; |
33 |
use C4::Members; |
| 34 |
use C4::Reserves; |
34 |
use C4::Reserves; |
|
|
35 |
use Koha::ActionLogs; |
| 35 |
use Koha::Caches; |
36 |
use Koha::Caches; |
| 36 |
use Koha::DateUtils; |
37 |
use Koha::DateUtils; |
| 37 |
use Koha::Holds; |
38 |
use Koha::Holds; |
|
Lines 1218-1223
subtest 'MergeHolds' => sub {
Link Here
|
| 1218 |
is( $biblio_2->holds->count, 1, 'Hold has been transferred' ); |
1219 |
is( $biblio_2->holds->count, 1, 'Hold has been transferred' ); |
| 1219 |
}; |
1220 |
}; |
| 1220 |
|
1221 |
|
|
|
1222 |
subtest 'ModReserveAffect logging' => sub { |
| 1223 |
|
| 1224 |
plan tests => 4; |
| 1225 |
|
| 1226 |
my $item = $builder->build_sample_item; |
| 1227 |
my $patron = $builder->build_object( |
| 1228 |
{ |
| 1229 |
class => "Koha::Patrons", |
| 1230 |
value => { branchcode => $item->homebranch } |
| 1231 |
} |
| 1232 |
); |
| 1233 |
|
| 1234 |
t::lib::Mocks::mock_userenv({ patron => $patron }); |
| 1235 |
t::lib::Mocks::mock_preference('HoldsLog', 1); |
| 1236 |
|
| 1237 |
my $reserve_id = AddReserve( |
| 1238 |
{ |
| 1239 |
branchcode => $item->homebranch, |
| 1240 |
borrowernumber => $patron->borrowernumber, |
| 1241 |
biblionumber => $item->biblionumber, |
| 1242 |
priority => 1, |
| 1243 |
itemnumber => $item->itemnumber, |
| 1244 |
} |
| 1245 |
); |
| 1246 |
|
| 1247 |
my $hold = Koha::Holds->find($reserve_id); |
| 1248 |
my $previous_timestamp = '1970-01-01 12:34:56'; |
| 1249 |
$hold->timestamp($previous_timestamp)->store; |
| 1250 |
|
| 1251 |
$hold = Koha::Holds->find($reserve_id); |
| 1252 |
is( $hold->timestamp, $previous_timestamp, 'Make sure the previous timestamp has been used' ); |
| 1253 |
|
| 1254 |
# Mark it waiting |
| 1255 |
ModReserveAffect( $item->itemnumber, $patron->borrowernumber ); |
| 1256 |
|
| 1257 |
$hold = Koha::Holds->find($reserve_id); |
| 1258 |
is( $hold->found, 'W', 'Hold has been set waiting' ); |
| 1259 |
isnt( $hold->timestamp, $previous_timestamp, 'The timestamp has been modified' ); |
| 1260 |
|
| 1261 |
my $log = Koha::ActionLogs->search({ module => 'HOLDS', action => 'MODIFY', object => $hold->reserve_id })->next; |
| 1262 |
my $expected = sprintf q{'timestamp' => '%s'}, $hold->timestamp; |
| 1263 |
like( $log->info, qr{$expected}, 'Timestamp logged is the current one' ); |
| 1264 |
}; |
| 1265 |
|
| 1221 |
sub count_hold_print_messages { |
1266 |
sub count_hold_print_messages { |
| 1222 |
my $message_count = $dbh->selectall_arrayref(q{ |
1267 |
my $message_count = $dbh->selectall_arrayref(q{ |
| 1223 |
SELECT COUNT(*) |
1268 |
SELECT COUNT(*) |
| 1224 |
- |
|
|