|
Lines 32-38
my $schema = Koha::Database->new->schema;
Link Here
|
| 32 |
my $builder = t::lib::TestBuilder->new; |
32 |
my $builder = t::lib::TestBuilder->new; |
| 33 |
|
33 |
|
| 34 |
subtest 'beggining_of_message tests' => sub { |
34 |
subtest 'beggining_of_message tests' => sub { |
| 35 |
plan tests => 3; |
35 |
plan tests => 5; |
| 36 |
|
36 |
|
| 37 |
$schema->storage->txn_begin; |
37 |
$schema->storage->txn_begin; |
| 38 |
|
38 |
|
|
Lines 63-68
subtest 'beggining_of_message tests' => sub {
Link Here
|
| 63 |
"When purchase order number provided, it's used in BGM segment instead of basketno" |
63 |
"When purchase order number provided, it's used in BGM segment instead of basketno" |
| 64 |
); |
64 |
); |
| 65 |
|
65 |
|
|
|
66 |
# Bug 42010: EDIFACT special characters in purchase order number must be escaped |
| 67 |
my $po_with_apostrophe = "Children's Requests 24/02/26 CB"; |
| 68 |
$bgm = Koha::Edifact::Order::beginning_of_message( $basketno, $dbic_edi_vendor->standard, 1, $po_with_apostrophe ); |
| 69 |
is( |
| 70 |
$bgm, "BGM+22V+Children?'s Requests 24/02/26 CB+9'", |
| 71 |
"Apostrophe in purchase order number is escaped with release character in BGM segment" |
| 72 |
); |
| 73 |
|
| 74 |
my $po_with_special_chars = "PO?+:' test"; |
| 75 |
$bgm = |
| 76 |
Koha::Edifact::Order::beginning_of_message( $basketno, $dbic_edi_vendor->standard, 1, $po_with_special_chars ); |
| 77 |
is( |
| 78 |
$bgm, "BGM+22V+PO???+?:?' test+9'", |
| 79 |
"All EDIFACT special characters in purchase order number are escaped in BGM segment" |
| 80 |
); |
| 81 |
|
| 66 |
$schema->storage->txn_rollback; |
82 |
$schema->storage->txn_rollback; |
| 67 |
}; |
83 |
}; |
| 68 |
|
84 |
|
|
Lines 299-305
subtest 'filename() tests' => sub {
Link Here
|
| 299 |
}; |
315 |
}; |
| 300 |
|
316 |
|
| 301 |
subtest 'RFF+ON purchase order number generation' => sub { |
317 |
subtest 'RFF+ON purchase order number generation' => sub { |
| 302 |
plan tests => 3; |
318 |
plan tests => 4; |
| 303 |
|
319 |
|
| 304 |
$schema->storage->txn_begin; |
320 |
$schema->storage->txn_begin; |
| 305 |
|
321 |
|
|
Lines 431-436
subtest 'RFF+ON purchase order number generation' => sub {
Link Here
|
| 431 |
'Purchase order number included in BGM segment when purchase order number present' |
447 |
'Purchase order number included in BGM segment when purchase order number present' |
| 432 |
); |
448 |
); |
| 433 |
|
449 |
|
|
|
450 |
# Bug 42010: basket name with apostrophe must be escaped in BGM segment |
| 451 |
my $basket_apostrophe = $builder->build( |
| 452 |
{ |
| 453 |
source => 'Aqbasket', |
| 454 |
value => { |
| 455 |
basketname => "Children's Requests 24/02/26 CB", |
| 456 |
booksellerid => $vendor_po->{vendor_id}, |
| 457 |
} |
| 458 |
} |
| 459 |
); |
| 460 |
my $order_apostrophe = $builder->build( |
| 461 |
{ |
| 462 |
source => 'Aqorder', |
| 463 |
value => { |
| 464 |
basketno => $basket_apostrophe->{basketno}, |
| 465 |
biblionumber => $biblio_po->biblionumber, |
| 466 |
orderstatus => 'new', |
| 467 |
quantity => 1, |
| 468 |
listprice => '10.00', |
| 469 |
} |
| 470 |
} |
| 471 |
); |
| 472 |
my @orderlines_apostrophe = |
| 473 |
$schema->resultset('Aqorder')->search( { basketno => $basket_apostrophe->{basketno} } ); |
| 474 |
my $order_obj_apostrophe = Koha::Edifact::Order->new( |
| 475 |
{ |
| 476 |
orderlines => \@orderlines_apostrophe, |
| 477 |
vendor => $dbic_vendor_po, |
| 478 |
ean => $dbic_ean, |
| 479 |
} |
| 480 |
); |
| 481 |
my $transmission_apostrophe = $order_obj_apostrophe->encode(); |
| 482 |
like( |
| 483 |
$transmission_apostrophe, qr/BGM\+220\+Children\?'s Requests 24\/02\/26 CB\+9'/, |
| 484 |
'Apostrophe in basket name is escaped with release character in BGM segment (Bug 42010)' |
| 485 |
); |
| 486 |
|
| 434 |
$schema->storage->txn_rollback; |
487 |
$schema->storage->txn_rollback; |
| 435 |
}; |
488 |
}; |
| 436 |
|
489 |
|
| 437 |
- |
|
|