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

(-)a/t/db_dependent/Holds.t (-1 / +76 lines)
Lines 7-25 use t::lib::TestBuilder; Link Here
7
7
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 66;
10
use Test::More tests => 67;
11
use MARC::Record;
11
use MARC::Record;
12
12
13
use C4::Biblio;
13
use C4::Biblio;
14
use C4::Calendar;
14
use C4::Calendar;
15
use C4::Items;
15
use C4::Items;
16
use C4::Reserves;
16
use C4::Reserves;
17
use C4::Circulation;
17
18
18
use Koha::Biblios;
19
use Koha::Biblios;
19
use Koha::CirculationRules;
20
use Koha::CirculationRules;
20
use Koha::Database;
21
use Koha::Database;
21
use Koha::DateUtils qw( dt_from_string output_pref );
22
use Koha::DateUtils qw( dt_from_string output_pref );
22
use Koha::Holds;
23
use Koha::Holds;
24
use Koha::Checkout;
23
use Koha::Item::Transfer::Limits;
25
use Koha::Item::Transfer::Limits;
24
use Koha::Items;
26
use Koha::Items;
25
use Koha::Libraries;
27
use Koha::Libraries;
Lines 1251-1253 subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { Link Here
1251
1253
1252
    $schema->storage->txn_rollback;
1254
    $schema->storage->txn_rollback;
1253
};
1255
};
1256
1257
subtest 'non priority holds' => sub {
1258
1259
    plan tests => 4;
1260
1261
    $schema->storage->txn_begin;
1262
1263
    # Cleanup database
1264
    Koha::Holds->search->delete;
1265
    $dbh->do('DELETE FROM issues');
1266
    Koha::CirculationRules->set_rules(
1267
        {
1268
            branchcode   => undef,
1269
            categorycode => undef,
1270
            itemtype     => undef,
1271
            rules        => {
1272
                renewalsallowed => 5,
1273
                reservesallowed => 5,
1274
            }
1275
        }
1276
    );
1277
1278
    my $item = $builder->build_sample_item;
1279
1280
    my $patron1 = $builder->build_object(
1281
        {
1282
            class => 'Koha::Patrons',
1283
            value => { branchcode => $item->homebranch }
1284
        }
1285
    );
1286
    my $patron2 = $builder->build_object(
1287
        {
1288
            class => 'Koha::Patrons',
1289
            value => { branchcode => $item->homebranch }
1290
        }
1291
    );
1292
1293
    Koha::Checkout->new(
1294
        {
1295
            borrowernumber => $patron1->borrowernumber,
1296
            itemnumber     => $item->itemnumber,
1297
            branchcode     => $item->homebranch
1298
        }
1299
    )->store;
1300
1301
    my $hid = AddReserve(
1302
        {
1303
            branchcode     => $item->homebranch,
1304
            borrowernumber => $patron2->borrowernumber,
1305
            biblionumber   => $item->biblionumber,
1306
            priority       => 1,
1307
            itemnumber     => $item->itemnumber,
1308
        }
1309
    );
1310
1311
    my ( $ok, $err ) =
1312
      CanBookBeRenewed( $patron1->borrowernumber, $item->itemnumber );
1313
1314
    ok( !$ok, 'Cannot renew' );
1315
    is( $err, 'on_reserve', 'Item is on hold' );
1316
1317
    my $hold = Koha::Holds->find($hid);
1318
    $hold->non_priority(1)->store;
1319
1320
    ( $ok, $err ) =
1321
      CanBookBeRenewed( $patron1->borrowernumber, $item->itemnumber );
1322
1323
    ok( $ok, 'Can renew' );
1324
    is( $err, undef, 'Item is on non priority hold' );
1325
1326
    $schema->storage->txn_rollback;
1327
1328
};
(-)a/t/lib/TestBuilder.pm (-1 / +3 lines)
Lines 563-568 sub _gen_default_values { Link Here
563
        Branch => {
563
        Branch => {
564
            pickup_location => 0,
564
            pickup_location => 0,
565
        },
565
        },
566
        Reserve => {
567
            non_priority => 0,
568
        },
566
        Itemtype => {
569
        Itemtype => {
567
            rentalcharge => 0,
570
            rentalcharge => 0,
568
            rentalcharge_daily => 0,
571
            rentalcharge_daily => 0,
569
- 

Return to bug 22789