Bugzilla – Attachment 42306 Details for
Bug 10855
Custom fields for subscriptions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10855: Additional marc fields are not inserted
Bug-10855-Additional-marc-fields-are-not-inserted.patch (text/plain), 3.14 KB, created by
Julian Maurice
on 2015-09-03 12:15:42 UTC
(
hide
)
Description:
Bug 10855: Additional marc fields are not inserted
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2015-09-03 12:15:42 UTC
Size:
3.14 KB
patch
obsolete
>From 19c0e7cda0186d899490ee1d990d2841d060426c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 20 Jan 2014 10:27:48 +0100 >Subject: [PATCH] Bug 10855: Additional marc fields are not inserted > >In subscription-add.pl, the code for inserting additional_fields is not >the same for updating and inserting. >This patch refactores this code in code to do the same tests. > >Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com> >--- > serials/subscription-add.pl | 36 ++++++++++++++++++------------------ > 1 file changed, 18 insertions(+), 18 deletions(-) > >diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl >index f9a0c4e..fedb7da 100755 >--- a/serials/subscription-add.pl >+++ b/serials/subscription-add.pl >@@ -345,14 +345,7 @@ sub redirect_add_subscription { > ); > > my $additional_fields = Koha::AdditionalField->all( { tablename => 'subscription' } ); >- my @additional_field_values; >- for my $field ( @$additional_fields ) { >- my $af = Koha::AdditionalField->new({ id => $field->{id} }); >- $af->{values} = { >- $subscriptionid => $query->param('additional_field_' . $field->{id}) >- } if defined $query->param('additional_field_' . $field->{id}); >- $af->insert_values; >- } >+ insert_additional_fields( $additional_fields, $biblionumber, $subscriptionid ); > > print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); > return; >@@ -430,25 +423,32 @@ sub redirect_mod_subscription { > ); > > my $additional_fields = Koha::AdditionalField->all( { tablename => 'subscription' } ); >+ insert_additional_fields( $additional_fields, $biblionumber, $subscriptionid ); >+ >+ print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); >+ return; >+} >+ >+sub insert_additional_fields { >+ my ( $additional_fields, $biblionumber, $subscriptionid ) = @_; > my @additional_field_values; >+ my $record = GetMarcBiblio( $biblionumber, 1 ); > for my $field ( @$additional_fields ) { > my $af = Koha::AdditionalField->new({ id => $field->{id} })->fetch; > if ( $af->{marcfield} ) { >- my $record = GetMarcBiblio( $biblionumber, 1 ); > my ( $field, $subfield ) = split /\$/, $af->{marcfield}; >- next unless $field and $subfield; >- my $value = $record->subfield( $field, $subfield ); >- $af->{values} = { >- $subscriptionid => $value >- }; >+ $af->{values} = undef; >+ if ( $field and $subfield ) { >+ my $value = $record->subfield( $field, $subfield ); >+ $af->{values} = { >+ $subscriptionid => $value >+ }; >+ } > } else { > $af->{values} = { > $subscriptionid => $query->param('additional_field_' . $field->{id}) >- }; >+ } if defined $query->param('additional_field_' . $field->{id}); > } > $af->insert_values; > } >- >- print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); >- return; > } >-- >1.9.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 10855
:
20937
|
20938
|
20939
|
20940
|
20941
|
20942
|
20943
|
20944
|
21184
|
21185
|
21186
|
21187
|
21188
|
21189
|
21190
|
21191
|
21663
|
22049
|
22050
|
22051
|
22052
|
22053
|
22054
|
22055
|
22056
|
22057
|
22359
|
22360
|
22600
|
22601
|
22602
|
22603
|
22604
|
22605
|
22606
|
22607
|
22608
|
22616
|
22698
|
22699
|
22700
|
22701
|
22702
|
22703
|
22722
|
22768
|
22769
|
22869
|
23052
|
23053
|
23142
|
23143
|
23301
|
23302
|
23594
|
23595
|
23596
|
23597
|
23598
|
23599
|
23600
|
23601
|
23602
|
23774
|
23775
|
23961
|
23962
|
23963
|
23964
|
24452
|
24453
|
24454
|
24455
|
24456
|
24457
|
24569
|
24570
|
26091
|
26092
|
26093
|
26094
|
26095
|
26096
|
26097
|
26254
|
26255
|
26256
|
26257
|
26258
|
26259
|
26260
|
26276
|
26651
|
26655
|
28929
|
28930
|
28931
|
28932
|
28933
|
28934
|
28935
|
28936
|
28937
|
28938
|
28939
|
28940
|
28941
|
29095
|
29161
|
35211
|
35212
|
35213
|
35214
|
35215
|
35216
|
35217
|
35218
|
35219
|
35220
|
35221
|
35309
|
35310
|
35369
|
35556
|
36359
|
36362
|
36363
|
36364
|
36365
|
36366
|
36367
|
36368
|
36369
|
36370
|
36371
|
36372
|
36373
|
36374
|
38549
|
38550
|
38551
|
38552
|
38553
|
38554
|
38555
|
38556
|
38557
|
38558
|
38559
|
38560
|
38561
|
42296
|
42297
|
42298
|
42299
|
42300
|
42301
|
42302
|
42303
|
42304
|
42305
| 42306 |
42307
|
42308
|
42309
|
42310
|
42332
|
42333
|
43076