From 99cb6ee2d6a29e9c13ddc8f37a5eebb65f79251c Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Mon, 11 Feb 2019 14:40:56 +0000 Subject: [PATCH] Bug 20750: (follow-up) Fix merge problems Since we now merging on top of Bug 20581, we need some modifications to make sure status_alias changes are being logged and displayed correctly --- Koha/Illrequest.pm | 6 +++--- Koha/Illrequest/Logger.pm | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/ill/log/status_change.tt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm index 3ace1268ad..d885fccd5f 100644 --- a/Koha/Illrequest.pm +++ b/Koha/Illrequest.pm @@ -258,7 +258,7 @@ sub status { $current_status_alias : $current_status; my $ret = $self->SUPER::status($new_status)->store; - if ($ret) { + if ($current_status_alias) { # This is hackery to enable us to undefine # status_alias, since we need to have an overloaded # status_alias method to get us around the problem described @@ -267,14 +267,14 @@ sub status { # We need a way of passing implied undef to nullify status_alias # so we pass -1, which is special cased in the overloaded setter $self->status_alias("-1"); + } else { my $logger = Koha::Illrequest::Logger->new; $logger->log_status_change( $self, $new_status ); - } else { - delete $self->{previous_status}; } + delete $self->{previous_status}; return $ret; } else { return $current_status; diff --git a/Koha/Illrequest/Logger.pm b/Koha/Illrequest/Logger.pm index 1b016f84d8..e855e39309 100644 --- a/Koha/Illrequest/Logger.pm +++ b/Koha/Illrequest/Logger.pm @@ -243,7 +243,7 @@ sub get_request_logs { my $aliases = GetAuthorisedValues('ILLSTATUS'); my $alias_hash; foreach my $alias(@{$aliases}) { - $alias_hash->{$alias->{id}} = $alias; + $alias_hash->{$alias->{authorised_value}} = $alias; } foreach my $log(@{$logs}) { $log->{aliases} = $alias_hash; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/log/status_change.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/log/status_change.tt index 7fade01edb..11f3a783dc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/log/status_change.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/log/status_change.tt @@ -3,7 +3,7 @@ [% IF log.info.status_before %] [% before = log.info.status_before %] [% - display_before = log.info.status_before.match('^\d+$') ? + display_before = log.aliases.$before ? log.aliases.$before.lib : request.capabilities.$before.name %] @@ -11,7 +11,7 @@ from "[% display_before %]" [% END %] [% after = log.info.status_after %] [% - display_after = log.info.status_after.match('^\d+$') ? + display_after = log.aliases.$after ? log.aliases.$after.lib : request.capabilities.$after.name; %] -- 2.11.0