From 256593fecc0d5d355400a96313eaf9e00318cc22 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Mon, 27 Nov 2017 15:31:35 +1300 Subject: [PATCH] Bug 7046 - Added subscription length dropdown box --- C4/Serials.pm | 18 +++++++++++ .../prog/en/modules/serials/subscription-renew.tt | 35 ++++++++++++++++++++-- serials/subscription-renew.pl | 5 ++++ 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 45bae8c..4fc7425 100644 --- a/C4/Serials.pm +++ b/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) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt index e7eb83d..96db6af 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt @@ -32,9 +32,38 @@
  • Subscription length: -
    1. -
    2. -
  • + + (enter amount in numerals) + +
  • diff --git a/serials/subscription-renew.pl b/serials/subscription-renew.pl index bbbc8e5..e884a4a 100755 --- a/serials/subscription-renew.pl +++ b/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}, -- 2.1.4