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

(-)a/t/db_dependent/Koha/Holds.t (-13 / +12 lines)
Lines 266-279 subtest 'cancel' => sub { Link Here
266
266
267
        $account = Koha::Account->new({ patron_id => $borrowernumber });
267
        $account = Koha::Account->new({ patron_id => $borrowernumber });
268
268
269
        ( $status ) = CheckReserves($item1->id);
269
        ( $status ) = CheckReserves($item1);
270
        is( $status, 'Reserved', "Hold for the itemtype1 created" );
270
        is( $status, 'Reserved', "Hold for the itemtype1 created" );
271
271
272
        $start_balance = $account->balance();
272
        $start_balance = $account->balance();
273
273
274
        Koha::Holds->find( $reserve_id )->cancel({ charge_cancel_fee => 1 });
274
        Koha::Holds->find( $reserve_id )->cancel({ charge_cancel_fee => 1 });
275
275
276
        ( $status ) = CheckReserves($item1->id);
276
        ( $status ) = CheckReserves($item1);
277
        is( $status, '', "Hold for the itemtype1 cancelled" );
277
        is( $status, '', "Hold for the itemtype1 cancelled" );
278
278
279
        is( $account->balance() - $start_balance, 111, "Used circulation rule for itemtype1" );
279
        is( $account->balance() - $start_balance, 111, "Used circulation rule for itemtype1" );
Lines 293-306 subtest 'cancel' => sub { Link Here
293
293
294
        $account = Koha::Account->new({ patron_id => $borrowernumber });
294
        $account = Koha::Account->new({ patron_id => $borrowernumber });
295
295
296
        ( $status ) = CheckReserves($item2->id);
296
        ( $status ) = CheckReserves($item2);
297
        is( $status, 'Reserved', "Hold for the itemtype2 created" );
297
        is( $status, 'Reserved', "Hold for the itemtype2 created" );
298
298
299
        $start_balance = $account->balance();
299
        $start_balance = $account->balance();
300
300
301
        Koha::Holds->find( $reserve_id )->cancel({ charge_cancel_fee => 1 });
301
        Koha::Holds->find( $reserve_id )->cancel({ charge_cancel_fee => 1 });
302
302
303
        ( $status ) = CheckReserves($item2->id);
303
        ( $status ) = CheckReserves($item2);
304
        is( $status, '', "Hold for the itemtype2 cancelled" );
304
        is( $status, '', "Hold for the itemtype2 cancelled" );
305
305
306
        is( $account->balance() - $start_balance, 222, "Used ExpireReservesMaxPickUpDelayCharge preference as expire_reserves_charge set to undef" );
306
        is( $account->balance() - $start_balance, 222, "Used ExpireReservesMaxPickUpDelayCharge preference as expire_reserves_charge set to undef" );
Lines 320-333 subtest 'cancel' => sub { Link Here
320
320
321
        $account = Koha::Account->new({ patron_id => $borrowernumber });
321
        $account = Koha::Account->new({ patron_id => $borrowernumber });
322
322
323
        ( $status ) = CheckReserves($item3->id);
323
        ( $status ) = CheckReserves($item3);
324
        is( $status, 'Reserved', "Hold for the itemtype3 created" );
324
        is( $status, 'Reserved', "Hold for the itemtype3 created" );
325
325
326
        $start_balance = $account->balance();
326
        $start_balance = $account->balance();
327
327
328
        Koha::Holds->find( $reserve_id )->cancel({ charge_cancel_fee => 1 });
328
        Koha::Holds->find( $reserve_id )->cancel({ charge_cancel_fee => 1 });
329
329
330
        ( $status ) = CheckReserves($item3->id);
330
        ( $status ) = CheckReserves($item3);
331
        is( $status, '', "Hold for the itemtype3 cancelled" );
331
        is( $status, '', "Hold for the itemtype3 cancelled" );
332
332
333
        is( $account->balance() - $start_balance, 333, "Used ExpireReservesMaxPickUpDelayCharge preference as there's no circulation rules for itemtype3" );
333
        is( $account->balance() - $start_balance, 333, "Used ExpireReservesMaxPickUpDelayCharge preference as there's no circulation rules for itemtype3" );
Lines 347-360 subtest 'cancel' => sub { Link Here
347
347
348
        $account = Koha::Account->new({ patron_id => $borrowernumber });
348
        $account = Koha::Account->new({ patron_id => $borrowernumber });
349
349
350
        ( $status ) = CheckReserves($item4->id);
350
        ( $status ) = CheckReserves($item4);
351
        is( $status, 'Reserved', "Hold for the itemtype4 created" );
351
        is( $status, 'Reserved', "Hold for the itemtype4 created" );
352
352
353
        $start_balance = $account->balance();
353
        $start_balance = $account->balance();
354
354
355
        Koha::Holds->find( $reserve_id )->cancel({ charge_cancel_fee => 1 });
355
        Koha::Holds->find( $reserve_id )->cancel({ charge_cancel_fee => 1 });
356
356
357
        ( $status ) = CheckReserves($item4->id);
357
        ( $status ) = CheckReserves($item4);
358
        is( $status, '', "Hold for the itemtype4 cancelled" );
358
        is( $status, '', "Hold for the itemtype4 cancelled" );
359
359
360
        is( $account->balance() - $start_balance, 444, "Used circulation rule for itemtype4 with library_B_code" );
360
        is( $account->balance() - $start_balance, 444, "Used circulation rule for itemtype4 with library_B_code" );
Lines 374-387 subtest 'cancel' => sub { Link Here
374
374
375
        $account = Koha::Account->new({ patron_id => $borrowernumber });
375
        $account = Koha::Account->new({ patron_id => $borrowernumber });
376
376
377
        ( $status ) = CheckReserves($item5->id);
377
        ( $status ) = CheckReserves($item5);
378
        is( $status, 'Reserved', "Hold for the itemtype5 created" );
378
        is( $status, 'Reserved', "Hold for the itemtype5 created" );
379
379
380
        $start_balance = $account->balance();
380
        $start_balance = $account->balance();
381
381
382
        Koha::Holds->find( $reserve_id )->cancel({ charge_cancel_fee => 1 });
382
        Koha::Holds->find( $reserve_id )->cancel({ charge_cancel_fee => 1 });
383
383
384
        ( $status ) = CheckReserves($item5->id);
384
        ( $status ) = CheckReserves($item5);
385
        is( $status, '', "Hold for the itemtype5 cancelled" );
385
        is( $status, '', "Hold for the itemtype5 cancelled" );
386
386
387
        is( $account->balance() - $start_balance, 0, "Used circulation rule for itemtype4 with library_C_code even though it's 0" );
387
        is( $account->balance() - $start_balance, 0, "Used circulation rule for itemtype4 with library_C_code even though it's 0" );
Lines 399-412 subtest 'cancel' => sub { Link Here
399
399
400
        $account = Koha::Account->new({ patron_id => $borrowernumber });
400
        $account = Koha::Account->new({ patron_id => $borrowernumber });
401
401
402
        ( $status ) = CheckReserves($item4->id);
402
        ( $status ) = CheckReserves($item4);
403
        is( $status, 'Reserved', "Hold for the itemtype4 created" );
403
        is( $status, 'Reserved', "Hold for the itemtype4 created" );
404
404
405
        $start_balance = $account->balance();
405
        $start_balance = $account->balance();
406
406
407
        Koha::Holds->find( $reserve_id )->cancel({ charge_cancel_fee => 0 });
407
        Koha::Holds->find( $reserve_id )->cancel({ charge_cancel_fee => 0 });
408
408
409
        ( $status ) = CheckReserves($item4->id);
409
        ( $status ) = CheckReserves($item4);
410
        is( $status, '', "Hold for the itemtype4 cancelled" );
410
        is( $status, '', "Hold for the itemtype4 cancelled" );
411
411
412
        is( $account->balance() - $start_balance, 0, "Patron not charged when charge_cancel_fee is 0" );
412
        is( $account->balance() - $start_balance, 0, "Patron not charged when charge_cancel_fee is 0" );
413
- 

Return to bug 25711