|
Lines 1-3
Link Here
|
|
|
1 |
#!/usr/bin/perl |
| 1 |
|
2 |
|
| 2 |
use Modern::Perl; |
3 |
use Modern::Perl; |
| 3 |
use C4::Context; |
4 |
use C4::Context; |
|
Lines 7-12
use C4::Items;
Link Here
|
| 7 |
use Koha::DateUtils; |
8 |
use Koha::DateUtils; |
| 8 |
use Koha::Patrons; |
9 |
use Koha::Patrons; |
| 9 |
use t::lib::TestBuilder; |
10 |
use t::lib::TestBuilder; |
|
|
11 |
use t::lib::Mocks qw(mock_preference); |
| 10 |
|
12 |
|
| 11 |
use Test::More tests => 8; |
13 |
use Test::More tests => 8; |
| 12 |
|
14 |
|
|
Lines 17-23
C4::Context->_new_userenv(1234567);
Link Here
|
| 17 |
C4::Context->set_userenv(91, 'CLIstaff', '23529001223661', 'CPL', |
19 |
C4::Context->set_userenv(91, 'CLIstaff', '23529001223661', 'CPL', |
| 18 |
'CPL', 'CPL', '', 'cc@cscnet.co.uk'); |
20 |
'CPL', 'CPL', '', 'cc@cscnet.co.uk'); |
| 19 |
|
21 |
|
| 20 |
|
22 |
t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems',0); |
| 21 |
my $test_patron = '23529001223651'; |
23 |
my $test_patron = '23529001223651'; |
| 22 |
my $test_item_fic = '502326000402'; |
24 |
my $test_item_fic = '502326000402'; |
| 23 |
my $test_item_24 = '502326000404'; |
25 |
my $test_item_24 = '502326000404'; |
|
Lines 25-31
my $test_item_48 = '502326000403';
Link Here
|
| 25 |
|
27 |
|
| 26 |
my $builder = t::lib::TestBuilder->new; |
28 |
my $builder = t::lib::TestBuilder->new; |
| 27 |
my $borrower1 = $builder->build_object({ class => 'Koha::Patrons', value => { cardnumber => $test_patron } }); |
29 |
my $borrower1 = $builder->build_object({ class => 'Koha::Patrons', value => { cardnumber => $test_patron } }); |
| 28 |
my $item1 = GetItem (undef,$test_item_fic); |
30 |
my $item1 = $builder->build_object({ |
|
|
31 |
class => 'Koha::Items', |
| 32 |
value => { |
| 33 |
barcode => $test_item_fic, |
| 34 |
} |
| 35 |
}); |
| 36 |
my $item2 = $builder->build_object({ |
| 37 |
class => 'Koha::Items', |
| 38 |
value => { |
| 39 |
barcode => $test_item_24, |
| 40 |
} |
| 41 |
}); |
| 42 |
my $item3 = $builder->build_object({ |
| 43 |
class => 'Koha::Items', |
| 44 |
value => { |
| 45 |
barcode => $test_item_48, |
| 46 |
} |
| 47 |
}); |
| 29 |
|
48 |
|
| 30 |
SKIP: { |
49 |
SKIP: { |
| 31 |
skip 'Missing test borrower or item, skipping tests', 8 |
50 |
skip 'Missing test borrower or item, skipping tests', 8 |
|
Lines 49-55
sub try_issue {
Link Here
|
| 49 |
my $patron = Koha::Patrons->find( { cardnumber => $cardnumber } ); |
68 |
my $patron = Koha::Patrons->find( { cardnumber => $cardnumber } ); |
| 50 |
my ($issuingimpossible,$needsconfirmation) = CanBookBeIssued( $patron, $item ); |
69 |
my ($issuingimpossible,$needsconfirmation) = CanBookBeIssued( $patron, $item ); |
| 51 |
my $issue = AddIssue($patron->unblessed, $item, undef, 0, $issuedate); |
70 |
my $issue = AddIssue($patron->unblessed, $item, undef, 0, $issuedate); |
| 52 |
return dt_from_string( $issue->due_date() ); |
71 |
return dt_from_string( $issue->date_due ); |
| 53 |
} |
72 |
} |
| 54 |
|
73 |
|
| 55 |
sub try_return { |
74 |
sub try_return { |
| 56 |
- |
|
|