@@ -, +, @@ length element --- C4/Serials.pm | 18 +++++++ .../prog/en/modules/serials/subscription-renew.tt | 59 ++++++++++++++++------ serials/subscription-add.pl | 16 ++---- serials/subscription-renew.pl | 4 ++ 4 files changed, 69 insertions(+), 28 deletions(-) --- a/C4/Serials.pm +++ a/C4/Serials.pm @@ -1483,6 +1483,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($params); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt @@ -37,24 +37,53 @@
  • Subscription length: -
    1. -
    2. -
  • + + (enter amount in numerals) + + -
  • - + [% UNLESS ( Independentbranches ) %] + + [% END %] + [% IF CAN_user_serials_superserials %] + [% FOREACH library IN libraries %] + + [% END %] [% END %] - [% END %] - (select a library) -
  • + (select a library) + -
  • +
  • --- a/serials/subscription-add.pl +++ a/serials/subscription-add.pl @@ -265,16 +265,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); @@ -330,7 +320,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'); @@ -443,8 +433,8 @@ sub redirect_mod_subscription { my $subtype = $query->param('subtype'); my $sublength = $query->param('sublength'); - my ($numberlength, $weeklength, $monthlength) - = _get_sub_length( $subtype, $sublength ); + my ($numberlength, $weeklength, $monthlength) = C4::Serials->get_sub_length( $subtype, $sublength ); + my $numberpattern = $query->param('numbering_pattern'); my $locale = $query->param('locale'); my $lastvalue1 = $query->param('lastvalue1'); my $innerloop1 = $query->param('innerloop1'); --- a/serials/subscription-renew.pl +++ a/serials/subscription-renew.pl @@ -62,6 +62,10 @@ my $mode = $query->param('mode') || q{}; my $op = $query->param('op') || 'display'; my @subscriptionids = $query->multi_param('subscriptionid'); my $branchcode = $query->param('branchcode'); +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( { --