Lines 19-27
use Modern::Perl;
Link Here
|
19 |
|
19 |
|
20 |
use POSIX qw(strftime); |
20 |
use POSIX qw(strftime); |
21 |
|
21 |
|
22 |
use Test::More tests => 65; |
22 |
use Test::More tests => 67; |
|
|
23 |
use t::lib::Mocks; |
23 |
use Koha::Database; |
24 |
use Koha::Database; |
24 |
|
25 |
|
|
|
26 |
use MARC::File::XML ( BinaryEncoding => 'utf8', RecordFormat => 'MARC21' ); |
27 |
|
25 |
BEGIN { |
28 |
BEGIN { |
26 |
use_ok('C4::Acquisition'); |
29 |
use_ok('C4::Acquisition'); |
27 |
use_ok('C4::Biblio'); |
30 |
use_ok('C4::Biblio'); |
Lines 161-178
my $budgetid = C4::Budgets::AddBudget(
Link Here
|
161 |
); |
164 |
); |
162 |
my $budget = C4::Budgets::GetBudget($budgetid); |
165 |
my $budget = C4::Budgets::GetBudget($budgetid); |
163 |
|
166 |
|
|
|
167 |
# Prepare a sample MARC record with a ISBN to test GetHistory() |
168 |
my $marcxml = qq{<?xml version="1.0" encoding="UTF-8"?> |
169 |
<record |
170 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
171 |
xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" |
172 |
xmlns="http://www.loc.gov/MARC21/slim"> |
173 |
|
174 |
<leader>03108cam a2200277 i 4500</leader> |
175 |
<controlfield tag="001">a2526595</controlfield> |
176 |
<controlfield tag="003">Koha</controlfield> |
177 |
<controlfield tag="005">20170306104815.0</controlfield> |
178 |
<controlfield tag="006">m o d </controlfield> |
179 |
<controlfield tag="007">cr |||||||||||</controlfield> |
180 |
<controlfield tag="008">150723s2016 vau b 000 0 eng d</controlfield> |
181 |
<datafield tag="020" ind1=" " ind2=" "> |
182 |
<subfield code="a">9780136019701</subfield> |
183 |
</datafield> |
184 |
</record> |
185 |
}; |
186 |
|
164 |
my @ordernumbers; |
187 |
my @ordernumbers; |
165 |
my ( $biblionumber1, $biblioitemnumber1 ) = AddBiblio( MARC::Record->new, '' ); |
188 |
my ( $biblionumber1, $biblioitemnumber1 ) = AddBiblio( MARC::Record->new, '' ); |
166 |
my ( $biblionumber2, $biblioitemnumber2 ) = AddBiblio( MARC::Record->new, '' ); |
189 |
my ( $biblionumber2, $biblioitemnumber2 ) = AddBiblio( MARC::Record->new, '' ); |
167 |
my ( $biblionumber3, $biblioitemnumber3 ) = AddBiblio( MARC::Record->new, '' ); |
190 |
my ( $biblionumber3, $biblioitemnumber3 ) = AddBiblio( MARC::Record->new, '' ); |
168 |
my ( $biblionumber4, $biblioitemnumber4 ) = AddBiblio( MARC::Record->new, '' ); |
191 |
my ( $biblionumber4, $biblioitemnumber4 ) = AddBiblio( MARC::Record->new, '' ); |
169 |
my ( $biblionumber5, $biblioitemnumber5 ) = AddBiblio( MARC::Record->new, '' ); |
192 |
my ( $biblionumber5, $biblioitemnumber5 ) = AddBiblio( MARC::Record->new_from_xml( $marcxml, 'utf8', 'MARC21' ), '' ); |
170 |
|
193 |
|
171 |
# Prepare 5 orders, and make distinction beween fields to be tested with eq and with == |
194 |
# Prepare 5 orders, and make distinction beween fields to be tested with eq and with == |
172 |
# Ex : a price of 50.1 will be stored internally as 5.100000 |
195 |
# Ex : a price of 50.1 will be stored internally as 5.100000 |
173 |
|
196 |
|
174 |
my @order_content = ( |
197 |
my @order_content = ( |
175 |
{ |
198 |
{ |
176 |
str => { |
199 |
str => { |
177 |
basketno => $basketno, |
200 |
basketno => $basketno, |
178 |
biblionumber => $biblionumber1, |
201 |
biblionumber => $biblionumber1, |
Lines 433-438
is( scalar( @$orders ), 1, 'GetHistory with a given ordernumber returns 1 order'
Link Here
|
433 |
$orders = GetHistory( ordernumber => $ordernumbers[1], search_children_too => 1 ); |
456 |
$orders = GetHistory( ordernumber => $ordernumbers[1], search_children_too => 1 ); |
434 |
is( scalar( @$orders ), 2, 'GetHistory with a given ordernumber and search_children_too set returns 2 orders' ); |
457 |
is( scalar( @$orders ), 2, 'GetHistory with a given ordernumber and search_children_too set returns 2 orders' ); |
435 |
|
458 |
|
|
|
459 |
# Test GetHistory() with and without SearchWithISBNVariations |
460 |
# The ISBN passed as a param is the ISBN-10 version of the 13-digit ISBN in the sample record declared in $marcxml |
461 |
t::lib::Mocks::mock_preference('SearchWithISBNVariations', 0); |
462 |
$orders = GetHistory( isbn => '0136019706' ); |
463 |
is( scalar(@$orders), 0, "GetHistory searches correctly by ISBN" ); |
464 |
|
465 |
t::lib::Mocks::mock_preference('SearchWithISBNVariations', 1); |
466 |
$orders = GetHistory( isbn => '0136019706' ); |
467 |
is( scalar(@$orders), 1, "GetHistory searches correctly by ISBN" ); |
468 |
|
436 |
my $budgetid2 = C4::Budgets::AddBudget( |
469 |
my $budgetid2 = C4::Budgets::AddBudget( |
437 |
{ |
470 |
{ |
438 |
budget_code => "budget_code_test_modrecv", |
471 |
budget_code => "budget_code_test_modrecv", |
439 |
- |
|
|