From d2c2e7740fb5fc52e44c6363a217ce6c0f6bda47 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 16 Dec 2019 18:35:08 +0100 Subject: [PATCH] Bug 24161: Keep tracks of late orders claims So far we only record the number of claims and the date of the last claim, in the aqorders table. To keep track of the different claim dates, this patchset is going to make the following DB changes: * Create a new table 'aqorders_claims' (id, ordernumber, claimed_on) * Remove the two columns from the aqorders table: claims_count and claimed_date This will allow to display the different claim dates where needed: on the late orders page, and the basket page. To avoid additional fetches of Koha::Acquisition::Orders, GetLateOrders has been moved to Koha::Acquisition::Orders->filter_by_late That way we are going to add consistency, robustness, and cover the feature with new tests. Test plan: 0/ Create a bunch of new orders. Make sure they are from different vendor (with different delivery time). 1/ Go to the late orders page and claim some orders 2/ Reclaim some of those orders 3/ Confirm that you can see the different claim dates for a given orders (the history of the late orders claims is kept and displayed) 4/ Bonus point: Regression tests: a. Modify the closedate of the basket in the database. That will allow you to make sure the patch set did not introduce regressions. It would be good to test the different filters on the late orders page: * delay * Estimated delivery date from/to * Vendor b. Confirm that the subtotal and the total values from the late orders page is correct. c. Test the update database entry: do not apply these patches, claims some orders against master. Apply the patch, execute the update DB entry then confirm that the number of claims is correct (note that the dates will not as it is not possible to guess them). QA note: the branchcode parameter has been removed from filter_by_late. At first glance it seems that it was not used. Sponsored-by: Cork Institute of Technology Signed-off-by: Angela O'Connor Desmond Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- C4/Acquisition.pm | 2 - Koha/Acquisition/Basket.pm | 51 ++++++++++ Koha/Acquisition/Order.pm | 57 +++++++++++ Koha/Acquisition/Order/Claim.pm | 2 + Koha/Acquisition/Order/Claims.pm | 6 +- Koha/Acquisition/Orders.pm | 99 +++++++++++++++++++ acqui/basket.pl | 1 + acqui/lateorders-export.pl | 6 +- acqui/lateorders.pl | 38 ++++--- .../prog/en/modules/acqui/basket.tt | 6 ++ .../prog/en/modules/acqui/csv/lateorders.tt | 4 +- .../prog/en/modules/acqui/lateorders.tt | 70 ++++++------- .../prog/en/modules/acqui/showorder.tt | 4 +- t/db_dependent/Acquisition.t | 23 +++-- 14 files changed, 293 insertions(+), 76 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index da0a9b4d78..e9f288d5fd 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1222,8 +1222,6 @@ sub GetOrder { biblioitems.publishercode, aqorders.rrp AS unitpricesupplier, aqorders.ecost AS unitpricelib, - aqorders.claims_count AS claims_count, - aqorders.claimed_date AS claimed_date, aqbudgets.budget_name AS budget, aqbooksellers.name AS supplier, aqbooksellers.id AS supplierid, diff --git a/Koha/Acquisition/Basket.pm b/Koha/Acquisition/Basket.pm index 39b28996e8..1aad128a7e 100644 --- a/Koha/Acquisition/Basket.pm +++ b/Koha/Acquisition/Basket.pm @@ -20,6 +20,7 @@ package Koha::Acquisition::Basket; use Modern::Perl; use Koha::Database; +use Koha::DateUtils qw( dt_from_string ); use Koha::Acquisition::BasketGroups; use Koha::Patrons; @@ -88,6 +89,56 @@ sub effective_create_items { return $self->create_items || C4::Context->preference('AcqCreateItem'); } +=head3 estimated_delivery_date + +my $estimated_delivery_date = $basket->estimated_delivery_date; + +Return the estimated delivery date for this basket. + +It is calculated adding the delivery time of the vendor to the close date of this basket. + +Return implicit undef if the basket is not closed, or the vendor does not have a delivery time. + +=cut + +sub estimated_delivery_date { + my ( $self ) = @_; + return unless $self->closedate and $self->bookseller->deliverytime; + return dt_from_string($self->closedate)->add( days => $self->bookseller->deliverytime); +} + +=head3 late_since_days + +my $number_of_days_late = $basket->late_since_days; + +Return the number of days the basket is late. + +Return implicit undef if the basket is not closed. + +=cut + +sub late_since_days { + my ( $self ) = @_; + return unless $self->closedate; + return dt_from_string->delta_days(dt_from_string($self->closedate))->delta_days(); +} + +=head3 authorizer + +my $authorizer = $basket->authorizer; + +Returns the patron who authorized/created this basket. + +=cut + +sub authorizer { + my ($self) = @_; + # FIXME We should use a DBIC rs, but the FK is missing + return unless $self->authorisedby; + return scalar Koha::Patrons->find($self->authorisedby); +} + + =head3 to_api my $json = $basket->to_api; diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm index 5135a3372d..2747a78fc5 100644 --- a/Koha/Acquisition/Order.pm +++ b/Koha/Acquisition/Order.pm @@ -22,6 +22,7 @@ use Carp qw( croak ); use Koha::Acquisition::Baskets; use Koha::Acquisition::Funds; use Koha::Acquisition::Invoices; +use Koha::Acquisition::Order::Claims; use Koha::Database; use Koha::DateUtils qw( dt_from_string output_pref ); use Koha::Biblios; @@ -239,6 +240,62 @@ sub biblio { return Koha::Biblio->_new_from_dbic( $biblio_rs ); } +=head3 claims + + my $claims = $order->claims + +Return the claims history for this order + +=cut + +sub claims { + my ( $self ) = @_; + my $claims_rs = $self->_result->aqorders_claims; + return Koha::Acquisition::Order::Claims->_new_from_dbic( $claims_rs ); +} + +=head3 claim + + my $claim = $order->claim + +Do claim for this order + +=cut + +sub claim { + my ( $self ) = @_; + my $claim_rs = $self->_result->create_related('aqorders_claims', {}); + return Koha::Acquisition::Order::Claim->_new_from_dbic($claim_rs); +} + +=head3 claims_count + +my $nb_of_claims = $order->claims_count; + +This is the equivalent of $order->claims->count. Keeping it for retrocompatibilty. + +=cut + +sub claims_count { + my ( $self ) = @_; + return $self->claims->count; +} + +=head3 claimed_date + +my $last_claim_date = $order->claimed_date; + +This is the equivalent of $order->claims->last->claimed_on. Keeping it for retrocompatibilty. + +=cut + +sub claimed_date { + my ( $self ) = @_; + my $last_claim = $self->claims->last; + return unless $last_claim; + return $last_claim->claimed_on; +} + =head3 duplicate_to my $duplicated_order = $order->duplicate_to($basket, [$default_values]); diff --git a/Koha/Acquisition/Order/Claim.pm b/Koha/Acquisition/Order/Claim.pm index 1fb7bc113b..a2ce117483 100644 --- a/Koha/Acquisition/Order/Claim.pm +++ b/Koha/Acquisition/Order/Claim.pm @@ -31,6 +31,8 @@ Koha::Acquisition::Order::Claim - Koha Claim Object class =head2 Class methods +=cut + =head2 Internal methods =head3 _type diff --git a/Koha/Acquisition/Order/Claims.pm b/Koha/Acquisition/Order/Claims.pm index 5423dbabb0..7856f26046 100644 --- a/Koha/Acquisition/Order/Claims.pm +++ b/Koha/Acquisition/Order/Claims.pm @@ -35,7 +35,7 @@ Koha::Cities - Koha Claim Object set class =cut -=head3 type +=head3 _type =cut @@ -43,6 +43,10 @@ sub _type { return 'AqordersClaim'; } +=head3 object_class + +=cut + sub object_class { return 'Koha::Acquisition::Order::Claim'; } diff --git a/Koha/Acquisition/Orders.pm b/Koha/Acquisition/Orders.pm index 19fa24c01a..e504c581c2 100644 --- a/Koha/Acquisition/Orders.pm +++ b/Koha/Acquisition/Orders.pm @@ -21,6 +21,7 @@ use Carp; use Koha::Database; +use Koha::DateUtils qw( dt_from_string ); use Koha::Acquisition::Order; use base qw(Koha::Objects); @@ -31,6 +32,104 @@ Koha::Acquisition::Orders object set class =head1 API +=head2 Class Methods + +=head3 filter_by_lates + +my $late_orders = $orders->filter_by_lates($params); + +Filter an order set given different parameters. + +This is the équivalent method of the former GetLateOrders C4 subroutine + +$params can be: + +=over + +=item C the number of days the basket has been closed + +=item C the bookseller id + +=item C Beginning of the estimated delivery date + +=item C End of the estimated delivery date + +=back + +=cut + +sub filter_by_lates { + my ( $self, $params ) = @_; + my $delay = $params->{delay}; + my $bookseller_id = $params->{bookseller_id}; + # my $branchcode = $params->{branchcode}; # FIXME do we really need this + my $estimated_from = $params->{estimated_from}; + my $estimated_to = $params->{estimated_to}; + my $dtf = Koha::Database->new->schema->storage->datetime_parser; + + my @delivery_time_conditions; + my $date_add = "DATE_ADD(basketno.closedate, INTERVAL COALESCE(booksellerid.deliverytime, booksellerid.deliverytime, 0) day)"; + if ( defined $estimated_from or defined $estimated_to ) { + push @delivery_time_conditions, \[ "$date_add IS NOT NULL" ]; + } + if ( defined $estimated_from ) { + push @delivery_time_conditions, \[ "$date_add >= ?", $dtf->format_date($estimated_from) ]; + } + if ( defined $estimated_to ) { + push @delivery_time_conditions, \[ "$date_add <= ?", $dtf->format_date($estimated_to) ]; + } + if ( defined $estimated_from and not defined $estimated_to ) { + push @delivery_time_conditions, \[ "$date_add <= ?", $dtf->format_date(dt_from_string) ]; + } + + $self->search( + { + -or => [ + { datereceived => undef }, + quantityreceived => { '<' => \'quantity' } + ], + 'basketno.closedate' => [ + -and => + { '!=' => undef }, + { + defined $delay + ? ( + '<=' => $dtf->format_date( + dt_from_string->subtract( days => $delay ) + ) + ) + : () + } + ], + 'datecancellationprinted' => undef, + ( + $bookseller_id + ? ( 'basketno.booksellerid' => $bookseller_id ) + : () + ), + + # ( $branchcode ? ('borrower.branchcode')) # FIXME branch is not a filter we may not need to implement this + + ( @delivery_time_conditions ? ( -and => \@delivery_time_conditions ) : ()), + ( + C4::Context->preference('IndependentBranches') + && !C4::Context->IsSuperLibrarian + ? ( 'borrower.branchcode' => C4::Context->userenv->{branch} ) + : () + ), + + ( orderstatus => { '!=' => 'cancelled' } ), + + }, + { + '+select' => [\"DATE_ADD(basketno.closedate, INTERVAL COALESCE(booksellerid.deliverytime, booksellerid.deliverytime, 0) day)"], + '+as' => ['estimated_delivery_date'], + join => { 'basketno' => 'booksellerid' }, + prefetch => {'basketno' => 'booksellerid'}, + } + ); +} + =head2 Internal methods =head3 _type (internal) diff --git a/acqui/basket.pl b/acqui/basket.pl index 459f2956bb..92f3614676 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -498,6 +498,7 @@ sub get_order_infos { $line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); $line{holds} = $holds_count; $line{holds_on_order} = $itemholds?$itemholds:$holds_count if $line{left_holds_on_order}; + $line{order_object} = $order; } diff --git a/acqui/lateorders-export.pl b/acqui/lateorders-export.pl index cefe613be0..eb04ba7635 100755 --- a/acqui/lateorders-export.pl +++ b/acqui/lateorders-export.pl @@ -36,6 +36,8 @@ my @ordernumbers = $input->multi_param('ordernumber'); my @orders; for my $ordernumber ( @ordernumbers ) { my $order = GetOrder $ordernumber; + my $order_object = Koha::Acquisition::Orders->find($ordernumber); + my $claims = $order_object->claims; push @orders, { orderdate => $order->{orderdate}, latesince => $order->{latesince}, @@ -51,8 +53,8 @@ for my $ordernumber ( @ordernumbers ) { budget => $order->{budget}, basketname => $order->{basketname}, basketno => $order->{basketno}, - claims_count => $order->{claims_count}, - claimed_date => $order->{claimed_date}, + claims_count => $claims->count, + claimed_date => $claims->count ? $claims->last->claimed_on : undef, internalnote => $order->{order_internalnote}, vendornote => $order->{order_vendornote}, isbn => $order->{isbn}, diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl index 5dc9ea6e33..1367e175a3 100755 --- a/acqui/lateorders.pl +++ b/acqui/lateorders.pl @@ -108,7 +108,7 @@ if ($op and $op eq "send_alert"){ eval { $err = SendAlerts( 'claimacquisition', \@ordernums, $input->param("letter_code") ); if ( not ref $err or not exists $err->{error} ) { - AddClaim ( $_ ) for @ordernums; + Koha::Acquisition::Orders->find($_)->claim() for @ordernums; } }; @@ -145,34 +145,32 @@ $template->param(SUPPLIER_LOOP => \@sloopy); $template->param(Supplier=>$supplierlist{$booksellerid}) if ($booksellerid); $template->param(booksellerid=>$booksellerid) if ($booksellerid); -@parameters = - ( $delay, $booksellerid, $branch ); -if ($estimateddeliverydatefrom_dt) { - push @parameters, $estimateddeliverydatefrom_dt->ymd(); -} -else { - push @parameters, undef; -} -if ($estimateddeliverydateto_dt) { - push @parameters, $estimateddeliverydateto_dt->ymd(); -} -my @lateorders = GetLateOrders( @parameters ); - -my $total; -foreach (@lateorders){ - $total += $_->{subtotal}; -} +my $lateorders = Koha::Acquisition::Orders->filter_by_lates( + { + delay => $delay, + booksellerid => $booksellerid, + ( + $estimateddeliverydatefrom_dt + ? ( estimated_from => $estimateddeliverydatefrom_dt ) + : () + ), + ( + $estimateddeliverydateto_dt + ? ( estimated_to => $estimateddeliverydateto_dt ) + : () + ) + } +); my $letters = GetLetters({ module => "claimacquisition" }); $template->param(ERROR_LOOP => \@errors) if (@errors); $template->param( - lateorders => \@lateorders, + lateorders => $lateorders, delay => $delay, letters => $letters, estimateddeliverydatefrom => $estimateddeliverydatefrom, estimateddeliverydateto => $estimateddeliverydateto, - total => $total, intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index 867367307a..fedd90c118 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -524,6 +524,12 @@

[% END %] + [% SET claims = books_loo.order_object.claims %] + [% IF claims.count %] +

+ This order has been claimed [% claims.count | html %] times. On [% FOR c IN claims %][% c.claimed_on | $KohaDates %][% UNLESS loop.last %], [% END %][% END %] +

+ [% END %] [% SET zero_regex = "^0{1,}\.?0{1,}[^1-9]" %] [%# 0 or 0.0 or 0.00 or 00 or 00.0 or 00.00 or 0.000 ... %] [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt index 1ce7d8cceb..95200db6f2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt @@ -6,14 +6,14 @@ [%- INCLUDE empty_line.inc -%] [%- FOREACH o IN orders -%] -"[% o.orderdate | html %] ([% o.latesince | html %] days)"[%- delimiter | html -%] +"[% o.orderdate | $KohaDates %] ([% o.latesince | html %] days)"[%- delimiter | html -%] "[% o.estimateddeliverydate | $KohaDates %]"[%- delimiter | html -%] "[% o.supplier (o.supplierid) | html %]"[%- delimiter | html -%] "[% o.title | html %] [% IF o.author %]Author: [% o.author | html %].[% END %][% IF o.publisher %]Published by: [% o.publisher | html %].[% END %]"[%- delimiter | html -%] "[% o.unitpricesupplier | html %] x [% o.quantity_to_receive | html %] = [% o.subtotal | html %] ([% o.budget | html %])"[%- delimiter | html -%] "[% o.basketname | html %] ([% o.basketno | html %])"[%- delimiter | html -%] "[% o.claims_count | html %]"[%- delimiter | html -%] -"[% o.claimed_date | html %]"[%- delimiter | html -%] +"[% o.claimed_date | $KohaDates %]"[%- delimiter | html -%] "[% o.internalnote | html %]"[%- delimiter | html -%] "[% o.vendornote | html %]"[%- delimiter | html -%] "[% o.isbn | html %]" diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt index 200cd1e098..d29539bafe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt @@ -3,6 +3,7 @@ [% USE KohaDates %] [% USE Branches %] [% USE ColumnsSettings %] +[% USE Price %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › Late orders @@ -35,7 +36,7 @@ [% IF info_claim %]
Email has been sent.
[% END %] -[% IF ( lateorders ) %] +[% IF lateorders.count %]
@@ -48,6 +49,7 @@

[% END %] + [% SET total = 0 %] @@ -77,71 +79,69 @@ [% FOREACH lateorder IN lateorders %] - - - + - + [% END %] - + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/showorder.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/showorder.tt index 9a4e53837c..8d026afdcd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/showorder.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/showorder.tt @@ -17,11 +17,11 @@
  • Claims count: - [% order.claims_count | html %] + [% order.claims.count | html %]
  • Last claim date: - [% order.claimed_date | html %] + [% order.claims.last.claimed_on | html %]
  • diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t index 4469dc922e..912a451e25 100755 --- a/t/db_dependent/Acquisition.t +++ b/t/db_dependent/Acquisition.t @@ -391,16 +391,16 @@ is( scalar (@$search_orders), 0, "SearchOrders takes into account the biblionumb ok( GetBudgetByOrderNumber( $ordernumbers[0] )->{'budget_id'} eq $budgetid, "GetBudgetByOrderNumber returns expected budget" ); -my @lateorders = GetLateOrders(0); -is( scalar grep ( $_->{basketno} eq $basketno, @lateorders ), +my $lateorders = Koha::Acquisition::Orders->filter_by_lates({ delay => 0 }); +is( $lateorders->search({ 'me.basketno' => $basketno })->count, 0, "GetLateOrders does not get orders from opened baskets" ); C4::Acquisition::CloseBasket($basketno); -@lateorders = GetLateOrders(0); -isnt( scalar grep ( $_->{basketno} eq $basketno, @lateorders ), +$lateorders = Koha::Acquisition::Orders->filter_by_lates({ delay => 0 }); +isnt( $lateorders->search({ 'me.basketno' => $basketno })->count, 0, "GetLateOrders gets orders from closed baskets" ); -ok( !grep ( $_->{ordernumber} eq $ordernumbers[3], @lateorders ), +is( $lateorders->search({ ordernumber => $ordernumbers[3] })->count, 0, "GetLateOrders does not get cancelled orders" ); -ok( !grep ( $_->{ordernumber} eq $ordernumbers[4], @lateorders ), +is( $lateorders->search({ ordernumber => $ordernumbers[4] })->count, 0, "GetLateOrders does not get received orders" ); $search_orders = SearchOrders({ @@ -415,13 +415,12 @@ is( scalar (@$search_orders), 4, "SearchOrders with pending and ordered params g # Test AddClaim # -my $order = $lateorders[0]; -AddClaim( $order->{ordernumber} ); -my $neworder = GetOrder( $order->{ordernumber} ); +my $order = $lateorders->next; +$order->claim(); is( - $neworder->{claimed_date}, + output_pref({ str => $order->claimed_date, dateformat => 'iso', dateonly => 1 }), strftime( "%Y-%m-%d", localtime(time) ), - "AddClaim : Check claimed_date" + "Koha::Acquisition::Order->claim: Check claimed_date" ); my $order2 = Koha::Acquisition::Orders->find( $ordernumbers[1] )->unblessed; @@ -449,7 +448,7 @@ is( "ModReceiveOrder only changes the supplied orders internal notes" ); -$neworder = GetOrder($new_ordernumber); +my $neworder = GetOrder($new_ordernumber); is( $neworder->{'quantity'}, 2, '2 items on new order' ); is( $neworder->{'quantityreceived'}, 2, 'Splitting up order received items on new order' ); -- 2.39.5
    - + [% lateorder.ordernumber | $raw %] - [% lateorder.orderdate | $KohaDates %] ([% lateorder.latesince | html %] days) + [% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days) - [% IF ( lateorder.estimateddeliverydate ) %] - [% lateorder.estimateddeliverydate | $KohaDates %] - [% ELSE %] - + [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %] + [% IF estimated_delivery_date %] + [% estimated_delivery_date | $KohaDates %] [% END %] - [% lateorder.supplier | html %] - ([% lateorder.supplierid | html %]) + [% lateorder.basket.bookseller.name | html %] + ([% lateorder.basket.bookseller.id | html %]) - [% lateorder.title | html %] - [% IF ( lateorder.author ) %]
    Author: [% lateorder.author | html %][% END %] - [% IF ( lateorder.publisher ) %] -
    Published by: [% lateorder.publisher | html %] - [% IF ( lateorder.publicationyear ) %] - in [% lateorder.publicationyear | html %] + [% lateorder.biblio.title | html %] + [% IF ( lateorder.biblio.author ) %]
    Author: [% lateorder.biblio.author | html %][% END %] + [% IF ( lateorder.biblio.biblioitem.publishercode ) %] +
    Published by: [% lateorder.biblio.biblioitem.publishercode | html %] + [% IF ( lateorder.biblio.biblioitem.publicationyear ) %] + in [% lateorder.biblio.biblioitem.publicationyear | html %] [% END %] [% END %]
    - [% lateorder.unitpricesupplier | html %]x[% lateorder.quantity | html %] = - [% lateorder.subtotal | html %] + [% SET subtotal = (lateorder.quantity - lateorder.quantityreceived) * lateorder.rrp %] + [% SET total = total + subtotal %] + [% lateorder.rrp | html %]x[% lateorder.quantity - lateorder.quantityreceived | html %] = [% subtotal | $Price %] [% IF ( CAN_user_acquisition_order_manage ) %] - [% lateorder.basketname | html %] ([% lateorder.basketno | html %]) + [% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %]) [% ELSE %] - [% lateorder.basketname | html %] ([% lateorder.basketno | html %]) + [% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %]) [% END %] - [% IF ( lateorder.basketgroupid ) %] + [% IF ( lateorder.basket.basketgroupid ) %] [% IF ( CAN_user_acquisition_group_manage ) %] - [% lateorder.basketgroupname | html %] ([% lateorder.basketgroupid | html %]) + [% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %]) [% ELSE %] - [% lateorder.basketgroupname | html %] ([% lateorder.basketgroupid | html %]) + [% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %]) [% END %] [% END %] [% Branches.GetName( lateorder.branch ) | html %] + [% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %] [% lateorder.budget | html %] + [% lateorder.fund.budget_name | html %] [% lateorder.claims_count | html %][% lateorder.claims.count | html %] - [% IF ( lateorder.claimed_date ) %] - [% lateorder.claimed_date | $KohaDates %] - [% ELSE %] - + [% FOR claim IN lateorder.claims %] + [% claim.claimed_on | $KohaDates %] [% END %] - [% IF ( lateorder.internalnote ) %] + [% IF lateorder.order_internalnote %]

    - [% lateorder.internalnote | html %] + [% lateorder.order_internalnote | html %] Edit internal note @@ -153,9 +153,9 @@ [% END %]

    - [% IF ( lateorder.vendornote ) %] + [% IF lateorder.order_vendornote %]

    - [% lateorder.vendornote | html %] + [% lateorder.order_vendornote | html %] Edit vendor note @@ -166,14 +166,14 @@ [% END %]

    [% lateorder.isbn | $raw %][% lateorder.biblio.biblioitem.isbn | $raw %]
    Total[% total | html %][% total | $Price %]