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

(-)a/C4/Serials.pm (+18 lines)
Lines 1483-1488 sub NewSubscription { Link Here
1483
    return $subscriptionid;
1483
    return $subscriptionid;
1484
}
1484
}
1485
1485
1486
=head2 _get_sub_length
1487
my ($numberlength, $weeklength, $monthlength) = _get_sub_length( $subtype, $sublength );
1488
1489
this function calculates the subscription length.
1490
1491
=cut
1492
1493
sub _get_sub_length {
1494
    my ($type, $subtype, $length) = @_;
1495
    return
1496
    (
1497
          $subtype eq 'issues' ? $length : 0,
1498
          $subtype eq 'weeks'   ? $length : 0,
1499
          $subtype eq 'months'  ? $length : 0,
1500
    );
1501
}
1502
1503
1486
=head2 ReNewSubscription
1504
=head2 ReNewSubscription
1487
1505
1488
ReNewSubscription($params);
1506
ReNewSubscription($params);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt (-15 / +44 lines)
Lines 37-60 Link Here
37
            </li>
37
            </li>
38
		<li><fieldset>
38
		<li><fieldset>
39
		<legend>Subscription length:</legend>
39
		<legend>Subscription length:</legend>
40
		<ol><li><label for="numberlength">Number of num:</label><input type="text" id="numberlength" name="numberlength" value="[% subscription.numberlength | html %]" /></li>
40
		<select name="subtype" id="subtype">
41
		<li><label for="weeklength">Number of weeks: </label><input type="text" id="weeklength" name="weeklength" value="[% subscription.weeklength | html %]" /></li>
41
        [% FOREACH st IN subtypes %]
42
		<li><label for="monthlength">Number of months: </label><input type="text" id="monthlength" name="monthlength" value="[% subscription.monthlength | html %]" /></li></ol></fieldset></li>
42
            [% SWITCH st %]
43
                [% CASE 'numberlength'%]
44
                    [% IF st == subtype %]
45
                        <option value="issues" selected="selected">
46
                    [% ELSE %]
47
                        <option value="issues">
48
                    [% END %]
49
                    issues
50
                [% CASE 'weeklength' %]
51
                    [% IF st == subtype %]
52
                        <option value="weeks" selected="selected">
53
                    [% ELSE %]
54
                        <option value="weeks">
55
                    [% END %]
56
                    weeks
57
                [% CASE 'monthlength' %]
58
                    [% IF st == subtype %]
59
                        <option value="months" selected="selected">
60
                    [% ELSE %]
61
                        <option value="months">
62
                    [% END %]
63
                    months
64
                [% CASE %][% st %]
65
            [% END %]
66
            </option>
67
        [% END %]
68
    </select>
69
    <input type="text" name="sublength" id="sublength" value="[% sublength | html %]" size="3" />(enter amount in numerals)
70
    <input type="hidden" name="issuelengthcount">
71
    </li>
43
72
44
<li><label for="branchcode">Library:</label>
73
    <li><label for="branchcode">Library:</label>
45
 <select name="branchcode" id="branchcode" style="width: 20em;">
74
    <select name="branchcode" id="branchcode" style="width: 20em;">
46
     [% UNLESS ( Independentbranches ) %]
75
        [% UNLESS ( Independentbranches ) %]
47
        <option value="">None</option>
76
            <option value="">None</option>
48
     [% END %]
77
        [% END %]
49
     [% IF CAN_user_serials_superserials %]
78
        [% IF CAN_user_serials_superserials %]
50
        [% FOREACH library IN libraries %]
79
            [% FOREACH library IN libraries %]
51
             <option value="[% library.branchcode | html %]"> [% library.branchname | html %] </option>
80
                <option value="[% library.branchcode | html %]"> [% library.branchname | html %] </option>
81
            [% END %]
52
        [% END %]
82
        [% END %]
53
     [% END %]
83
    </select> (select a library)
54
</select> (select a library)
84
    </li>
55
</li>
56
85
57
		<li><label for="note">Note for the librarian that will manage your renewal request: </label>
86
    <li><label for="note">Note for the librarian that will manage your renewal request: </label>
58
		<textarea name="note" id="note" rows="5" cols="50"></textarea></li></ol></fieldset>
87
		<textarea name="note" id="note" rows="5" cols="50"></textarea></li></ol></fieldset>
59
		<fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
88
		<fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
60
</form>
89
</form>
(-)a/serials/subscription-add.pl (-13 / +3 lines)
Lines 265-280 sub get_letter_loop { Link Here
265
    ];
265
    ];
266
}
266
}
267
267
268
sub _get_sub_length {
269
    my ($type, $length) = @_;
270
    return
271
        (
272
            $type eq 'issues' ? $length : 0,
273
            $type eq 'weeks'   ? $length : 0,
274
            $type eq 'months'  ? $length : 0,
275
        );
276
}
277
278
sub _guess_enddate {
268
sub _guess_enddate {
279
    my ($startdate_iso, $frequencyid, $numberlength, $weeklength, $monthlength) = @_;
269
    my ($startdate_iso, $frequencyid, $numberlength, $weeklength, $monthlength) = @_;
280
    my ($year, $month, $day);
270
    my ($year, $month, $day);
Lines 330-336 sub redirect_add_subscription { Link Here
330
    my $subtype = $query->param('subtype');
320
    my $subtype = $query->param('subtype');
331
    my $sublength = $query->param('sublength');
321
    my $sublength = $query->param('sublength');
332
    my ( $numberlength, $weeklength, $monthlength )
322
    my ( $numberlength, $weeklength, $monthlength )
333
        = _get_sub_length( $subtype, $sublength );
323
        = C4::Serials->_get_sub_length( $subtype, $sublength );
334
    my $add1              = $query->param('add1');
324
    my $add1              = $query->param('add1');
335
    my $lastvalue1        = $query->param('lastvalue1');
325
    my $lastvalue1        = $query->param('lastvalue1');
336
    my $innerloop1        = $query->param('innerloop1');
326
    my $innerloop1        = $query->param('innerloop1');
Lines 443-450 sub redirect_mod_subscription { Link Here
443
433
444
    my $subtype = $query->param('subtype');
434
    my $subtype = $query->param('subtype');
445
    my $sublength = $query->param('sublength');
435
    my $sublength = $query->param('sublength');
446
    my ($numberlength, $weeklength, $monthlength)
436
    my ($numberlength, $weeklength, $monthlength) = C4::Serials->get_sub_length( $subtype, $sublength );
447
        = _get_sub_length( $subtype, $sublength );
437
    my $numberpattern = $query->param('numbering_pattern');
448
    my $locale = $query->param('locale');
438
    my $locale = $query->param('locale');
449
    my $lastvalue1 = $query->param('lastvalue1');
439
    my $lastvalue1 = $query->param('lastvalue1');
450
    my $innerloop1 = $query->param('innerloop1');
440
    my $innerloop1 = $query->param('innerloop1');
(-)a/serials/subscription-renew.pl (-1 / +4 lines)
Lines 62-67 my $mode = $query->param('mode') || q{}; Link Here
62
my $op             = $query->param('op') || 'display';
62
my $op             = $query->param('op') || 'display';
63
my @subscriptionids = $query->multi_param('subscriptionid');
63
my @subscriptionids = $query->multi_param('subscriptionid');
64
my $branchcode     = $query->param('branchcode');
64
my $branchcode     = $query->param('branchcode');
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
    {
68
- 

Return to bug 7046