|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 100; |
20 |
use Test::More tests => 1; |
| 21 |
|
21 |
|
| 22 |
use DateTime; |
22 |
use DateTime; |
| 23 |
|
23 |
|
|
Lines 1729-1734
subtest 'AddReturn | is_overdue' => sub {
Link Here
|
| 1729 |
|
1729 |
|
| 1730 |
}; |
1730 |
}; |
| 1731 |
|
1731 |
|
|
|
1732 |
subtest 'Set waiting flag' => sub { |
| 1733 |
plan tests => 1; |
| 1734 |
|
| 1735 |
my $library_1 = $builder->build( { source => 'Branch' } ); |
| 1736 |
my $patron_1 = $builder->build( { source => 'Borrower', value => { branchcode => $library_1->{branchcode} } } ); |
| 1737 |
my $library_2 = $builder->build( { source => 'Branch' } ); |
| 1738 |
my $patron_2 = $builder->build( { source => 'Borrower', value => { branchcode => $library_2->{branchcode} } } ); |
| 1739 |
|
| 1740 |
my $biblio = $builder->build( { source => 'Biblio' } ); |
| 1741 |
my $biblioitem = $builder->build( { source => 'Biblioitem', value => { biblionumber => $biblio->{biblionumber} } } ); |
| 1742 |
my $item = $builder->build( |
| 1743 |
{ |
| 1744 |
source => 'Item', |
| 1745 |
value => { |
| 1746 |
homebranch => $library_1->{branchcode}, |
| 1747 |
holdingbranch => $library_1->{branchcode}, |
| 1748 |
notforloan => 0, |
| 1749 |
itemlost => 0, |
| 1750 |
withdrawn => 0, |
| 1751 |
biblionumber => $biblioitem->{biblionumber}, |
| 1752 |
} |
| 1753 |
} |
| 1754 |
); |
| 1755 |
|
| 1756 |
|
| 1757 |
|
| 1758 |
set_userenv( $library_2 ); |
| 1759 |
my $reserve_id = AddReserve( |
| 1760 |
$library_2->{branchcode}, $patron_2->{borrowernumber}, $biblioitem->{biblionumber}, |
| 1761 |
'', 1, undef, undef, '', undef, $item->{itemnumber}, |
| 1762 |
); |
| 1763 |
|
| 1764 |
set_userenv( $library_1 ); |
| 1765 |
AddReturn( $item->{barcode}, $library_1->{branchcode} ); |
| 1766 |
ModReserveAffect( $item->{itemnumber}, undef, undef, $reserve_id ); |
| 1767 |
|
| 1768 |
my $hold = Koha::Holds->find( $reserve_id ); |
| 1769 |
is( $hold->found, 'W', 'Hold is waiting' ); |
| 1770 |
}; |
| 1771 |
|
| 1732 |
sub set_userenv { |
1772 |
sub set_userenv { |
| 1733 |
my ( $library ) = @_; |
1773 |
my ( $library ) = @_; |
| 1734 |
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', ''); |
1774 |
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', ''); |
| 1735 |
- |
|
|