From c20f4ed1e9930fff206f8e2ba1274fed780a9491 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Wed, 22 Oct 2025 10:22:53 +0300 Subject: [PATCH] Bug 29326: (QA follow-up) Fix tidiness --- Koha/Item.pm | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 91d3e65e4a4..826a8e79243 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -2784,7 +2784,7 @@ sub location_update_trigger { my ( $self, $action ) = @_; my $new_location = $self->_check_location_update_rules($action); - if (defined $new_location) { + if ( defined $new_location ) { my $messages = { 'ItemLocationUpdated' => { from => $self->location, @@ -2804,7 +2804,7 @@ sub location_update_trigger { } sub _check_location_update_rules { - my ($self, $action) = @_; + my ( $self, $action ) = @_; my ( $update_loc_rules, $messages ); if ( $action eq 'checkin' ) { $update_loc_rules = C4::Context->yaml_preference('UpdateItemLocationOnCheckin'); @@ -2813,30 +2813,28 @@ sub _check_location_update_rules { } if ($update_loc_rules) { - if (defined($update_loc_rules->{'_ALL_'})) { - return $self->_check_location_update_rule($update_loc_rules->{'_ALL_'}); - } - elsif (defined($update_loc_rules->{$self->location||'_BLANK_'})) { - return $self->_check_location_update_rule($update_loc_rules->{$self->location||'_BLANK_'}); - } - elsif (defined($update_loc_rules->{'_DEFAULT_'})) { - return $self->_check_location_update_rule($update_loc_rules->{'_DEFAULT_'}); + if ( defined( $update_loc_rules->{'_ALL_'} ) ) { + return $self->_check_location_update_rule( $update_loc_rules->{'_ALL_'} ); + } elsif ( defined( $update_loc_rules->{ $self->location || '_BLANK_' } ) ) { + return $self->_check_location_update_rule( $update_loc_rules->{ $self->location || '_BLANK_' } ); + } elsif ( defined( $update_loc_rules->{'_DEFAULT_'} ) ) { + return $self->_check_location_update_rule( $update_loc_rules->{'_DEFAULT_'} ); } } } - sub _check_location_update_rule { - my ($self, $update_loc_rule) = @_; + my ( $self, $update_loc_rule ) = @_; - if ($update_loc_rule eq '_PERM_') { + if ( $update_loc_rule eq '_PERM_' ) { $update_loc_rule = $self->permanent_location; } - if ($update_loc_rule eq '_BLANK_') { + if ( $update_loc_rule eq '_BLANK_' ) { $update_loc_rule = ''; } - if ((defined($self->location) && $self->location ne $update_loc_rule) || - (not(defined($self->location)) && $update_loc_rule ne "" )) { + if ( ( defined( $self->location ) && $self->location ne $update_loc_rule ) + || ( not( defined( $self->location ) ) && $update_loc_rule ne "" ) ) + { return $update_loc_rule; } return undef; -- 2.34.1