View | Details | Raw Unified | Return to bug 40387
Collapse All | Expand All

(-)a/Koha/EDI.pm (-4 / +5 lines)
Lines 21-27 use strict; Link Here
21
use warnings;
21
use warnings;
22
use base qw(Exporter);
22
use base qw(Exporter);
23
use utf8;
23
use utf8;
24
use Carp    qw( carp );
25
use English qw{ -no_match_vars };
24
use English qw{ -no_match_vars };
26
use Business::ISBN;
25
use Business::ISBN;
27
use DateTime;
26
use DateTime;
Lines 69-76 sub create_edi_order { Link Here
69
    my $ean        = $parameters->{ean};
68
    my $ean        = $parameters->{ean};
70
    my $branchcode = $parameters->{branchcode};
69
    my $branchcode = $parameters->{branchcode};
71
    my $noingest   = $parameters->{noingest};
70
    my $noingest   = $parameters->{noingest};
71
    my $logger     = Koha::Logger->get( { interface => 'edi' } );
72
72
    if ( !$basketno || !$ean ) {
73
    if ( !$basketno || !$ean ) {
73
        carp 'create_edi_order called with no basketno or ean';
74
        $logger->error('create_edi_order called with no basketno or ean');
74
        return;
75
        return;
75
    }
76
    }
76
77
Lines 84-90 sub create_edi_order { Link Here
84
    )->all;
85
    )->all;
85
86
86
    if ( !@orderlines ) {
87
    if ( !@orderlines ) {
87
        carp "No orderlines for basket $basketno";
88
        $logger->warn("No orderlines for basket $basketno");
88
        return;
89
        return;
89
    }
90
    }
90
91
Lines 111-117 sub create_edi_order { Link Here
111
    }
112
    }
112
113
113
    unless ($ean_obj) {
114
    unless ($ean_obj) {
114
        carp "No matching EAN found for $ean";
115
        $logger->warn("No matching EAN found for $ean");
115
        return;
116
        return;
116
    }
117
    }
117
118
(-)a/t/db_dependent/Koha/EDI.t (-19 / +9 lines)
Lines 20-27 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
use FindBin qw( $Bin );
21
use FindBin qw( $Bin );
22
22
23
use Test::More tests => 3;
23
use Test::NoWarnings;
24
use Test::Warn;
24
use Test::More tests => 4;
25
use Test::MockModule;
25
use Test::MockModule;
26
26
27
use t::lib::Mocks;
27
use t::lib::Mocks;
Lines 817-823 subtest 'process_invoice' => sub { Link Here
817
};
817
};
818
818
819
subtest 'process_invoice_without_tax_rate' => sub {
819
subtest 'process_invoice_without_tax_rate' => sub {
820
    plan tests => 4;
820
    plan tests => 3;
821
821
822
    $schema->storage->txn_begin;
822
    $schema->storage->txn_begin;
823
823
Lines 873-895 subtest 'process_invoice_without_tax_rate' => sub { Link Here
873
873
874
    # Process the invoice - this should not generate warnings about undefined tax rates
874
    # Process the invoice - this should not generate warnings about undefined tax rates
875
    my $error;
875
    my $error;
876
    my $warnings = [];
876
    eval {
877
    {
877
        process_invoice($invoice_message);
878
        local $SIG{__WARN__} = sub { push @$warnings, $_[0] };
878
        1;
879
        eval {
879
    } or do {
880
            process_invoice($invoice_message);
880
        $error = $@;
881
            1;
881
    };
882
        } or do {
883
            $error = $@;
884
        };
885
    }
886
887
    ok( !$error, 'process_invoice completed without dying when no tax rate present' );
882
    ok( !$error, 'process_invoice completed without dying when no tax rate present' );
888
883
889
    # Check that no warnings about uninitialized values in multiplication were generated
890
    my $tax_warnings = grep { /Use of uninitialized value.*multiplication/ } @$warnings;
891
    is( $tax_warnings, 0, 'No warnings about uninitialized values in multiplication' );
892
893
    # Verify that orders with tax data exist (means processing completed)
884
    # Verify that orders with tax data exist (means processing completed)
894
    my $orders = $schema->resultset('Aqorder')->search(
885
    my $orders = $schema->resultset('Aqorder')->search(
895
        {
886
        {
896
- 

Return to bug 40387