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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/showSubscriptionLengthType.inc (+8 lines)
Line 0 Link Here
1
[%# This template must receive a parameter stl_name, containing the name of the subscription length type, either 'monthlength', 'numberlength' or 'weeklength'.Eg. "\[% INCLUDE showSubscriptionLengthType stl_name=subt.name %\]" %]
2
[% IF (stl_name) == 'numberlength' %]
3
issues
4
[% ELSIF (stl_name) == 'weeklength' %]
5
weeks
6
[% ELSIF (stl_name) == 'monthlength' %]
7
months
8
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-1 / +1 lines)
Lines 658-664 $(document).ready(function() { Link Here
658
                                                [% ELSE %]
658
                                                [% ELSE %]
659
                                                    <option value="[% subt.name %]">
659
                                                    <option value="[% subt.name %]">
660
                                                [% END %]
660
                                                [% END %]
661
                                                    [% subt.name %]
661
                                                    [% INCLUDE serials/showSubscriptionLengthType.inc stl_name=subt.name %]
662
                                                </option>
662
                                                </option>
663
                                            [% END %]
663
                                            [% END %]
664
                                        </select>
664
                                        </select>
(-)a/serials/subscription-add.pl (-9 / +7 lines)
Lines 59-65 my ($template, $loggedinuser, $cookie) Link Here
59
59
60
60
61
my $sub_on;
61
my $sub_on;
62
my @subscription_types = (qw(issues weeks months));
62
my @subscription_types = (qw(numberlength weeklength monthlength)); #These are the same as the koha.subscription-columns
63
my @sub_type_data;
63
my @sub_type_data;
64
64
65
my $subs;
65
my $subs;
Lines 92-98 if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { Link Here
92
    $nextexpected->{'isfirstissue'} = $nextexpected->{planneddate} eq $firstissuedate ;
92
    $nextexpected->{'isfirstissue'} = $nextexpected->{planneddate} eq $firstissuedate ;
93
    $subs->{nextacquidate} = $nextexpected->{planneddate}  if($op eq 'modify');
93
    $subs->{nextacquidate} = $nextexpected->{planneddate}  if($op eq 'modify');
94
    unless($op eq 'modsubscription') {
94
    unless($op eq 'modsubscription') {
95
        foreach my $length_unit (qw(numberlength weeklength monthlength)) {
95
        foreach my $length_unit (@subscription_types) {
96
            if ($subs->{$length_unit}) {
96
            if ($subs->{$length_unit}) {
97
                $sub_length=$subs->{$length_unit};
97
                $sub_length=$subs->{$length_unit};
98
                $sub_on=$length_unit;
98
                $sub_on=$length_unit;
Lines 103-109 if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { Link Here
103
        $template->param( %{$subs} );
103
        $template->param( %{$subs} );
104
        $template->param(
104
        $template->param(
105
                    $op => 1,
105
                    $op => 1,
106
                    "subtype_$sub_on" => 1,
107
                    sublength =>$sub_length,
106
                    sublength =>$sub_length,
108
                    history => ($op eq 'modify'),
107
                    history => ($op eq 'modify'),
109
                    firstacquiyear => substr($firstissuedate,0,4),
108
                    firstacquiyear => substr($firstissuedate,0,4),
Lines 250-258 sub _get_sub_length { Link Here
250
    my ($type, $length) = @_;
249
    my ($type, $length) = @_;
251
    return
250
    return
252
        (
251
        (
253
            $type eq 'issues' ? $length : 0,
252
            $type eq 'numberlength' ? $length : 0,
254
            $type eq 'weeks'   ? $length : 0,
253
            $type eq 'weeklength'   ? $length : 0,
255
            $type eq 'months'  ? $length : 0,
254
            $type eq 'monthlength'  ? $length : 0,
256
        );
255
        );
257
}
256
}
258
257
Lines 323-329 sub redirect_add_subscription { Link Here
323
    my $enddate = format_date_in_iso( $query->param('enddate') );
322
    my $enddate = format_date_in_iso( $query->param('enddate') );
324
    my $firstacquidate  = format_date_in_iso($query->param('firstacquidate'));
323
    my $firstacquidate  = format_date_in_iso($query->param('firstacquidate'));
325
    if(!defined $enddate || $enddate eq '') {
324
    if(!defined $enddate || $enddate eq '') {
326
        if($subtype eq "issues") {
325
        if($subtype eq "numberlength") {
327
            $enddate = _guess_enddate($firstacquidate, $periodicity, $numberlength, $weeklength, $monthlength);
326
            $enddate = _guess_enddate($firstacquidate, $periodicity, $numberlength, $weeklength, $monthlength);
328
        } else {
327
        } else {
329
            $enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength);
328
            $enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength);
Lines 390-396 sub redirect_mod_subscription { Link Here
390
389
391
    # Guess end date
390
    # Guess end date
392
    if(!defined $enddate || $enddate eq '') {
391
    if(!defined $enddate || $enddate eq '') {
393
        if($subtype eq "issues") {
392
        if($subtype eq "numberlength") {
394
            $enddate = _guess_enddate($nextacquidate, $periodicity, $numberlength, $weeklength, $monthlength);
393
            $enddate = _guess_enddate($nextacquidate, $periodicity, $numberlength, $weeklength, $monthlength);
395
        } else {
394
        } else {
396
            $enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength);
395
            $enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength);
397
- 

Return to bug 13471