@@ -, +, @@ --- C4/Serials.pm | 18 +++++++++++ .../prog/en/modules/serials/subscription-renew.tt | 35 ++++++++++++++++++++-- serials/subscription-renew.pl | 5 ++++ 3 files changed, 55 insertions(+), 3 deletions(-) --- a/C4/Serials.pm +++ a/C4/Serials.pm @@ -1495,6 +1495,24 @@ sub NewSubscription { return $subscriptionid; } +=head2 _get_sub_length +my ($numberlength, $weeklength, $monthlength) = _get_sub_length( $subtype, $sublength ); + +this function calculates the subscription length. + +=cut + +sub _get_sub_length { + my ($type, $length) = @_; + return + ( + $type eq 'issues' ? $length : 0, + $type eq 'weeks' ? $length : 0, + $type eq 'months' ? $length : 0, + ); +} + + =head2 ReNewSubscription ReNewSubscription($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt @@ -32,9 +32,38 @@
  • Subscription length: -
    1. -
    2. -
  • + + (enter amount in numerals) + +
  • --- a/serials/subscription-renew.pl +++ a/serials/subscription-renew.pl @@ -62,6 +62,10 @@ my $dbh = C4::Context->dbh; my $mode = $query->param('mode') || q{}; my $op = $query->param('op') || 'display'; my $subscriptionid = $query->param('subscriptionid'); +my $sublength = $query->param('sublength'); +my $subtype = $query->param('subtype'); +my ($numberlength, $weeklength, $monthlength) = C4::Serials->_get_sub_length( $subtype, $sublength ); + my $done = 0; # for after form has been submitted my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -93,6 +97,7 @@ my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1 or output_pref( { dt => dt_from_string, dateonly => 1 } ); $template->param( + subtypes => [ qw( numberlength weeklength monthlength ) ], startdate => $newstartdate, numberlength => $subscription->{numberlength}, weeklength => $subscription->{weeklength}, --