Bugzilla – Attachment 175981 Details for
Bug 34989
Subscription cannot be added if a control field is set up in "Additional Fields" parameter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34989: Subscription cannot be added if a control field is set up in Additional Fields parameter
Bug-34989-Subscription-cannot-be-added-if-a-contro.patch (text/plain), 2.45 KB, created by
Baptiste Wojtkowski (bwoj)
on 2024-12-30 09:21:46 UTC
(
hide
)
Description:
Bug 34989: Subscription cannot be added if a control field is set up in Additional Fields parameter
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2024-12-30 09:21:46 UTC
Size:
2.45 KB
patch
obsolete
>From 0c00a5b846b344f31f18e90b755e7867619e62b7 Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> >Date: Mon, 30 Dec 2024 10:19:34 +0100 >Subject: [PATCH] Bug 34989: Subscription cannot be added if a control field is > set up in Additional Fields parameter > >Test plan for main and MARC21: >1 - Apply bug 38528 >2 - Create a subscription >3 - Go to administration -> aditional fields add a field for any CONTROL > field existing in your subscription for example 005 >4 - Also create an additional field for 245$a (check non regression) >5 - On the subscription page: Edit -> Edit subscription -> Next > -> Save subscription -> You get: "Internal server error" >6 - Apply patch >7 - Repeat 4, you have no error anymore. On the subscription page you > can see both additional fields. Also check that 245$a is properly > reported >--- > Koha/Object/Mixin/AdditionalFields.pm | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > >diff --git a/Koha/Object/Mixin/AdditionalFields.pm b/Koha/Object/Mixin/AdditionalFields.pm >index 086b4568..53a0bab5 100644 >--- a/Koha/Object/Mixin/AdditionalFields.pm >+++ b/Koha/Object/Mixin/AdditionalFields.pm >@@ -65,12 +65,21 @@ sub set_additional_fields { > my ($tag, $subfield) = split /\$/, $field->marcfield; > my $marc_field = $record->field($tag); > if ($field->marcfield_mode eq 'get') { >- $value = $marc_field ? $marc_field->subfield($subfield) : ''; >+ if ($subfield) { >+ $value = $marc_field ? $marc_field->subfield($subfield) : ''; >+ } else { >+ $value = $marc_field ? $marc_field->data() : ''; >+ } > } elsif ($field->marcfield_mode eq 'set') { >- if ($marc_field) { >+ if ($marc_field and $subfield) { > $marc_field->update($subfield => $value); >+ } elsif ($marc_field) { >+ $marc_field->update($value); >+ } elsif ($subfield) { >+ $marc_field = MARC::Field->new( $tag, '', '', $subfield => $value ); >+ $record->append_fields($marc_field); > } else { >- $marc_field = MARC::Field->new($tag, '', '', $subfield => $value); >+ $marc_field = MARC::Field->new( $tag, '', '', $value ); > $record->append_fields($marc_field); > } > $record_updated = 1; >-- >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 34989
:
173777
|
173778
|
174979
|
174980
|
175981
|
176042