Bugzilla – Attachment 159391 Details for
Bug 35451
Add tablename field to additional_field_values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35451: Record table in set_additional_fields
Bug-35451-Record-table-in-setadditionalfields.patch (text/plain), 3.56 KB, created by
Martin Renvoize (ashimema)
on 2023-11-30 12:11:46 UTC
(
hide
)
Description:
Bug 35451: Record table in set_additional_fields
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-11-30 12:11:46 UTC
Size:
3.56 KB
patch
obsolete
>From 37773c64df09a16633dfd000ba1b725d226a3083 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 30 Nov 2023 11:47:53 +0000 >Subject: [PATCH] Bug 35451: Record table in set_additional_fields > >--- > Koha/Object/Mixin/AdditionalFields.pm | 39 +++++++++++++++------------ > 1 file changed, 22 insertions(+), 17 deletions(-) > >diff --git a/Koha/Object/Mixin/AdditionalFields.pm b/Koha/Object/Mixin/AdditionalFields.pm >index bf6598d8c9b..d4bf0dd36e9 100644 >--- a/Koha/Object/Mixin/AdditionalFields.pm >+++ b/Koha/Object/Mixin/AdditionalFields.pm >@@ -43,51 +43,56 @@ Koha::Object::Mixin::AdditionalFields > =cut > > sub set_additional_fields { >- my ($self, $additional_fields) = @_; >+ my ( $self, $additional_fields ) = @_; > > $self->additional_field_values->delete; > >+ my $table = $self->_result->table; >+ > my $biblionumber; > my $record; > my $record_updated; >- if ($self->_result->has_column('biblionumber')) { >+ if ( $self->_result->has_column('biblionumber') ) { > $biblionumber = $self->biblionumber; > } > > foreach my $additional_field (@$additional_fields) { >- my $field = Koha::AdditionalFields->find($additional_field->{id}); >+ my $field = Koha::AdditionalFields->find( $additional_field->{id} ); > my $value = $additional_field->{value}; > >- if ($biblionumber and $field->marcfield) { >+ if ( $biblionumber and $field->marcfield ) { > require Koha::Biblios; > $record //= Koha::Biblios->find($biblionumber)->metadata->record; > >- my ($tag, $subfield) = split /\$/, $field->marcfield; >+ my ( $tag, $subfield ) = split /\$/, $field->marcfield; > my $marc_field = $record->field($tag); >- if ($field->marcfield_mode eq 'get') { >+ if ( $field->marcfield_mode eq 'get' ) { > $value = $marc_field ? $marc_field->subfield($subfield) : ''; >- } elsif ($field->marcfield_mode eq 'set') { >+ } elsif ( $field->marcfield_mode eq 'set' ) { > if ($marc_field) { >- $marc_field->update($subfield => $value); >+ $marc_field->update( $subfield => $value ); > } else { >- $marc_field = MARC::Field->new($tag, '', '', $subfield => $value); >+ $marc_field = MARC::Field->new( $tag, '', '', $subfield => $value ); > $record->append_fields($marc_field); > } > $record_updated = 1; > } > } > >- if (defined $value) { >- my $field_value = Koha::AdditionalFieldValue->new({ >- field_id => $additional_field->{id}, >- record_id => $self->id, >- value => $value, >- })->store; >+ if ( defined $value ) { >+ my $field_value = Koha::AdditionalFieldValue->new( >+ { >+ field_id => $additional_field->{id}, >+ record_table => $table, >+ record_id => $self->id, >+ value => $value, >+ } >+ )->store; > } > } > > if ($record_updated) { >- C4::Biblio::ModBiblio($record, $biblionumber); >+ C4::Biblio::ModBiblio( $record, $biblionumber ); > } > } > >@@ -103,7 +108,7 @@ sub additional_field_values { > my ($self) = @_; > > my $afv_rs = $self->_result->additional_field_values; >- return Koha::AdditionalFieldValues->_new_from_dbic( $afv_rs ); >+ return Koha::AdditionalFieldValues->_new_from_dbic($afv_rs); > } > > =head1 AUTHOR >-- >2.43.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 35451
:
159390
|
159391
|
159392
|
159393
|
159394
|
159747
|
159748
|
159749
|
159750
|
159751
|
173147
|
173148
|
173149
|
173150
|
173151
|
173421
|
173422
|
173423
|
173424
|
173425