@@ -, +, @@ --- Koha/Acquisition/Basket.pm | 24 +++++++++++++++++++ acqui/basket.pl | 4 ++++ .../prog/en/modules/acqui/basket.tt | 14 +++++++++++ 3 files changed, 42 insertions(+) --- a/Koha/Acquisition/Basket.pm +++ a/Koha/Acquisition/Basket.pm @@ -96,6 +96,30 @@ sub orders { return Koha::Acquisition::Orders->_new_from_dbic( $orders_rs ); } +=head3 edi_order + + my $edi_order = $basket->edi_order; + +Returns the most recently attached EDI order object if one exists for the basket. + +NOTE: This currently returns a bare DBIx::Class result or undefined. This is consistent with the rest of EDI; +However it would be beneficial to convert these to full fledge Koha::Objects in the future. + +=cut + +sub edi_order { + my ($self) = @_; + + my $order_rs = $self->_result->edifact_messages( + { + message_type => 'ORDERS', + deleted => 0 + }, + { order_by => { '-desc' => 'transfer_date' }, rows => 1 } + ); + return $order_rs->single; +} + =head3 effective_create_items Returns C for this basket, falling back to C if unset. --- a/acqui/basket.pl +++ a/acqui/basket.pl @@ -380,6 +380,9 @@ if ( $op eq 'list' ) { last; } + my $basket_obj = Koha::Acquisition::Baskets->find($basketno); + my $edi_order = $basket_obj->edi_order; + $template->param( basketno => $basketno, basket => $basket, @@ -391,6 +394,7 @@ if ( $op eq 'list' ) { basketcontractname => $contract->{contractname}, branches_loop => \@branches_loop, creationdate => $basket->{creationdate}, + edi_order => $edi_order, authorisedby => $basket->{authorisedby}, authorisedbyname => $basket->{authorisedbyname}, users_ids => join(':', @basketusers_ids), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -314,6 +314,20 @@ [% IF ( closedate ) %]
  • Closed on: [% closedate | $KohaDates %]
  • [% END %] + [% IF ( ediaccount ) %] + [%- BLOCK edi_status -%] + [%- SWITCH edi_order.status -%] + [%- CASE 'Pending' -%]Pending + [%- CASE 'Sent' -%]Sent + [%- CASE 'Processed' -%]Processed + [%- END -%] + [%- END -%] + [% IF ( edi_order ) %] +
  • EDI status: [%- PROCESS edi_status edi_order=edi_order -%] ([% edi_order.transfer_date | $KohaDates %])
  • + [% ELSE %] +
  • EDI status: Not ordered
  • + [% END %] + [% END %] [% IF ( estimateddeliverydate ) %]
  • Estimated delivery date: [% estimateddeliverydate | $KohaDates %]
  • [% END %] --