Bug 31586: Log basket number as object for action ACQUISITION ORDER

Until now we logged undef as object in action_logs when an email
order was sent. With this patch the basket number is logged instead,
which will allow for reporting and also allows us to display a link
to the basket, if permissions permit (order manage), in the log
viewer.

To test:
- Make sure the ClaimsLog system preference is set to Log
- Create a vendor or make sure an existing vendor has an email set
- Make sure to add an SMTP server and link it to your library
- Create a basket in acqisitions and add an order line
- Click "E-mail order" to send the email
- Go to the log viewer, limit to module Acquisitions
- Verify that the entry show with a link to the basket in the
  Object column
  If the user doesn't have order_manage permission, the basket
  number will still show, but isn't linked

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Katrin Fischer 2022-09-20 12:47:15 +00:00 committed by Tomas Cohen Arazi
parent f6ba40b141
commit 33ba3af45a
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 8 additions and 1 deletions

View file

@ -516,11 +516,12 @@ sub SendAlerts {
return { error => $error }
unless $success;
my $log_object = $action eq 'ACQUISITION ORDER' ? $externalid : undef;
my $module = $action eq 'ACQUISITION ORDER' ? 'ACQUISITIONS' : 'CLAIMS';
logaction(
$module,
$action,
undef,
$log_object,
"To="
. join( ',', @email )
. " Title="

View file

@ -376,6 +376,12 @@
[% ELSE %]
Biblio-level recall on <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopro.recall.biblio_id | uri %]">biblio</a>
[% END %]
[% ELSIF ( loopro.module == 'ACQUISITIONS' && loopro.action == 'ACQUISITION ORDER' && loopro.object ) %]
[% IF ( CAN_user_acquisition_order_manage ) %]
Basket <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loopro.object | uri %]">[% loopro.object | html %]</a>
[% ELSE %]
Basket [% loopro.object | html %]
[% END %]
[% ELSE %]
[% loopro.object | html %]
[% END %]