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!

Sponsored-by: The Research University in the Helmholtz Association (KIT)

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Émily-Rose Francoeur <emily-rose.francoeur@inLibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Katrin Fischer 2023-09-08 15:34:33 +00:00 committed by Tomas Cohen Arazi
parent 8922fb1863
commit 06c2b4898b
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
3 changed files with 35 additions and 18 deletions

View file

@ -479,21 +479,26 @@ sub get_order_infos {
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{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 );
( $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{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});

View file

@ -158,6 +158,8 @@ modules:
-
columnname: statistic2
is_hidden: 1
-
columnname: invoice
-
columnname: supplier_report
-

View file

@ -478,6 +478,7 @@
<th>Estimated delivery date</th>
<th>Statistic 1</th>
<th>Statistic 2</th>
<th>Invoice</th>
[% IF Koha.Preference('EDIFACT') && ediaccount %]
<th>Supplier report</th>
[% END %]
@ -510,6 +511,7 @@
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
[% IF Koha.Preference('EDIFACT') && ediaccount %]
<th>&nbsp;</th>
[% END %]
@ -540,6 +542,7 @@
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
[% IF Koha.Preference('EDIFACT') && ediaccount %]
<th>&nbsp;</th>
[% END %]
@ -662,6 +665,13 @@
</td>
<td>[% books_loo.sort1 | html %]</td>
<td>[% books_loo.sort2 | html %]</td>
<td>
[% IF CAN_user_acquisition_edit_invoices %]
<a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% books_loo.invoice_object.invoiceid | url %]" class="invoice">[% books_loo.invoice_object.invoicenumber | html %]</a>
[% ELSE %]
[% books_loo.invoice_object.invoicenumber | html %]
[% END %]
</td>
[% IF Koha.Preference('EDIFACT') && ediaccount %]
<td>[% books_loo.suppliers_report | html %]</td>
[% 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, {