From 368d00ab919d4f5c1452f42897ccc1d6308c02d5 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Fri, 8 Sep 2023 15:34:33 +0000 Subject: [PATCH] Bug 28449: Add column with invoice number to basket summary page At the moment it's quite a lot of clicks to get from the basket summary to the invoice something was received in. This adds a nice shortcut by creating a new column for the invoicenumber in the basket summary table. To test: * Make sure you have a basket with some received and unreceived order lines * Verify that the (received) shows for your received lines * Verify no invoice number or link to it in sight * Apply patch * Verify that there is now a column for the Invoice containing the invoice number as a link to the invoice * Test with a staff patron, that doesn't have edit_invoices permission * Verify that now instead of a link you see the invoice number as text Be happy, sign off ;) Note: this doesn't change the CSV export. The way the CSV is built is quite different to the summary table, so it would be better handled in a separate bug/patch. The columns are already quite different! Signed-off-by: Laura Escamilla --- acqui/basket.pl | 39 +++++++++++-------- admin/columns_settings.yml | 2 + .../prog/en/modules/acqui/basket.tt | 10 +++++ 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/acqui/basket.pl b/acqui/basket.pl index 80c633cf56..d7f2d76a99 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -473,27 +473,32 @@ sub get_order_infos { my $biblio = Koha::Biblios->find( $biblionumber ); my $countbiblio = $biblio->active_orders->count; - my $ordernumber = $order->{'ordernumber'}; + my $ordernumber = $order->{'ordernumber'}; my $cnt_subscriptions = $biblio->subscriptions->count; - my $itemcount = $biblio->items->count; - my $holds_count = $biblio->holds->count; - my $order = Koha::Acquisition::Orders->find($ordernumber); # FIXME We should certainly do that at the beginning of this sub - my $items = $order->items; + my $itemcount = $biblio->items->count; + my $holds_count = $biblio->holds->count; + my $order = Koha::Acquisition::Orders->find($ordernumber); # FIXME We should certainly do that at the beginning of this sub + my $items = $order->items; + my $invoice = $order->invoice; + my $itemholds = $biblio->holds->search({ itemnumber => { -in => [ $items->get_column('itemnumber') ] } })->count; # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680 - $line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == $items->count && !($cnt_subscriptions) && !($holds_count); - $line{items} = $itemcount - $items->count; - $line{left_item} = 1 if $line{items} >= 1; - $line{left_biblio} = 1 if $countbiblio > 1; - $line{biblios} = $countbiblio - 1; - $line{left_subscription} = 1 if $cnt_subscriptions; - $line{subscriptions} = $cnt_subscriptions; - ($holds_count >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0; - $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; + $line{can_del_bib} = 1 + if $countbiblio <= 1 && $itemcount == $items->count && !($cnt_subscriptions) && !($holds_count); + $line{items} = $itemcount - $items->count; + $line{left_item} = 1 if $line{items} >= 1; + $line{left_biblio} = 1 if $countbiblio > 1; + $line{biblios} = $countbiblio - 1; + $line{left_subscription} = 1 if $cnt_subscriptions; + $line{subscriptions} = $cnt_subscriptions; + ( $holds_count >= 1 ) ? $line{left_holds} = 1 : $line{left_holds} = 0; + $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; + $line{invoice_object} = $invoice; + } my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 90fb535472..ae3226a215 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -152,6 +152,8 @@ modules: columnname: fund - columnname: estimated_delivery_date + - + columnname: invoice - columnname: supplier_report - 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 604d1a2f36..aeb53f7fa9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -472,6 +472,7 @@ GST Fund Estimated delivery date + Invoice [% IF Koha.Preference('EDIFACT') && ediaccount %] Supplier report [% END %] @@ -502,6 +503,7 @@ [% foot_loo.tax_value | $Price %]     +   [% IF Koha.Preference('EDIFACT') && ediaccount %]   [% END %] @@ -530,6 +532,7 @@ [% total_tax_value | $Price %]     +   [% IF Koha.Preference('EDIFACT') && ediaccount %]   [% END %] @@ -650,6 +653,13 @@ Edit [% END %] + + [% IF CAN_user_acquisition_edit_invoices %] + [% books_loo.invoice_object.invoicenumber | html %] + [% ELSE %] + [% books_loo.invoice_object.invoicenumber | html %] + [% END %] + [% IF Koha.Preference('EDIFACT') && ediaccount %] [% books_loo.suppliers_report | html %] [% END %] -- 2.30.2