@@ -, +, @@ length type" disregards the stored value, also make SLT translateable. --- .../serials/showSubscriptionLengthType.inc | 8 ++++++++ .../prog/en/modules/serials/subscription-add.tt | 2 +- serials/subscription-add.pl | 15 +++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/serials/showSubscriptionLengthType.inc --- a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/showSubscriptionLengthType.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/showSubscriptionLengthType.inc @@ -0,0 +1,8 @@ +[%# This template must receive a parameter stl_name, containing the name of the subscription length type, either 'monthlength', 'numberlength' or 'weeklength'.Eg. "\[% INCLUDE showSubscriptionLengthType stl_name=subt.name %\]" %] +[% IF (stl_name) == 'numberlength' %] +issues +[% ELSIF (stl_name) == 'weeklength' %] +weeks +[% ELSIF (stl_name) == 'monthlength' %] +months +[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt @@ -658,7 +658,7 @@ $(document).ready(function() { [% ELSE %] [% END %] --- a/serials/subscription-add.pl +++ a/serials/subscription-add.pl @@ -59,7 +59,7 @@ my ($template, $loggedinuser, $cookie) my $sub_on; -my @subscription_types = (qw(issues weeks months)); +my @subscription_types = (qw(numberlength weeklength monthlength)); #These are the same as the koha.subscription-columns my @sub_type_data; my $subs; @@ -92,7 +92,7 @@ if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { $nextexpected->{'isfirstissue'} = $nextexpected->{planneddate} eq $firstissuedate ; $subs->{nextacquidate} = $nextexpected->{planneddate} if($op eq 'modify'); unless($op eq 'modsubscription') { - foreach my $length_unit (qw(numberlength weeklength monthlength)) { + foreach my $length_unit (@subscription_types) { if ($subs->{$length_unit}) { $sub_length=$subs->{$length_unit}; $sub_on=$length_unit; @@ -103,7 +103,6 @@ if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { $template->param( %{$subs} ); $template->param( $op => 1, - "subtype_$sub_on" => 1, sublength =>$sub_length, history => ($op eq 'modify'), firstacquiyear => substr($firstissuedate,0,4), @@ -250,9 +249,9 @@ sub _get_sub_length { my ($type, $length) = @_; return ( - $type eq 'issues' ? $length : 0, - $type eq 'weeks' ? $length : 0, - $type eq 'months' ? $length : 0, + $type eq 'numberlength' ? $length : 0, + $type eq 'weeklength' ? $length : 0, + $type eq 'monthlength' ? $length : 0, ); } @@ -323,7 +322,7 @@ sub redirect_add_subscription { my $enddate = format_date_in_iso( $query->param('enddate') ); my $firstacquidate = format_date_in_iso($query->param('firstacquidate')); if(!defined $enddate || $enddate eq '') { - if($subtype eq "issues") { + if($subtype eq "numberlength") { $enddate = _guess_enddate($firstacquidate, $periodicity, $numberlength, $weeklength, $monthlength); } else { $enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength); @@ -390,7 +389,7 @@ sub redirect_mod_subscription { # Guess end date if(!defined $enddate || $enddate eq '') { - if($subtype eq "issues") { + if($subtype eq "numberlength") { $enddate = _guess_enddate($nextacquidate, $periodicity, $numberlength, $weeklength, $monthlength); } else { $enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength); --