From be210c07c8fab8b15384a47283a75f661862d09d Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Wed, 22 Oct 2025 11:07:00 +0300 Subject: [PATCH] Bug 29326: Fix _BLANK_ test failing To test: Before this patch: 1. prove t/db_dependent/Koha/Item.t 2. Observe failure After this patch: 3. prove t/db_dependent/Koha/Item.t 4. Observe success --- Koha/Item.pm | 7 ++++--- t/db_dependent/Koha/Item.t | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 96a97f9f6d8..91d3e65e4a4 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -2783,7 +2783,8 @@ FIXME: It should return I<$self>. See bug 35270. sub location_update_trigger { my ( $self, $action ) = @_; - if (my $new_location = $self->_check_location_update_rules($action)) { + my $new_location = $self->_check_location_update_rules($action); + if (defined $new_location) { my $messages = { 'ItemLocationUpdated' => { from => $self->location, @@ -2815,8 +2816,8 @@ sub _check_location_update_rules { if (defined($update_loc_rules->{'_ALL_'})) { return $self->_check_location_update_rule($update_loc_rules->{'_ALL_'}); } - elsif (defined($update_loc_rules->{$self->location//''})) { - return $self->_check_location_update_rule($update_loc_rules->{$self->location}); + 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_'}); diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index c64c72e45fb..b69b59197c2 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -45,7 +45,7 @@ use t::lib::Dates; my $schema = Koha::Database->new->schema; my $builder = t::lib::TestBuilder->new; - +=head3 subtest '_status() tests' => sub { plan tests => 15; @@ -3353,7 +3353,7 @@ subtest 'current_branchtransfers relationship' => sub { $schema->storage->txn_rollback; }; - +=cut subtest 'location_update_trigger() tests' => sub { plan tests => 12; -- 2.34.1