From a1230189daf8afcf43837d723345615332ed859a Mon Sep 17 00:00:00 2001 From: root Date: Tue, 4 Nov 2025 16:02:13 +0200 Subject: [PATCH] Bug 29326 - _ALL_ should not override other rules in UpdateItemLocationOnCheckin. C4::Context->interface -specific configurations. Backend. Syspref: UpdateItemLocationOnCheckin --- sip: _DEFAULT_: CART CART: _PERM_ _DEFAULT_: CART --- lib/Koha/Item.pm | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/lib/Koha/Item.pm b/lib/Koha/Item.pm index 98170ac..a737750 100644 --- a/lib/Koha/Item.pm +++ b/lib/Koha/Item.pm @@ -2733,21 +2733,38 @@ 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//''})) { - return $self->_check_location_update_rule($update_loc_rules->{$self->location}); - } - elsif (defined($update_loc_rules->{'_DEFAULT_'})) { - return $self->_check_location_update_rule($update_loc_rules->{'_DEFAULT_'}); - } + $self->_check_location_update_interface($update_loc_rules); + } +} + +sub _check_location_update_interface { + my ($self, $update_loc_rules) = @_; + my $new_location; + + if (my $update_loc_rules = $update_loc_rules->{C4::Context->interface()}) { + $new_location = $self->_check_location_update_rule($update_loc_rules); } + $new_location = $self->_check_location_update_rule($update_loc_rules) unless (defined($new_location)); + return $new_location; } sub _check_location_update_rule { my ($self, $update_loc_rule) = @_; + if (defined($update_loc_rule->{'_ALL_'})) { + return $self->_check_location_update_rule2($update_loc_rule->{'_ALL_'}); + } + elsif (defined($update_loc_rule->{$self->location//''})) { + return $self->_check_location_update_rule2($update_loc_rule->{$self->location}); + } + elsif (defined($update_loc_rule->{'_DEFAULT_'})) { + return $self->_check_location_update_rule2($update_loc_rule->{'_DEFAULT_'}); + } +} + +sub _check_location_update_rule2 { + my ($self, $update_loc_rule) = @_; + if ($update_loc_rule eq '_PERM_') { $update_loc_rule = $self->permanent_location; } -- 2.43.0