Skip to content

Commit

Permalink
CUYAHOGA - Bug 34838: Use ->set to avoid method redefinition warnings
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tomascohen authored and kylemhall committed May 20, 2024
1 parent 71f596d commit 4122f7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions Koha/Illrequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,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
Expand Down Expand Up @@ -314,7 +314,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::Illrequest::Logger->new;
Expand Down Expand Up @@ -368,7 +368,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
Expand Down Expand Up @@ -1098,10 +1098,10 @@ Return a string representing the material type of this request or undef

sub get_type {
my ($self) = @_;
my $attr = $self->illrequestattributes->find({ type => 'type'});
my $attr = $self->extended_attributes->find( { type => 'type' } );
return if !$attr;
return $attr->value;
};
}

#### Illrequests Imports

Expand Down Expand Up @@ -1704,10 +1704,10 @@ and transport type
sub get_notice {
my ( $self, $params ) = @_;

my $title = $self->illrequestattributes->find(
my $title = $self->extended_attributes->find(
{ type => 'title' }
);
my $author = $self->illrequestattributes->find(
my $author = $self->extended_attributes->find(
{ type => 'author' }
);
my $metahash = $self->metadata;
Expand All @@ -1719,7 +1719,7 @@ sub get_notice {
my $metastring = join("\n", @metaarray);

my $illrequestattributes = {
map { $_->type => $_->value } $self->illrequestattributes->as_list
map { $_->type => $_->value } $self->extended_attributes->as_list
};

my $letter = C4::Letters::GetPreparedLetter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,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 %]
Expand Down

0 comments on commit 4122f7b

Please sign in to comment.