Bugzilla – Attachment 101267 Details for
Bug 23463
Move C4::Items CRUD subroutines to Koha::Item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23463: update permanent_location if location has been updated
Bug-23463-update-permanentlocation-if-location-has.patch (text/plain), 3.05 KB, created by
Jonathan Druart
on 2020-03-20 15:14:07 UTC
(
hide
)
Description:
Bug 23463: update permanent_location if location has been updated
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-20 15:14:07 UTC
Size:
3.05 KB
patch
obsolete
>From 5a05db4cf69e51e4014832c0e21769256e60e2e7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 7 Aug 2019 21:13:18 -0500 >Subject: [PATCH] Bug 23463: update permanent_location if location has been > updated > >This change to Koha::Item->store seems correct here, but tests from /db_dependent/Items.t is failing now. > >Adjusting them to make them pass. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Item.pm | 2 +- > t/db_dependent/Items.t | 11 ++++++----- > 2 files changed, 7 insertions(+), 6 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 1d88df614c..c760e05889 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -137,7 +137,7 @@ sub store { > > my %updated_columns = $self->_result->get_dirty_columns; > return $self->SUPER::store unless %updated_columns; >- if ( defined $self->location >+ if ( exists $updated_columns{location} > and $self->location ne 'CART' > and $self->location ne 'PROC' > and not exists $updated_columns{permanent_location} ) >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index 0c1c2f85e2..d885dcce77 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -107,15 +107,16 @@ subtest 'General Add, Get and Del tests' => sub { > is( $getitem->location, $location, "The location should not have been modified" ); > is( $getitem->permanent_location, 'my permanent location', "The permanent_location should not have modified" ); > >- $getitem->location($location)->store; >+ my $new_location = "New location"; >+ $getitem->location($new_location)->store; > $getitem = Koha::Items->find($itemnumber); >- is( $getitem->location, $location, "The location should have been set to correct location" ); >- is( $getitem->permanent_location, $location, "The permanent_location should have been set to location" ); >+ is( $getitem->location, $new_location, "The location should have been set to correct location" ); >+ is( $getitem->permanent_location, $new_location, "The permanent_location should have been set to location" ); > > $getitem->location('CART')->store; > $getitem = Koha::Items->find($itemnumber); > is( $getitem->location, 'CART', "The location should have been set to CART" ); >- is( $getitem->permanent_location, $location, "The permanent_location should not have been set to CART" ); >+ is( $getitem->permanent_location, $new_location, "The permanent_location should not have been set to CART" ); > > t::lib::Mocks::mock_preference('item-level_itypes', '1'); > $getitem = Koha::Items->find($itemnumber); >@@ -879,7 +880,7 @@ subtest 'Test logging for ModItem' => sub { > > # True means logging > $schema->resultset('ActionLog')->search()->delete(); >- $item->location($location)->store({ log_action => 1 }); >+ $item->location('new location')->store({ log_action => 1 }); > is( $schema->resultset('ActionLog')->count(), 1, 'True value does trigger logging' ); > > # Undefined defaults to true >-- >2.20.1
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 23463
:
95899
|
95900
|
95901
|
95902
|
95903
|
95904
|
95905
|
95906
|
95907
|
95908
|
95909
|
95910
|
95911
|
95912
|
95913
|
95914
|
95915
|
95916
|
95917
|
95918
|
95919
|
95920
|
95921
|
95922
|
95923
|
95925
|
96145
|
97895
|
97896
|
97897
|
97898
|
97899
|
97900
|
97901
|
97902
|
97903
|
97904
|
97905
|
97906
|
97907
|
97908
|
97909
|
97910
|
97911
|
97912
|
97913
|
97914
|
97915
|
97916
|
97917
|
97918
|
97919
|
97920
|
97921
|
101151
|
101152
|
101153
|
101154
|
101156
|
101157
|
101158
|
101161
|
101163
|
101165
|
101167
|
101169
|
101170
|
101171
|
101172
|
101173
|
101174
|
101175
|
101176
|
101177
|
101178
|
101179
|
101180
|
101181
|
101182
|
101183
|
101184
|
101185
|
101186
|
101188
|
101189
|
101190
|
101191
|
101192
|
101193
|
101194
|
101195
|
101196
|
101197
|
101246
|
101247
|
101248
|
101249
|
101250
|
101251
|
101252
|
101253
|
101254
|
101255
|
101256
|
101257
|
101258
|
101259
|
101260
|
101261
|
101262
|
101263
|
101264
|
101265
|
101266
| 101267 |
101268
|
101269
|
101270
|
101271
|
101272
|
101273
|
101274
|
101275
|
101276
|
101277
|
101278
|
101279
|
101280
|
101281
|
101282
|
101283
|
101284
|
101413
|
101414
|
101415
|
101416
|
101432
|
101476
|
102071
|
103129
|
113581