@@ -, +, @@
---
C4/Serials.pm | 19 +++++++++++-
.../prog/en/modules/serials/subscription-renew.tt | 35 ++++++++++++++++++++--
serials/subscription-add.pl | 14 ++-------
serials/subscription-renew.pl | 9 ++++--
4 files changed, 59 insertions(+), 18 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, $subtype, $length) = @_;
+ return
+ (
+ $subtype eq 'issues' ? $length : 0,
+ $subtype eq 'weeks' ? $length : 0,
+ $subtype eq 'months' ? $length : 0,
+ );
+}
+
+
=head2 ReNewSubscription
ReNewSubscription($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note)
@@ -1529,7 +1547,6 @@ sub ReNewSubscription {
}
);
}
-
# renew subscription
$query = qq|
UPDATE subscription
--- 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 @@
+
+ (enter amount in numerals)
+
+
--- a/serials/subscription-add.pl
+++ a/serials/subscription-add.pl
@@ -248,16 +248,6 @@ sub get_letter_loop {
];
}
-sub _get_sub_length {
- my ($type, $length) = @_;
- return
- (
- $type eq 'issues' ? $length : 0,
- $type eq 'weeks' ? $length : 0,
- $type eq 'months' ? $length : 0,
- );
-}
-
sub _guess_enddate {
my ($startdate_iso, $frequencyid, $numberlength, $weeklength, $monthlength) = @_;
my ($year, $month, $day);
@@ -301,7 +291,7 @@ sub redirect_add_subscription {
my $subtype = $query->param('subtype');
my $sublength = $query->param('sublength');
my ( $numberlength, $weeklength, $monthlength )
- = _get_sub_length( $subtype, $sublength );
+ = C4::Serials->_get_sub_length( $subtype, $sublength );
my $add1 = $query->param('add1');
my $lastvalue1 = $query->param('lastvalue1');
my $innerloop1 = $query->param('innerloop1');
@@ -379,7 +369,7 @@ sub redirect_mod_subscription {
my $subtype = $query->param('subtype');
my $sublength = $query->param('sublength');
my ($numberlength, $weeklength, $monthlength)
- = _get_sub_length( $subtype, $sublength );
+ = C4::Serials->_get_sub_length( $subtype, $sublength );
my $numberpattern = $query->param('numbering_pattern');
my $locale = $query->param('locale');
my $lastvalue1 = $query->param('lastvalue1');
--- 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(
{
@@ -77,8 +81,8 @@ if ( $op eq "renew" ) {
my $startdate = output_pref( { str => scalar $query->param('startdate'), dateonly => 1, dateformat => 'iso' } );
ReNewSubscription(
$subscriptionid, $loggedinuser,
- $startdate, $query->param('numberlength'),
- $query->param('weeklength'), $query->param('monthlength'),
+ $startdate, $numberlength,
+ $weeklength, $monthlength,
$query->param('note')
);
}
@@ -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},
--