|
Lines 1-8
Link Here
|
| 1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
| 2 |
|
2 |
|
|
|
3 |
# This file is part of Koha. |
| 4 |
# |
| 5 |
# Koha is free software; you can redistribute it and/or modify it |
| 6 |
# under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# Koha is distributed in the hope that it will be useful, but |
| 11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 17 |
|
| 3 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 4 |
|
19 |
|
| 5 |
use Test::More tests => 12; |
20 |
use Test::More tests => 12; |
|
|
21 |
use t::lib::TestBuilder; |
| 22 |
|
| 6 |
use C4::Context; |
23 |
use C4::Context; |
| 7 |
use C4::Acquisition; |
24 |
use C4::Acquisition; |
| 8 |
use C4::Biblio; |
25 |
use C4::Biblio; |
|
Lines 21-26
$schema->storage->txn_begin();
Link Here
|
| 21 |
my $dbh = C4::Context->dbh; |
38 |
my $dbh = C4::Context->dbh; |
| 22 |
$dbh->{RaiseError} = 1; |
39 |
$dbh->{RaiseError} = 1; |
| 23 |
|
40 |
|
|
|
41 |
my $builder = t::lib::TestBuilder->new; |
| 42 |
my $itemtype = $builder->build({ source => 'Itemtype' })->{ itemtype }; |
| 43 |
|
| 24 |
my $booksellerid1 = C4::Bookseller::AddBookseller( |
44 |
my $booksellerid1 = C4::Bookseller::AddBookseller( |
| 25 |
{ |
45 |
{ |
| 26 |
name => "my vendor 1", |
46 |
name => "my vendor 1", |
|
Lines 44-50
my $budgetid = C4::Budgets::AddBudget(
Link Here
|
| 44 |
my $budget = C4::Budgets::GetBudget( $budgetid ); |
64 |
my $budget = C4::Budgets::GetBudget( $budgetid ); |
| 45 |
|
65 |
|
| 46 |
my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, ''); |
66 |
my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, ''); |
| 47 |
my $itemnumber = AddItem({}, $biblionumber); |
67 |
my $itemnumber = AddItem( { itype => $itemtype }, $biblionumber ); |
| 48 |
|
68 |
|
| 49 |
t::lib::Mocks::mock_preference('AcqCreateItem', 'receiving'); |
69 |
t::lib::Mocks::mock_preference('AcqCreateItem', 'receiving'); |
| 50 |
my $order = Koha::Acquisition::Order->new( |
70 |
my $order = Koha::Acquisition::Order->new( |
|
Lines 71-78
CancelReceipt($ordernumber);
Link Here
|
| 71 |
|
91 |
|
| 72 |
is(scalar GetItemnumbersFromOrder($ordernumber), 0, "Create items on receiving: 0 item exist after cancelling a receipt"); |
92 |
is(scalar GetItemnumbersFromOrder($ordernumber), 0, "Create items on receiving: 0 item exist after cancelling a receipt"); |
| 73 |
|
93 |
|
| 74 |
my $itemnumber1 = AddItem({}, $biblionumber); |
94 |
my $itemnumber1 = AddItem( { itype => $itemtype }, $biblionumber ); |
| 75 |
my $itemnumber2 = AddItem({}, $biblionumber); |
95 |
my $itemnumber2 = AddItem( { itype => $itemtype }, $biblionumber ); |
|
|
96 |
|
| 76 |
t::lib::Mocks::mock_preference('AcqCreateItem', 'ordering'); |
97 |
t::lib::Mocks::mock_preference('AcqCreateItem', 'ordering'); |
| 77 |
t::lib::Mocks::mock_preference('AcqItemSetSubfieldsWhenReceiptIsCancelled', '7=9'); # notforloan is mapped with 952$7 |
98 |
t::lib::Mocks::mock_preference('AcqItemSetSubfieldsWhenReceiptIsCancelled', '7=9'); # notforloan is mapped with 952$7 |
| 78 |
$order = Koha::Acquisition::Order->new( |
99 |
$order = Koha::Acquisition::Order->new( |
| 79 |
- |
|
|