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

(-)a/C4/Serials.pm (+18 lines)
Lines 1453-1458 sub NewSubscription { Link Here
1453
    return $subscriptionid;
1453
    return $subscriptionid;
1454
}
1454
}
1455
1455
1456
=head2 _get_sub_length
1457
my ($numberlength, $weeklength, $monthlength) = _get_sub_length( $subtype, $sublength );
1458
1459
this function calculates the subscription length.
1460
1461
=cut
1462
1463
sub _get_sub_length {
1464
    my ($type, $subtype, $length) = @_;
1465
    return
1466
    (
1467
          $subtype eq 'issues' ? $length : 0,
1468
          $subtype eq 'weeks'   ? $length : 0,
1469
          $subtype eq 'months'  ? $length : 0,
1470
    );
1471
}
1472
1473
1456
=head2 ReNewSubscription
1474
=head2 ReNewSubscription
1457
1475
1458
ReNewSubscription($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note)
1476
ReNewSubscription($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt (-3 / +32 lines)
Lines 37-45 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 %]" size="3" />(enter amount in numerals)
70
    <input type="hidden" name="issuelengthcount">
71
    </li>
43
		<li><label for="note">Note for the librarian that will manage your renewal request: </label>
72
		<li><label for="note">Note for the librarian that will manage your renewal request: </label>
44
		<textarea name="note" id="note" rows="5" cols="50"></textarea></li></ol></fieldset>
73
		<textarea name="note" id="note" rows="5" cols="50"></textarea></li></ol></fieldset>
45
		<fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
74
		<fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
(-)a/serials/subscription-add.pl (-12 / +2 lines)
Lines 250-265 sub get_letter_loop { Link Here
250
    ];
250
    ];
251
}
251
}
252
252
253
sub _get_sub_length {
254
    my ($type, $length) = @_;
255
    return
256
        (
257
            $type eq 'issues' ? $length : 0,
258
            $type eq 'weeks'   ? $length : 0,
259
            $type eq 'months'  ? $length : 0,
260
        );
261
}
262
263
sub _guess_enddate {
253
sub _guess_enddate {
264
    my ($startdate_iso, $frequencyid, $numberlength, $weeklength, $monthlength) = @_;
254
    my ($startdate_iso, $frequencyid, $numberlength, $weeklength, $monthlength) = @_;
265
    my ($year, $month, $day);
255
    my ($year, $month, $day);
Lines 303-309 sub redirect_add_subscription { Link Here
303
    my $subtype = $query->param('subtype');
293
    my $subtype = $query->param('subtype');
304
    my $sublength = $query->param('sublength');
294
    my $sublength = $query->param('sublength');
305
    my ( $numberlength, $weeklength, $monthlength )
295
    my ( $numberlength, $weeklength, $monthlength )
306
        = _get_sub_length( $subtype, $sublength );
296
        = C4::Serials->_get_sub_length( $subtype, $sublength );
307
    my $add1              = $query->param('add1');
297
    my $add1              = $query->param('add1');
308
    my $lastvalue1        = $query->param('lastvalue1');
298
    my $lastvalue1        = $query->param('lastvalue1');
309
    my $innerloop1        = $query->param('innerloop1');
299
    my $innerloop1        = $query->param('innerloop1');
Lines 381-387 sub redirect_mod_subscription { Link Here
381
    my $subtype = $query->param('subtype');
371
    my $subtype = $query->param('subtype');
382
    my $sublength = $query->param('sublength');
372
    my $sublength = $query->param('sublength');
383
    my ($numberlength, $weeklength, $monthlength)
373
    my ($numberlength, $weeklength, $monthlength)
384
        = _get_sub_length( $subtype, $sublength );
374
        = C4::Serials->_get_sub_length( $subtype, $sublength );
385
    my $numberpattern = $query->param('numbering_pattern');
375
    my $numberpattern = $query->param('numbering_pattern');
386
    my $locale = $query->param('locale');
376
    my $locale = $query->param('locale');
387
    my $lastvalue1 = $query->param('lastvalue1');
377
    my $lastvalue1 = $query->param('lastvalue1');
(-)a/serials/subscription-renew.pl (-4 / +7 lines)
Lines 61-66 my $dbh = C4::Context->dbh; Link Here
61
my $mode           = $query->param('mode') || q{};
61
my $mode           = $query->param('mode') || q{};
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 $sublength = $query->param('sublength');
65
my $subtype = $query->param('subtype');
66
my ($numberlength, $weeklength, $monthlength) = C4::Serials->_get_sub_length( $subtype, $sublength );
67
64
my $done = 0;    # for after form has been submitted
68
my $done = 0;    # for after form has been submitted
65
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
69
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
66
    {
70
    {
Lines 81-89 if ( $op eq "renew" ) { Link Here
81
    my $startdate = output_pref( { str => scalar $query->param('startdate'), dateonly => 1, dateformat => 'iso' } );
85
    my $startdate = output_pref( { str => scalar $query->param('startdate'), dateonly => 1, dateformat => 'iso' } );
82
    ReNewSubscription(
86
    ReNewSubscription(
83
        $subscriptionid, $loggedinuser,
87
        $subscriptionid, $loggedinuser,
84
        $startdate, scalar $query->param('numberlength'),
88
        $startdate, $numberlength,
85
        scalar $query->param('weeklength'), scalar $query->param('monthlength'),
89
        $weeklength, $monthlength,
86
        scalar $query->param('note')
90
        $query->param('note')
87
    );
91
    );
88
} elsif ( $op eq 'multi_renew' ) {
92
} elsif ( $op eq 'multi_renew' ) {
89
    for my $subscriptionid ( @subscriptionids ) {
93
    for my $subscriptionid ( @subscriptionids ) {
90
- 

Return to bug 7046