Bug 34838: Use ->set to avoid method redefinition warnings

This patch silences more warnings. To test

1. Be on 23.11.x
2. Apply the patches before this one
3. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Illrequests.t
=> FAIL: Lots of warnings like this:
Subroutine Koha::Illrequest::SUPER::status redefined at /kohadevbox/koha/Koha/Object.pm line 955.
Subroutine Koha::Illrequest::SUPER::status_alias redefined at /kohadevbox/koha/Koha/Object.pm line 955.
illrequestattributes is DEPRECATED in favor of extended_attributes at t/db_dependent/Illrequests.t line 1071.
4. Apply this patch
5. Repeat 3
=> SUCCESS: No more warnings!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ff42535f96)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Tomas Cohen Arazi 2024-05-16 17:13:05 -03:00 committed by Lucas Gass
parent 7472c619a0
commit 6205b4910d
2 changed files with 5 additions and 5 deletions

View File

@ -184,7 +184,7 @@ sub statusalias {
return Koha::AuthorisedValues->search(
{
category => 'ILL_STATUS_ALIAS',
authorised_value => $self->SUPER::status_alias
authorised_value => $self->get_column('status_alias'),
},
{},
$self->branchcode
@ -315,7 +315,7 @@ sub status_alias {
# We need a way of accepting implied undef, so we can nullify
# the status_alias column, when called from $self->status
my $val = $new_status_alias eq "-1" ? undef : $new_status_alias;
my $ret = $self->SUPER::status_alias($val);
my $ret = $self->set( { status_alias => $val } );
my $val_to_log = $val ? $new_status_alias : scalar $self->status;
if ($ret) {
my $logger = Koha::ILL::Request::Logger->new;
@ -369,7 +369,7 @@ sub status {
$self->{previous_status} = $current_status_alias ?
$current_status_alias :
$current_status;
my $ret = $self->SUPER::status($new_status)->store;
my $ret = $self->set( { status => $new_status } )->store;
if ($current_status_alias) {
# This is hackery to enable us to undefine
# status_alias, since we need to have an overloaded
@ -1174,7 +1174,7 @@ sub get_type {
my $attr = $self->extended_attributes->find({ type => 'type'});
return if !$attr;
return $attr->value;
};
}
=head3 get_type_disclaimer_value

View File

@ -764,7 +764,7 @@
</div>
<div class="modal-body">
<div id="requestattributes">
[% FOREACH attr IN request.illrequestattributes %]
[% FOREACH attr IN request.extended_attributes %]
<div class="requestattr-[% attr.type | html %]">
<span class="label">[% attr.type | html %]:</span>
[% attr.value | html %]