Bugzilla – Attachment 101256 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: _set_derived_columns_for_mod was only used for cn_sort
Bug-23463-setderivedcolumnsformod-was-only-used-fo.patch (text/plain), 4.12 KB, created by
Jonathan Druart
on 2020-03-20 15:13:24 UTC
(
hide
)
Description:
Bug 23463: _set_derived_columns_for_mod was only used for cn_sort
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-20 15:13:24 UTC
Size:
4.12 KB
patch
obsolete
>From 545720c72e502e2e3cefa0403dd60564468afbd1 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 6 Aug 2019 11:11:38 -0500 >Subject: [PATCH] Bug 23463: _set_derived_columns_for_mod was only used for > cn_sort > >Same as _set_defaults_for_add > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/Items.pm | 85 ----------------------------------------------------- > 1 file changed, 85 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 7031f63f13..36d1d92ba4 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -414,44 +414,6 @@ If log_action is true or undefined, the action will be logged. > sub ModItem { > my ( $item, $biblionumber, $itemnumber, $additional_params ) = @_; > my $log_action = $additional_params->{log_action} // 1; >- my $unlinked_item_subfields = $additional_params->{unlinked_item_subfields}; >- >- return unless %$item; >- $item->{'itemnumber'} = $itemnumber or return; >- >- # if $biblionumber is undefined, get it from the current item >- unless (defined $biblionumber) { >- $biblionumber = _get_single_item_column('biblionumber', $itemnumber); >- } >- >- if ($unlinked_item_subfields) { >- $item->{'more_subfields_xml'} = _get_unlinked_subfields_xml($unlinked_item_subfields); >- }; >- >- my @fields = qw( itemlost withdrawn damaged ); >- >- # Only retrieve the item if we need to set an "on" date field >- if ( $item->{itemlost} || $item->{withdrawn} || $item->{damaged} ) { >- my $pre_mod_item = Koha::Items->find( $item->{'itemnumber'} ); >- for my $field (@fields) { >- if ( defined( $item->{$field} ) >- and not $pre_mod_item->$field >- and $item->{$field} ) >- { >- $item->{ $field . '_on' } = >- DateTime::Format::MySQL->format_datetime( dt_from_string() ); >- } >- } >- } >- >- # If the field is defined but empty, we are removing and, >- # and thus need to clear out the 'on' field as well >- for my $field (@fields) { >- if ( defined( $item->{$field} ) && !$item->{$field} ) { >- $item->{ $field . '_on' } = undef; >- } >- } >- > > _set_derived_columns_for_mod($item); > _do_column_fixes_for_mod($item); >@@ -1308,53 +1270,6 @@ sub _set_derived_columns_for_add { > } > } > >-=head2 _set_derived_columns_for_mod >- >- _set_derived_column_for_mod($item); >- >-Given an item hash representing a new item to be modified. >-calculate any derived columns. Currently the only >-such column is C<items.cn_sort>. >- >-This routine differs from C<_set_derived_columns_for_add> >-in that it needs to handle partial item records. In other >-words, the caller of C<ModItem> may have supplied only one >-or two columns to be changed, so this function needs to >-determine whether any of the columns to be changed affect >-any of the derived columns. Also, if a derived column >-depends on more than one column, but the caller is not >-changing all of then, this routine retrieves the unchanged >-values from the database in order to ensure a correct >-calculation. >- >-=cut >- >-sub _set_derived_columns_for_mod { >- my $item = shift; >- >- foreach my $column (keys %derived_columns) { >- my $builder = $derived_columns{$column}->{'BUILDER'}; >- my $source_values = {}; >- my %missing_sources = (); >- my $must_recalc = 0; >- foreach my $source_column (keys %{ $derived_columns{$column} }) { >- next if $source_column eq 'BUILDER'; >- if (exists $item->{$source_column}) { >- $must_recalc = 1; >- $source_values->{$source_column} = $item->{$source_column}; >- } else { >- $missing_sources{$source_column} = 1; >- } >- } >- if ($must_recalc) { >- foreach my $source_column (keys %missing_sources) { >- $source_values->{$source_column} = _get_single_item_column($source_column, $item->{'itemnumber'}); >- } >- $builder->($item, $source_values); >- } >- } >-} >- > =head2 _do_column_fixes_for_mod > > _do_column_fixes_for_mod($item); >-- >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