From 06c2b4898bc37f0d3296c08508e9092132567e52 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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! Sponsored-by: The Research University in the Helmholtz Association (KIT) Signed-off-by: Laura Escamilla Signed-off-by: Michaela Sieber Signed-off-by: Martin Renvoize Signed-off-by: Émily-Rose Francoeur Signed-off-by: Tomas Cohen Arazi --- acqui/basket.pl | 39 +++++++++++-------- admin/columns_settings.yml | 2 + .../prog/en/modules/acqui/basket.tt | 12 +++++- 3 files changed, 35 insertions(+), 18 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 acbda87349..270c99984b 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -158,6 +158,8 @@ modules: - columnname: statistic2 is_hidden: 1 + - + 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 fe662a8ab2..4744978528 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -478,6 +478,7 @@ Estimated delivery date Statistic 1 Statistic 2 + Invoice [% IF Koha.Preference('EDIFACT') && ediaccount %] Supplier report [% END %] @@ -510,6 +511,7 @@       +   [% IF Koha.Preference('EDIFACT') && ediaccount %]   [% END %] @@ -540,6 +542,7 @@       +   [% IF Koha.Preference('EDIFACT') && ediaccount %]   [% END %] @@ -662,6 +665,13 @@ [% books_loo.sort1 | html %] [% books_loo.sort2 | html %] + + [% 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 %] @@ -1092,7 +1102,7 @@ KohaTable("orders", { "sPaginationType": "full", "autoWidth": false, - "exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17[% IF (Koha.Preference('EDIFACT') && ediaccount) %],18[% END %]], + "exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18[% IF (Koha.Preference('EDIFACT') && ediaccount) %],19[% END %]], }, table_settings); var cancelledorderst = $("#cancelledorderst").dataTable($.extend(true, {}, dataTablesDefaults, {