Lines 18-24
Link Here
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
use utf8; |
19 |
use utf8; |
20 |
|
20 |
|
21 |
use Test::More tests => 60; |
21 |
use Test::More tests => 59; |
22 |
use Test::Exception; |
22 |
use Test::Exception; |
23 |
use Test::MockModule; |
23 |
use Test::MockModule; |
24 |
use Test::Deep qw( cmp_deeply ); |
24 |
use Test::Deep qw( cmp_deeply ); |
Lines 33-39
use t::lib::TestBuilder;
Link Here
|
33 |
|
33 |
|
34 |
use C4::Accounts; |
34 |
use C4::Accounts; |
35 |
use C4::Calendar qw( new insert_single_holiday insert_week_day_holiday delete_holiday ); |
35 |
use C4::Calendar qw( new insert_single_holiday insert_week_day_holiday delete_holiday ); |
36 |
use C4::Circulation qw( AddIssue AddReturn CanBookBeRenewed GetIssuingCharges AddRenewal GetSoonestRenewDate GetLatestAutoRenewDate LostItem GetUpcomingDueIssues CanBookBeIssued AddIssuingCharge MarkIssueReturned ProcessOfflinePayment transferbook updateWrongTransfer ); |
36 |
use C4::Circulation qw( AddIssue AddReturn CanBookBeRenewed GetIssuingCharges AddRenewal GetSoonestRenewDate GetLatestAutoRenewDate LostItem GetUpcomingDueIssues CanBookBeIssued AddIssuingCharge MarkIssueReturned ProcessOfflinePayment transferbook ); |
37 |
use C4::Biblio; |
37 |
use C4::Biblio; |
38 |
use C4::Items qw( ModItemTransfer ); |
38 |
use C4::Items qw( ModItemTransfer ); |
39 |
use C4::Log; |
39 |
use C4::Log; |
Lines 5114-5159
subtest "Item's onloan value should be set if checked out item is checked out to
Link Here
|
5114 |
ok( $item->get_from_storage->onloan, "Item's onloan column is set after second checkout" ); |
5114 |
ok( $item->get_from_storage->onloan, "Item's onloan column is set after second checkout" ); |
5115 |
}; |
5115 |
}; |
5116 |
|
5116 |
|
5117 |
subtest "updateWrongTransfer tests" => sub { |
|
|
5118 |
plan tests => 5; |
5119 |
|
5120 |
my $library1 = $builder->build_object( { class => 'Koha::Libraries' } ); |
5121 |
my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
5122 |
my $library3 = $builder->build_object( { class => 'Koha::Libraries' } ); |
5123 |
my $item = $builder->build_sample_item( |
5124 |
{ |
5125 |
homebranch => $library1->branchcode, |
5126 |
holdingbranch => $library2->branchcode, |
5127 |
datelastseen => undef |
5128 |
} |
5129 |
); |
5130 |
|
5131 |
my $transfer = $builder->build_object( |
5132 |
{ |
5133 |
class => 'Koha::Item::Transfers', |
5134 |
value => { |
5135 |
itemnumber => $item->itemnumber, |
5136 |
frombranch => $library2->branchcode, |
5137 |
tobranch => $library1->branchcode, |
5138 |
daterequested => dt_from_string, |
5139 |
datesent => dt_from_string, |
5140 |
datecancelled => undef, |
5141 |
datearrived => undef, |
5142 |
reason => 'Manual' |
5143 |
} |
5144 |
} |
5145 |
); |
5146 |
is( ref($transfer), 'Koha::Item::Transfer', 'Mock transfer added' ); |
5147 |
|
5148 |
my $new_transfer = C4::Circulation::updateWrongTransfer($item->itemnumber, $library1->branchcode); |
5149 |
is(ref($new_transfer), 'Koha::Item::Transfer', "updateWrongTransfer returns a 'Koha::Item::Transfer' object"); |
5150 |
ok( !$new_transfer->in_transit, "New transfer is NOT created as in transit (or cancelled)"); |
5151 |
|
5152 |
my $original_transfer = $transfer->get_from_storage; |
5153 |
ok( defined($original_transfer->datecancelled), "Original transfer was cancelled"); |
5154 |
is( $original_transfer->cancellation_reason, 'WrongTransfer', "Original transfer cancellation reason is 'WrongTransfer'"); |
5155 |
}; |
5156 |
|
5157 |
subtest "SendCirculationAlert" => sub { |
5117 |
subtest "SendCirculationAlert" => sub { |
5158 |
plan tests => 2; |
5118 |
plan tests => 2; |
5159 |
|
5119 |
|
5160 |
- |
|
|