|
Lines 475-484
is( scalar( @$orders ), 1, 'GetHistory returns correctly a search for internalno
Link Here
|
| 475 |
$orders = GetHistory( vendornote => 'vendor note foo' ); |
475 |
$orders = GetHistory( vendornote => 'vendor note foo' ); |
| 476 |
is( scalar( @$orders ), 1, 'GetHistory returns correctly a search for vendornote' ); |
476 |
is( scalar( @$orders ), 1, 'GetHistory returns correctly a search for vendornote' ); |
| 477 |
|
477 |
|
| 478 |
|
|
|
| 479 |
# Test GetHistory() with and without SearchWithISBNVariations |
| 480 |
# The ISBN passed as a param is the ISBN-10 version of the 13-digit ISBN in the sample record declared in $marcxml |
| 481 |
|
| 482 |
my $budgetid2 = C4::Budgets::AddBudget( |
478 |
my $budgetid2 = C4::Budgets::AddBudget( |
| 483 |
{ |
479 |
{ |
| 484 |
budget_code => "budget_code_test_modrecv", |
480 |
budget_code => "budget_code_test_modrecv", |
|
Lines 616-631
sub run_flavoured_tests {
Link Here
|
| 616 |
is( scalar(@$orders), 1, "GetHistory searches correctly by ISBN" ); |
612 |
is( scalar(@$orders), 1, "GetHistory searches correctly by ISBN" ); |
| 617 |
|
613 |
|
| 618 |
Koha::Acquisition::Orders->find($ordernumber)->cancel; |
614 |
Koha::Acquisition::Orders->find($ordernumber)->cancel; |
|
|
615 |
|
| 616 |
my $marc_record_issn = MARC::Record->new; |
| 617 |
$marc_record_issn->append_fields( create_issn_field( '2434561X', $marcflavour ) ); |
| 618 |
my ( $biblionumber6_issn, undef ) = AddBiblio( $marc_record_issn, '' ); |
| 619 |
|
| 620 |
my $orders_issn = GetHistory( issn => '2434561X' ); |
| 621 |
is( scalar(@$orders_issn), 0, "Precheck that ISSN shouln't be in database" ); |
| 622 |
|
| 623 |
# Create order |
| 624 |
my $ordernumber_issn = Koha::Acquisition::Order->new( { |
| 625 |
basketno => $basketno, |
| 626 |
biblionumber => $biblionumber6_issn, |
| 627 |
budget_id => $budget->{budget_id}, |
| 628 |
order_internalnote => "internal note", |
| 629 |
order_vendornote => "vendor note", |
| 630 |
quantity => 1, |
| 631 |
ecost => 10, |
| 632 |
rrp => 10, |
| 633 |
listprice => 10, |
| 634 |
ecost => 10, |
| 635 |
rrp => 10, |
| 636 |
discount => 0, |
| 637 |
uncertainprice => 0, |
| 638 |
} )->store->ordernumber; |
| 639 |
|
| 640 |
t::lib::Mocks::mock_preference('SearchWithISSNVariations', 0); |
| 641 |
$orders_issn = GetHistory( issn => '2434-561X' ); |
| 642 |
is( scalar(@$orders_issn), 0, "GetHistory searches correctly by ISSN" ); |
| 643 |
|
| 644 |
t::lib::Mocks::mock_preference('SearchWithISSNVariations', 1); |
| 645 |
$orders_issn = GetHistory( issn => '2434-561X' ); |
| 646 |
is( scalar(@$orders_issn), 1, "GetHistory searches correctly by ISSN" ); |
| 647 |
|
| 648 |
Koha::Acquisition::Orders->find($ordernumber_issn)->cancel; |
| 619 |
} |
649 |
} |
| 620 |
|
650 |
|
|
|
651 |
# Test GetHistory() with and without SearchWithISBNVariations or SearchWithISSNVariations |
| 652 |
# The ISBN passed as a param is the ISBN-10 version of the 13-digit ISBN in the sample record declared in $marcxml |
| 653 |
|
| 621 |
# Do "flavoured" tests |
654 |
# Do "flavoured" tests |
| 622 |
subtest 'MARC21' => sub { |
655 |
subtest 'MARC21' => sub { |
| 623 |
plan tests => 2; |
656 |
plan tests => 5; |
| 624 |
run_flavoured_tests('MARC21'); |
657 |
run_flavoured_tests('MARC21'); |
| 625 |
}; |
658 |
}; |
| 626 |
|
659 |
|
| 627 |
subtest 'UNIMARC' => sub { |
660 |
subtest 'UNIMARC' => sub { |
| 628 |
plan tests => 2; |
661 |
plan tests => 5; |
| 629 |
run_flavoured_tests('UNIMARC'); |
662 |
run_flavoured_tests('UNIMARC'); |
| 630 |
}; |
663 |
}; |
| 631 |
|
664 |
|
|
Lines 663-668
sub create_isbn_field {
Link Here
|
| 663 |
return $field; |
696 |
return $field; |
| 664 |
} |
697 |
} |
| 665 |
|
698 |
|
|
|
699 |
sub create_issn_field { |
| 700 |
my ( $issn, $marcflavour ) = @_; |
| 701 |
|
| 702 |
my ( $issn_field, $issn_subfield ) = get_issn_field(); |
| 703 |
my $field = MARC::Field->new( $issn_field, '', '', $issn_subfield => $issn ); |
| 704 |
|
| 705 |
return $field; |
| 706 |
} |
| 707 |
|
| 666 |
subtest 'ModReceiveOrder replacementprice tests' => sub { |
708 |
subtest 'ModReceiveOrder replacementprice tests' => sub { |
| 667 |
plan tests => 2; |
709 |
plan tests => 2; |
| 668 |
#Let's build an order, we need a couple things though |
710 |
#Let's build an order, we need a couple things though |
| 669 |
- |
|
|