From 9d7d645baf35ae8b0b37d5d6c8ad653f8aa55841 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 20 Apr 2015 16:59:05 +0200 Subject: [PATCH] Bug 14022: Does not reset the subscription length on editing a subscription MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The subscription length is always set to the first/default value ('issues') when editing a subscription. Even if you selected another value on creating/editing it, the form will show you the first option. Test plan: 1/ Add/Edit a subscription, select a subscription length different of the first value (issues) 2/ Edit the subscription and confirm the value is kept Bonus: issues, week and months become translatable. Works as expected. Signed-off-by: Marc Véron Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../en/modules/serials/subscription-add.tt | 30 +++++++++++++++---- serials/subscription-add.pl | 18 ++++------- 2 files changed, 29 insertions(+), 19 deletions(-) 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 84019688b4..6bfe8d4bd9 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 @@ -652,13 +652,31 @@ $(document).ready(function() {
  • diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl index 39d79b7365..ce6f91dd3b 100755 --- a/serials/subscription-add.pl +++ b/serials/subscription-add.pl @@ -59,8 +59,6 @@ my ($template, $loggedinuser, $cookie) my $sub_on; -my @subscription_types = (qw(issues weeks months)); -my @sub_type_data; my $subs; our $firstissuedate; @@ -164,17 +162,11 @@ if ($op eq 'addsubscription') { } elsif ($op eq 'modsubscription') { redirect_mod_subscription(); } else { - while (@subscription_types) { - my $sub_type = shift @subscription_types; - my %row = ( 'name' => $sub_type ); - if ( defined $sub_on and $sub_on eq $sub_type ) { - $row{'selected'} = ' selected'; - } else { - $row{'selected'} = ''; - } - push( @sub_type_data, \%row ); - } - $template->param(subtype => \@sub_type_data); + + $template->param( + subtypes => [ qw( numberlength weeklength monthlength ) ], + subtype => $sub_on, + ); if ( $op ne 'modsubscription' && $op ne 'dup' && $op ne 'modify' ) { my $letters = get_letter_loop(); -- 2.39.5