Bugzilla – Attachment 97912 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: Fix CancelReceipt.t
Bug-23463-Fix-CancelReceiptt.patch (text/plain), 4.09 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-01-24 19:45:44 UTC
(
hide
)
Description:
Bug 23463: Fix CancelReceipt.t
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-01-24 19:45:44 UTC
Size:
4.09 KB
patch
obsolete
>From d89f28c2d2df70568e4373cde58ef1481aa6fb66 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 7 Aug 2019 11:00:49 -0500 >Subject: [PATCH] Bug 23463: Fix CancelReceipt.t > >--- > C4/Items.pm | 9 ++------- > Koha/Item.pm | 9 +++++++-- > t/db_dependent/Acquisition/CancelReceipt.t | 2 +- > t/db_dependent/Circulation/issue.t | 4 ++-- > 4 files changed, 12 insertions(+), 12 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 8e2cad6b18..4b26de6742 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -276,15 +276,10 @@ sub ModItemFromMarc { > > my $localitemmarc = MARC::Record->new; > $localitemmarc->append_fields( $item_marc->field($itemtag) ); >- my $item = TransformMarcToKoha( $localitemmarc, $frameworkcode, 'items' ); >- my $default_values = _build_default_values_for_mod_marc(); > my $item_object = Koha::Items->find($itemnumber); >- foreach my $item_field ( keys %$default_values ) { >- $item_object->$item_field($default_values->{$item_field}) >- unless exists $item->{$item_field}; >- } >+ my $item = TransformMarcToKoha( $localitemmarc, $frameworkcode, 'items' ); >+ $item_object->set($item); > my $unlinked_item_subfields = _get_unlinked_item_subfields( $localitemmarc, $frameworkcode ); >- > $item_object->more_subfields_xml(_get_unlinked_subfields_xml($unlinked_item_subfields))->store; > $item_object->store; > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index c7766fc4ab..0ffc2a18ae 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -135,8 +135,13 @@ sub store { > } > } > >- if ( defined $self->location and $self->location ne 'CART' and $self->location ne 'PROC' and not $self->permanent_location ) { >- $self->permanent_location($self->location); >+ my %updated_columns = $self->_result->get_dirty_columns; >+ if ( defined $self->location >+ and $self->location ne 'CART' >+ and $self->location ne 'PROC' >+ and not exists $updated_columns{permanent_location} ) >+ { >+ $self->permanent_location( $self->location ); > } > > $self->timestamp(undef) if $self->timestamp; # Maybe move this to Koha::Object->store? >diff --git a/t/db_dependent/Acquisition/CancelReceipt.t b/t/db_dependent/Acquisition/CancelReceipt.t >index fa2509678b..0455a80f96 100644 >--- a/t/db_dependent/Acquisition/CancelReceipt.t >+++ b/t/db_dependent/Acquisition/CancelReceipt.t >@@ -167,6 +167,6 @@ my $item1 = Koha::Items->find( $itemnumber1 ); > is( $item1->notforloan, 9, "The notforloan value has been updated with '9'" ); > > my $item2 = Koha::Items->find( $itemnumber2 ); >-is( $item2->notforloan, 0, "The notforloan value has been updated with '9'" ); >+is( $item2->notforloan, 0, "The notforloan value has been updated with '0'" ); > > $schema->storage->txn_rollback(); >diff --git a/t/db_dependent/Circulation/issue.t b/t/db_dependent/Circulation/issue.t >index d3fe947277..006169bc4c 100644 >--- a/t/db_dependent/Circulation/issue.t >+++ b/t/db_dependent/Circulation/issue.t >@@ -387,8 +387,8 @@ ok( $item2->location eq 'FIC', 'UpdateItemLocationOnCheckin does not modify valu > t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' ); > AddReturn( 'barcode_4', $branchcode_1 ); > $item2 = Koha::Items->find( $itemnumber2 ); >-ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); >-ok( $item2->permanent_location eq 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); >+is( $item2->location, 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); >+is( $item2->permanent_location, 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); > AddReturn( 'barcode_4', $branchcode_1 ); > $item2 = Koha::Items->find( $itemnumber2 ); > ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} ); >-- >2.25.0
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