Lines 338-343
sub name_and_address {
Link Here
|
338 |
sub order_line { |
338 |
sub order_line { |
339 |
my ( $self, $linenumber, $orderline ) = @_; |
339 |
my ( $self, $linenumber, $orderline ) = @_; |
340 |
|
340 |
|
|
|
341 |
my $basket = Koha::Acquisition::Order->find( $orderline->ordernumber )->basket; |
342 |
|
341 |
my $schema = $self->{schema}; |
343 |
my $schema = $self->{schema}; |
342 |
if ( !$orderline->biblionumber ) |
344 |
if ( !$orderline->biblionumber ) |
343 |
{ # cannot generate an orderline without a bib record |
345 |
{ # cannot generate an orderline without a bib record |
Lines 374-380
sub order_line {
Link Here
|
374 |
# we dont currently support this in koha |
376 |
# we dont currently support this in koha |
375 |
# GIR copy-related data |
377 |
# GIR copy-related data |
376 |
my @items; |
378 |
my @items; |
377 |
if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) { |
379 |
if ( $basket->effective_create_items eq 'ordering' ) { |
378 |
my @linked_itemnumbers = $orderline->aqorders_items; |
380 |
my @linked_itemnumbers = $orderline->aqorders_items; |
379 |
|
381 |
|
380 |
foreach my $item (@linked_itemnumbers) { |
382 |
foreach my $item (@linked_itemnumbers) { |
Lines 402-408
sub order_line {
Link Here
|
402 |
if ( $orderline->order_vendornote ) { |
404 |
if ( $orderline->order_vendornote ) { |
403 |
$ol_fields->{servicing_instruction} = $orderline->order_vendornote; |
405 |
$ol_fields->{servicing_instruction} = $orderline->order_vendornote; |
404 |
} |
406 |
} |
405 |
$self->add_seg( gir_segments( $ol_fields, @items ) ); |
407 |
$self->add_seg( |
|
|
408 |
gir_segments( |
409 |
{ |
410 |
basket => $basket, |
411 |
ol_fields => $ol_fields, |
412 |
items => \@items |
413 |
} |
414 |
) |
415 |
); |
406 |
|
416 |
|
407 |
# TBD what if #items exceeds quantity |
417 |
# TBD what if #items exceeds quantity |
408 |
|
418 |
|
Lines 507-513
sub imd_segment {
Link Here
|
507 |
} |
517 |
} |
508 |
|
518 |
|
509 |
sub gir_segments { |
519 |
sub gir_segments { |
510 |
my ( $orderfields, @onorderitems ) = @_; |
520 |
my ($params) = @_; |
|
|
521 |
|
522 |
my $basket = $params->{basket}; |
523 |
my $orderfields = $params->{ol_fields}; |
524 |
my @onorderitems = @{ $params->{items} }; |
511 |
|
525 |
|
512 |
my $budget_code = $orderfields->{budget_code}; |
526 |
my $budget_code = $orderfields->{budget_code}; |
513 |
my @segments; |
527 |
my @segments; |
Lines 515-521
sub gir_segments {
Link Here
|
515 |
foreach my $item (@onorderitems) { |
529 |
foreach my $item (@onorderitems) { |
516 |
my $seg = sprintf 'GIR+%03d', $sequence_no; |
530 |
my $seg = sprintf 'GIR+%03d', $sequence_no; |
517 |
$seg .= add_gir_identity_number( 'LFN', $budget_code ); |
531 |
$seg .= add_gir_identity_number( 'LFN', $budget_code ); |
518 |
if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) { |
532 |
if ( $basket->effective_create_items eq 'ordering' ) { |
519 |
$seg .= |
533 |
$seg .= |
520 |
add_gir_identity_number( 'LLO', $item->homebranch->branchcode ); |
534 |
add_gir_identity_number( 'LLO', $item->homebranch->branchcode ); |
521 |
$seg .= add_gir_identity_number( 'LST', $item->itype ); |
535 |
$seg .= add_gir_identity_number( 'LST', $item->itype ); |
522 |
- |
|
|