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

(-)a/Koha/EDI.pm (-5 / +5 lines)
Lines 308-314 sub process_invoice { Link Here
308
                }
308
                }
309
            );
309
            );
310
            my $invoiceid = $new_invoice->invoiceid;
310
            my $invoiceid = $new_invoice->invoiceid;
311
            $logger->trace("Added as invoiceno :$invoiceid");
311
            $logger->trace("Added as invoiceno: $invoiceid");
312
            my $lines = $msg->lineitems();
312
            my $lines = $msg->lineitems();
313
313
314
            foreach my $line ( @{$lines} ) {
314
            foreach my $line ( @{$lines} ) {
Lines 477-483 sub receipt_items { Link Here
477
                }
477
                }
478
            );
478
            );
479
            $logger->warn(
479
            $logger->warn(
480
                "Cannot find aqorder item for $i :Order:$ordernumber");
480
                "Cannot find aqorder item for $i: Order: $ordernumber");
481
            next;
481
            next;
482
        }
482
        }
483
        my $b = $item->get_column('homebranch');
483
        my $b = $item->get_column('homebranch');
Lines 650-656 sub process_quote { Link Here
650
            } else {
650
            } else {
651
                $quote_message->basketno($basketno);
651
                $quote_message->basketno($basketno);
652
            }
652
            }
653
            $logger->trace("Created basket :$basketno");
653
            $logger->trace("Created basket: $basketno");
654
            my $items  = $msg->lineitems();
654
            my $items  = $msg->lineitems();
655
            my $refnum = $msg->message_refno;
655
            my $refnum = $msg->message_refno;
656
656
Lines 859-865 sub quote_item { Link Here
859
        $order_hash->{budget_id} = $budget->budget_id;
859
        $order_hash->{budget_id} = $budget->budget_id;
860
        my $first_order = $schema->resultset('Aqorder')->create($order_hash);
860
        my $first_order = $schema->resultset('Aqorder')->create($order_hash);
861
        my $o           = $first_order->ordernumber();
861
        my $o           = $first_order->ordernumber();
862
        $logger->trace("Order created :$o");
862
        $logger->trace("Order created: $o");
863
863
864
        # should be done by database settings
864
        # should be done by database settings
865
        $first_order->parent_ordernumber( $first_order->ordernumber() );
865
        $first_order->parent_ordernumber( $first_order->ordernumber() );
Lines 946-952 sub quote_item { Link Here
946
                my $new_order =
946
                my $new_order =
947
                  $schema->resultset('Aqorder')->create($order_hash);
947
                  $schema->resultset('Aqorder')->create($order_hash);
948
                my $o = $new_order->ordernumber();
948
                my $o = $new_order->ordernumber();
949
                $logger->trace("Order created :$o");
949
                $logger->trace("Order created: $o");
950
950
951
                # should be done by database settings
951
                # should be done by database settings
952
                $new_order->parent_ordernumber( $new_order->ordernumber() );
952
                $new_order->parent_ordernumber( $new_order->ordernumber() );
(-)a/t/db_dependent/Koha/EDI.t (-9 / +62 lines)
Lines 36-42 my $builder = t::lib::TestBuilder->new; Link Here
36
my $logger  = t::lib::Mocks::Logger->new();
36
my $logger  = t::lib::Mocks::Logger->new();
37
37
38
subtest 'process_quote' => sub {
38
subtest 'process_quote' => sub {
39
    plan tests => 7;
39
    plan tests => 16;
40
40
41
    $schema->storage->txn_begin;
41
    $schema->storage->txn_begin;
42
42
Lines 93-103 subtest 'process_quote' => sub { Link Here
93
        }
93
        }
94
    );
94
    );
95
95
96
    t::lib::Mocks::mock_preference( 'CataloguingLog', 0 );
97
96
    # Process the test quote file
98
    # Process the test quote file
97
    process_quote($quote);
99
    my $error;
100
    eval {
101
        process_quote($quote);
102
        1;
103
    } or do {
104
        $error = $@;
105
    };
106
    ok( !$error, 'process_quote completed without dying' );
98
107
99
    # Test for expected warnings for the passed quote file
108
    # Test for expected warnings for the passed quote file
100
    #
109
    is( $logger->count, 8, "8 log lines recorded for passed quote file" );
110
    #$logger->diag();
111
    $logger->trace_like(
112
        qr/Created basket:.*/,
113
        "Trace recorded adding basket"
114
    )->trace_like(
115
        qr/Checking db for matches.*/,
116
        "Trace recorded checking db for matches"
117
    )->trace_like(
118
        qr/New biblio added.*/,
119
        "Trace recoded adding new biblio"
120
    )->trace_like(
121
        qr/Order created:.*/,
122
        "Trace recorded adding order"
123
    )->trace_like(
124
        qr/Added item:.*/,
125
        "Trace recorded adding new item"
126
    )->trace_like(
127
        qr/Item added to rota.*/,
128
        "Trace recrded adding item to rota"
129
    )->debug_like(
130
        qr/.*specialUpdate biblioserver$/,
131
        "Trace recorded biblioserver index"
132
    )
133
    ->clear();
134
101
    # Test for quote status change
135
    # Test for quote status change
102
    $quote->get_from_storage;
136
    $quote->get_from_storage;
103
    is( $quote->status, 'received', 'Quote status was set to received' );
137
    is( $quote->status, 'received', 'Quote status was set to received' );
Lines 294-300 subtest '_handle_008_field' => sub { Link Here
294
};
328
};
295
329
296
subtest 'process_invoice' => sub {
330
subtest 'process_invoice' => sub {
297
    plan tests => 12;
331
    plan tests => 19;
298
332
299
    $schema->storage->txn_begin;
333
    $schema->storage->txn_begin;
300
334
Lines 372-377 subtest 'process_invoice' => sub { Link Here
372
    };
406
    };
373
    ok( !$error, 'process_invoice completed without dying' );
407
    ok( !$error, 'process_invoice completed without dying' );
374
408
409
    is( $logger->count, 14, "14 log lines recorded for passed invoice file" );
410
    #$logger->diag();
375
    $logger->trace_like(
411
    $logger->trace_like(
376
        qr/Adding invoice:.*/,
412
        qr/Adding invoice:.*/,
377
        "Trace recorded adding invoice"
413
        "Trace recorded adding invoice"
Lines 380-401 subtest 'process_invoice' => sub { Link Here
380
        "Trace recorded invoice added"
416
        "Trace recorded invoice added"
381
    )->error_is(
417
    )->error_is(
382
        'Skipping invoice line, no associated ordernumber',
418
        'Skipping invoice line, no associated ordernumber',
383
        "Received expected log line for missing ordernumber line"
419
        "Error recorded for missing ordernumber line"
384
    )->error_like(
420
    )->error_like(
385
        qr/Skipping invoice line, no order found for.*/,
421
        qr/Skipping invoice line, no order found for.*/,
386
        'Received expected log line for unmatched ordernumber line'
422
        'Error recorded for unmatched ordernumber line'
387
    )->error_like(
423
    )->error_like(
388
        qr/Skipping invoice line, no bibliographic.*/,
424
        qr/Skipping invoice line, no bibliographic.*/,
389
        'Received expected log line for unmatched biblionumber line'
425
        'Error recorded for unmatched biblionumber line'
390
    )->trace_like(
426
    )->trace_like(
391
        qr/Receipting order:.*/,
427
        qr/Receipting order:.*/,
392
        'Trace recorded invoice receipted'
428
        'Trace recorded invoice receipted'
393
    )->trace_like(
429
    )->trace_like(
394
        qr/Updating bib:.*/,
430
        qr/Updating bib:.*/,
395
        'Trace recorded bib updated'
431
        'Trace recorded bib updated'
432
    )->trace_like(
433
        qr/Receipting order:.*/,
434
        'Trace recorded invoice receipted - Check why this happens a second time'
435
    )->trace_like(
436
        qr/Updating bib:.*/,
437
        'Trace recorded bib updated - same bib, different id'
396
    )->error_like(
438
    )->error_like(
397
        qr/Cannot find vendor with ean.*/,
439
        qr/Cannot find vendor with ean.*/,
398
        'Received expected log line for missing ean'
440
        'Error recorded for missing ean'
441
    )->warn_like(
442
        qr/transferring.*/,
443
        'Warn recorded for transfering items'
444
    )->warn_like(
445
        qr/Unmatched item at branch:.*/,
446
        'Warn recorded for unmatched item'
447
    )->warn_like(
448
        qr/transferring.*/,
449
        'Warn recorded for transfering items'
450
    )->warn_like(
451
        qr/Unmatched item at branch:.*/,
452
        'Warn recorded for unmatched item'
399
    )->clear();
453
    )->clear();
400
454
401
    my $invoice3 = Koha::Acquisition::Invoices->search( { invoicenumber => 'INV00003' }, { rows => 1 } )->single;
455
    my $invoice3 = Koha::Acquisition::Invoices->search( { invoicenumber => 'INV00003' }, { rows => 1 } )->single;
402
- 

Return to bug 38689