View | Details | Raw Unified | Return to bug 7046
Collapse All | Expand All

(-)a/C4/Serials.pm (+18 lines)
Lines 1495-1500 sub NewSubscription { Link Here
1495
    return $subscriptionid;
1495
    return $subscriptionid;
1496
}
1496
}
1497
1497
1498
=head2 _get_sub_length
1499
my ($numberlength, $weeklength, $monthlength) = _get_sub_length( $subtype, $sublength );
1500
1501
this function calculates the subscription length.
1502
1503
=cut
1504
1505
sub _get_sub_length {
1506
    my ($type, $length) = @_;
1507
    return
1508
    (
1509
          $type eq 'issues' ? $length : 0,
1510
          $type eq 'weeks'   ? $length : 0,
1511
          $type eq 'months'  ? $length : 0,
1512
    );
1513
}
1514
1515
1498
=head2 ReNewSubscription
1516
=head2 ReNewSubscription
1499
1517
1500
ReNewSubscription($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note)
1518
ReNewSubscription($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt (-3 / +32 lines)
Lines 32-40 Link Here
32
            </li>
32
            </li>
33
		<li><fieldset>
33
		<li><fieldset>
34
		<legend>Subscription length:</legend>
34
		<legend>Subscription length:</legend>
35
		<ol><li><label for="numberlength">Number of num:</label><input type="text" id="numberlength" name="numberlength" value="[% numberlength %]" /></li>
35
		<select name="subtype" id="subtype">
36
		<li><label for="weeklength">Number of weeks: </label><input type="text" id="weeklength" name="weeklength" value="[% weeklength %]" /></li>
36
        [% FOREACH st IN subtypes %]
37
		<li><label for="monthlength">Number of months: </label><input type="text" id="monthlength" name="monthlength" value="[% monthlength %]" /></li></ol></fieldset></li>
37
            [% SWITCH st %]
38
                [% CASE 'numberlength'%]
39
                    [% IF st == subtype %]
40
                        <option value="issues" selected="selected">
41
                    [% ELSE %]
42
                        <option value="issues">
43
                    [% END %]
44
                    issues
45
                [% CASE 'weeklength' %]
46
                    [% IF st == subtype %]
47
                        <option value="weeks" selected="selected">
48
                    [% ELSE %]
49
                        <option value="weeks">
50
                    [% END %]
51
                    weeks
52
                [% CASE 'monthlength' %]
53
                    [% IF st == subtype %]
54
                        <option value="months" selected="selected">
55
                    [% ELSE %]
56
                        <option value="months">
57
                    [% END %]
58
                    months
59
                [% CASE %][% st %]
60
            [% END %]
61
            </option>
62
        [% END %]
63
    </select>
64
    <input type="text" name="sublength" id="sublength" value="[% sublength %]" size="3" />(enter amount in numerals)
65
    <input type="hidden" name="issuelengthcount">
66
    </li>
38
		<li><label for="note">Note for the librarian that will manage your renewal request: </label>
67
		<li><label for="note">Note for the librarian that will manage your renewal request: </label>
39
		<textarea name="note" id="note" rows="5" cols="50"></textarea></li></ol></fieldset>
68
		<textarea name="note" id="note" rows="5" cols="50"></textarea></li></ol></fieldset>
40
		<fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
69
		<fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
(-)a/serials/subscription-renew.pl (-1 / +5 lines)
Lines 62-67 my $dbh = C4::Context->dbh; Link Here
62
my $mode           = $query->param('mode') || q{};
62
my $mode           = $query->param('mode') || q{};
63
my $op             = $query->param('op') || 'display';
63
my $op             = $query->param('op') || 'display';
64
my $subscriptionid = $query->param('subscriptionid');
64
my $subscriptionid = $query->param('subscriptionid');
65
my $sublength = $query->param('sublength');
66
my $subtype = $query->param('subtype');
67
my ($numberlength, $weeklength, $monthlength) = C4::Serials->_get_sub_length( $subtype, $sublength );
68
65
my $done = 0;    # for after form has been submitted
69
my $done = 0;    # for after form has been submitted
66
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
70
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
67
    {
71
    {
Lines 93-98 my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1 Link Here
93
    or output_pref( { dt => dt_from_string, dateonly => 1 } );
97
    or output_pref( { dt => dt_from_string, dateonly => 1 } );
94
98
95
$template->param(
99
$template->param(
100
    subtypes       => [ qw( numberlength weeklength monthlength ) ],
96
    startdate      => $newstartdate,
101
    startdate      => $newstartdate,
97
    numberlength   => $subscription->{numberlength},
102
    numberlength   => $subscription->{numberlength},
98
    weeklength     => $subscription->{weeklength},
103
    weeklength     => $subscription->{weeklength},
99
- 

Return to bug 7046