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

(-)a/Koha/EDI.pm (-5 / +5 lines)
Lines 313-319 sub process_invoice { Link Here
313
                }
313
                }
314
            );
314
            );
315
            my $invoiceid = $new_invoice->invoiceid;
315
            my $invoiceid = $new_invoice->invoiceid;
316
            $logger->trace("Added as invoiceno :$invoiceid");
316
            $logger->trace("Added as invoiceno: $invoiceid");
317
            my $lines = $msg->lineitems();
317
            my $lines = $msg->lineitems();
318
318
319
            foreach my $line ( @{$lines} ) {
319
            foreach my $line ( @{$lines} ) {
Lines 482-488 sub receipt_items { Link Here
482
                }
482
                }
483
            );
483
            );
484
            $logger->warn(
484
            $logger->warn(
485
                "Cannot find aqorder item for $i :Order:$ordernumber");
485
                "Cannot find aqorder item for $i: Order: $ordernumber");
486
            next;
486
            next;
487
        }
487
        }
488
        my $b = $item->get_column('homebranch');
488
        my $b = $item->get_column('homebranch');
Lines 655-661 sub process_quote { Link Here
655
            } else {
655
            } else {
656
                $quote_message->basketno($basketno);
656
                $quote_message->basketno($basketno);
657
            }
657
            }
658
            $logger->trace("Created basket :$basketno");
658
            $logger->trace("Created basket: $basketno");
659
            my $items  = $msg->lineitems();
659
            my $items  = $msg->lineitems();
660
            my $refnum = $msg->message_refno;
660
            my $refnum = $msg->message_refno;
661
661
Lines 864-870 sub quote_item { Link Here
864
        $order_hash->{budget_id} = $budget->budget_id;
864
        $order_hash->{budget_id} = $budget->budget_id;
865
        my $first_order = $schema->resultset('Aqorder')->create($order_hash);
865
        my $first_order = $schema->resultset('Aqorder')->create($order_hash);
866
        my $o           = $first_order->ordernumber();
866
        my $o           = $first_order->ordernumber();
867
        $logger->trace("Order created :$o");
867
        $logger->trace("Order created: $o");
868
868
869
        # should be done by database settings
869
        # should be done by database settings
870
        $first_order->parent_ordernumber( $first_order->ordernumber() );
870
        $first_order->parent_ordernumber( $first_order->ordernumber() );
Lines 951-957 sub quote_item { Link Here
951
                my $new_order =
951
                my $new_order =
952
                  $schema->resultset('Aqorder')->create($order_hash);
952
                  $schema->resultset('Aqorder')->create($order_hash);
953
                my $o = $new_order->ordernumber();
953
                my $o = $new_order->ordernumber();
954
                $logger->trace("Order created :$o");
954
                $logger->trace("Order created: $o");
955
955
956
                # should be done by database settings
956
                # should be done by database settings
957
                $new_order->parent_ordernumber( $new_order->ordernumber() );
957
                $new_order->parent_ordernumber( $new_order->ordernumber() );
(-)a/t/db_dependent/Koha/EDI.t (-9 / +63 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
111
    #$logger->diag();
112
    $logger->trace_like(
113
        qr/Created basket:.*/,
114
        "Trace recorded adding basket"
115
    )->trace_like(
116
        qr/Checking db for matches.*/,
117
        "Trace recorded checking db for matches"
118
    )->trace_like(
119
        qr/New biblio added.*/,
120
        "Trace recoded adding new biblio"
121
    )->trace_like(
122
        qr/Order created:.*/,
123
        "Trace recorded adding order"
124
    )->trace_like(
125
        qr/Added item:.*/,
126
        "Trace recorded adding new item"
127
    )->trace_like(
128
        qr/Item added to rota.*/,
129
        "Trace recrded adding item to rota"
130
    )->debug_like(
131
        qr/.*specialUpdate biblioserver$/,
132
        "Trace recorded biblioserver index"
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
411
    #$logger->diag();
375
    $logger->trace_like(
412
    $logger->trace_like(
376
        qr/Adding invoice:.*/,
413
        qr/Adding invoice:.*/,
377
        "Trace recorded adding invoice"
414
        "Trace recorded adding invoice"
Lines 380-401 subtest 'process_invoice' => sub { Link Here
380
        "Trace recorded invoice added"
417
        "Trace recorded invoice added"
381
    )->error_is(
418
    )->error_is(
382
        'Skipping invoice line, no associated ordernumber',
419
        'Skipping invoice line, no associated ordernumber',
383
        "Received expected log line for missing ordernumber line"
420
        "Error recorded for missing ordernumber line"
384
    )->error_like(
421
    )->error_like(
385
        qr/Skipping invoice line, no order found for.*/,
422
        qr/Skipping invoice line, no order found for.*/,
386
        'Received expected log line for unmatched ordernumber line'
423
        'Error recorded for unmatched ordernumber line'
387
    )->error_like(
424
    )->error_like(
388
        qr/Skipping invoice line, no bibliographic.*/,
425
        qr/Skipping invoice line, no bibliographic.*/,
389
        'Received expected log line for unmatched biblionumber line'
426
        'Error recorded for unmatched biblionumber line'
390
    )->trace_like(
427
    )->trace_like(
391
        qr/Receipting order:.*/,
428
        qr/Receipting order:.*/,
392
        'Trace recorded invoice receipted'
429
        'Trace recorded invoice receipted'
393
    )->trace_like(
430
    )->trace_like(
394
        qr/Updating bib:.*/,
431
        qr/Updating bib:.*/,
395
        'Trace recorded bib updated'
432
        'Trace recorded bib updated'
433
    )->trace_like(
434
        qr/Receipting order:.*/,
435
        'Trace recorded invoice receipted - Check why this happens a second time'
436
    )->trace_like(
437
        qr/Updating bib:.*/,
438
        'Trace recorded bib updated - same bib, different id'
396
    )->error_like(
439
    )->error_like(
397
        qr/Cannot find vendor with ean.*/,
440
        qr/Cannot find vendor with ean.*/,
398
        'Received expected log line for missing ean'
441
        'Error recorded for missing ean'
442
    )->warn_like(
443
        qr/transferring.*/,
444
        'Warn recorded for transferring items'
445
    )->warn_like(
446
        qr/Unmatched item at branch:.*/,
447
        'Warn recorded for unmatched item'
448
    )->warn_like(
449
        qr/transferring.*/,
450
        'Warn recorded for transferring items'
451
    )->warn_like(
452
        qr/Unmatched item at branch:.*/,
453
        'Warn recorded for unmatched item'
399
    )->clear();
454
    )->clear();
400
455
401
    my $invoice3 = Koha::Acquisition::Invoices->search( { invoicenumber => 'INV00003' }, { rows => 1 } )->single;
456
    my $invoice3 = Koha::Acquisition::Invoices->search( { invoicenumber => 'INV00003' }, { rows => 1 } )->single;
402
- 

Return to bug 38689