From a0a7b779ee39fed7e8d88b7357716d7d4a78d8f0 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 16 May 2018 09:30:42 +0200 Subject: [PATCH] Bug 15774: Show additional field values in edit form MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Séverine QUEUNE Signed-off-by: Jonathan Druart Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens --- acqui/basketheader.pl | 2 +- .../prog/en/modules/serials/subscription-add.tt | 4 ++-- serials/subscription-add.pl | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl index da2129f485..7b5b16041e 100755 --- a/acqui/basketheader.pl +++ b/acqui/basketheader.pl @@ -100,7 +100,7 @@ if ( $op eq 'add_form' ) { $template->param( is_an_edit => 1); $template->param( additional_field_values => { map { - $_->field->name => $_->value + $_->field->id => $_->value } Koha::Acquisition::Baskets->find($basketno)->additional_field_values }, ); } else { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt index e2f6949a79..7e76c8dbe8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt @@ -450,9 +450,9 @@ fieldset.rows li.radio { width: 100%; } /* override staff-global.css */ - [% IF additional_fields_for_subscription %] + [% IF additional_fields %]
- [% INCLUDE 'additional-fields-entry.inc' available=additional_fields_for_subscription values=additional_fields %] + [% INCLUDE 'additional-fields-entry.inc' available=additional_fields values=additional_field_values %]
[% END %] diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl index 4d3310d433..5b1a447d5f 100755 --- a/serials/subscription-add.pl +++ b/serials/subscription-add.pl @@ -70,10 +70,10 @@ our $firstissuedate; my $mana_url = C4::Context->config('mana_config'); $template->param( 'mana_url' => $mana_url ); +my $subscriptionid = $query->param('subscriptionid'); if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { - my $subscriptionid = $query->param('subscriptionid'); $subs = GetSubscription($subscriptionid); output_and_exit( $query, $cookie, $template, 'unknown_subscription') @@ -144,7 +144,19 @@ $template->param( locations_loop=>$locations_loop, ); -$template->param( additional_fields_for_subscription => [ Koha::AdditionalFields->search( { tablename => 'subscription' } ) ] ); +my @additional_fields = Koha::AdditionalFields->search({ tablename => 'subscription' }); +my %additional_field_values; +if ($subscriptionid) { + my $subscription = Koha::Subscriptions->find($subscriptionid); + foreach my $value ($subscription->additional_field_values) { + $additional_field_values{$value->field_id} = $value->value; + } +} + +$template->param( + additional_fields => \@additional_fields, + additional_field_values => \%additional_field_values, +); my $typeloop = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; -- 2.39.5