Lines 132-148
$template->param(
Link Here
|
132 |
); |
132 |
); |
133 |
|
133 |
|
134 |
my @additional_fields = Koha::AdditionalFields->search({ tablename => 'subscription' })->as_list; |
134 |
my @additional_fields = Koha::AdditionalFields->search({ tablename => 'subscription' })->as_list; |
135 |
my %additional_field_values; |
135 |
my @additional_field_values = Koha::Subscriptions->find($subscriptionid)->get_additional_field_values_for_template if $subscriptionid; |
136 |
if ($subscriptionid) { |
|
|
137 |
my $subscription = Koha::Subscriptions->find($subscriptionid); |
138 |
foreach my $value ($subscription->additional_field_values->as_list) { |
139 |
$additional_field_values{$value->field_id} = $value->value; |
140 |
} |
141 |
} |
142 |
|
136 |
|
143 |
$template->param( |
137 |
$template->param( |
144 |
additional_fields => \@additional_fields, |
138 |
additional_fields => \@additional_fields, |
145 |
additional_field_values => \%additional_field_values, |
139 |
additional_field_values => @additional_field_values, |
146 |
); |
140 |
); |
147 |
|
141 |
|
148 |
my $typeloop = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; |
142 |
my $typeloop = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; |
Lines 368-378
sub redirect_add_subscription {
Link Here
|
368 |
my $biblio = Koha::Biblios->find($biblionumber); |
362 |
my $biblio = Koha::Biblios->find($biblionumber); |
369 |
my $subscription_fields = Koha::AdditionalFields->search({ tablename => 'subscription' }); |
363 |
my $subscription_fields = Koha::AdditionalFields->search({ tablename => 'subscription' }); |
370 |
while ( my $field = $subscription_fields->next ) { |
364 |
while ( my $field = $subscription_fields->next ) { |
371 |
my $value = $query->param('additional_field_' . $field->id); |
365 |
my @field_values = $query->param( 'additional_field_' . $field->id ); |
372 |
push @additional_fields, { |
366 |
foreach my $value (@field_values) { |
373 |
id => $field->id, |
367 |
push @additional_fields, { |
374 |
value => $value, |
368 |
id => $field->id, |
375 |
}; |
369 |
value => $value, |
|
|
370 |
} if $value; |
371 |
} |
376 |
} |
372 |
} |
377 |
Koha::Subscriptions->find($subscriptionid)->set_additional_fields(\@additional_fields); |
373 |
Koha::Subscriptions->find($subscriptionid)->set_additional_fields(\@additional_fields); |
378 |
|
374 |
|
Lines 482-492
sub redirect_mod_subscription {
Link Here
|
482 |
my $biblio = Koha::Biblios->find($biblionumber); |
478 |
my $biblio = Koha::Biblios->find($biblionumber); |
483 |
my $subscription_fields = Koha::AdditionalFields->search({ tablename => 'subscription' }); |
479 |
my $subscription_fields = Koha::AdditionalFields->search({ tablename => 'subscription' }); |
484 |
while ( my $field = $subscription_fields->next ) { |
480 |
while ( my $field = $subscription_fields->next ) { |
485 |
my $value = $query->param('additional_field_' . $field->id); |
481 |
my @field_values = $query->param( 'additional_field_' . $field->id ); |
486 |
push @additional_fields, { |
482 |
foreach my $value (@field_values) { |
487 |
id => $field->id, |
483 |
push @additional_fields, { |
488 |
value => $value, |
484 |
id => $field->id, |
489 |
}; |
485 |
value => $value, |
|
|
486 |
} if $value; |
487 |
} |
490 |
} |
488 |
} |
491 |
Koha::Subscriptions->find($subscriptionid)->set_additional_fields(\@additional_fields); |
489 |
Koha::Subscriptions->find($subscriptionid)->set_additional_fields(\@additional_fields); |
492 |
|
490 |
|