Bugzilla – Attachment 150213 Details for
Bug 31187
Regression, Permanent shelving location is always updated when editing location VIA BATCH ITEM MOD if both are mapped to MARC fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31187: (follow-up) Fix whitespace
Bug-31187-follow-up-Fix-whitespace.patch (text/plain), 3.97 KB, created by
Nick Clemens (kidclamp)
on 2023-04-25 15:30:10 UTC
(
hide
)
Description:
Bug 31187: (follow-up) Fix whitespace
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-04-25 15:30:10 UTC
Size:
3.97 KB
patch
obsolete
>From 30fee54d8c096262603bb72f747100c86ff2c2f4 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 25 Apr 2023 15:29:33 +0000 >Subject: [PATCH] Bug 31187: (follow-up) Fix whitespace > >--- > Koha/Items.pm | 19 ++++++++++--------- > t/db_dependent/Koha/Items/BatchUpdate.t | 24 ++++++++++++++---------- > tools/batchMod.pl | 8 ++++---- > 3 files changed, 28 insertions(+), 23 deletions(-) > >diff --git a/Koha/Items.pm b/Koha/Items.pm >index 0f4146c70a..0615901fae 100644 >--- a/Koha/Items.pm >+++ b/Koha/Items.pm >@@ -295,15 +295,16 @@ sub batch_update { > > my $old = $old_values->{$attribute}; > my $new = $new_values->{$attribute}; >- if ( $attribute eq 'permanent_location' && $new eq '' ){ >- # In the case where permanent_location is exposed we need >- # to preserve the original value when none is passed >- # the script will send a blank value to indicate that it was >- # included in the form >- $modified++; >- $new_values->{permanent_location} = $old; >- $item->make_column_dirty('permanent_location'); >- } >+ if ( $attribute eq 'permanent_location' && $new eq '' ) { >+ >+ # In the case where permanent_location is exposed we need >+ # to preserve the original value when none is passed >+ # the script will send a blank value to indicate that it was >+ # included in the form >+ $modified++; >+ $new_values->{permanent_location} = $old; >+ $item->make_column_dirty('permanent_location'); >+ } > $modified++ > if ( defined $old xor defined $new ) > || ( defined $old && defined $new && $new ne $old ); >diff --git a/t/db_dependent/Koha/Items/BatchUpdate.t b/t/db_dependent/Koha/Items/BatchUpdate.t >index 74418e02c1..9fc6ff1fa2 100755 >--- a/t/db_dependent/Koha/Items/BatchUpdate.t >+++ b/t/db_dependent/Koha/Items/BatchUpdate.t >@@ -164,23 +164,27 @@ subtest 'permanent_location' => sub { > > plan tests => 2; > >- $items->batch_update({ >+ $items->batch_update( >+ { > new_values => { >- 'permanent_location' => 'perm', >- 'location' => 'loc' >- } >- }); >+ 'permanent_location' => 'perm', >+ 'location' => 'loc' >+ } >+ } >+ ); > $items->reset; > > $item = $item->get_from_storage; > is( $item->permanent_location, 'perm', 'Updated as expected when value passed'); > >- $items->batch_update({ >+ $items->batch_update( >+ { > new_values => { >- 'permanent_location' => '', >- 'location' => 'new_loc' >- } >- }); >+ 'permanent_location' => '', >+ 'location' => 'new_loc' >+ } >+ } >+ ); > $items->reset; > > $item = $item->get_from_storage; >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index eeee4f3f60..9f2bb73507 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -156,10 +156,10 @@ if ( $op eq "action" ) { > grep { $_ ne "" } uniq $input->multi_param($cgi_var_name); > > next unless @v || $attr eq 'permanent_location'; >- # If permanent_location is present in the form we need to pass it forward >- # to indicate that the user may modify this field directly and so >- # it needs to be marked as 'dirty' on any update. Otherwise the object always >- # sets location to the permanent_location as well >+ # If permanent_location is present in the form we need to pass it forward >+ # to indicate that the user may modify this field directly and so >+ # it needs to be marked as 'dirty' on any update. Otherwise the object always >+ # sets location to the permanent_location as well > > $new_item_data->{$attr} = join '|', @v; > } >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31187
:
146589
|
150042
|
150046
|
150213
|
150278
|
150296
|
150597