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
<span>issues</span>
4
[% ELSIF (stl_name) == 'weeklength' %]
5
<span>weeks</span>
6
[% ELSIF (stl_name) == 'monthlength' %]
7
<span>months</span>
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/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt (-1 / +1 lines)
Lines 218-224 function show_blocking_subs() { Link Here
218
                  <label for="sublength">Subscription length:</label>
218
                  <label for="sublength">Subscription length:</label>
219
                  <select id="subtype">
219
                  <select id="subtype">
220
                    [% FOREACH subtype IN subtypes_loop %]
220
                    [% FOREACH subtype IN subtypes_loop %]
221
                      <option value="[% subtype.value %]">[% subtype.value %]</option>
221
                      <option value="[% subtype.value %]">[% INCLUDE serials/showSubscriptionLengthType.inc stl_name=subtype.value %]</option>
222
                    [% END %]
222
                    [% END %]
223
                  </select>
223
                  </select>
224
                  <input type="text" id="sublength" size="3" />
224
                  <input type="text" id="sublength" size="3" />
(-)a/serials/showpredictionpattern.pl (-4 / +4 lines)
Lines 149-159 while( $i < 1000 ) { Link Here
149
149
150
    # Check if we don't have exceed end date
150
    # Check if we don't have exceed end date
151
    if($sublength){
151
    if($sublength){
152
        if($subtype eq "issues" && $i >= $sublength){
152
        if($subtype eq "numberlength" && $i >= $sublength){
153
            last;
153
            last;
154
        } elsif($subtype eq "weeks" && $date && Delta_Days( split(/-/, $date), Add_Delta_Days( split(/-/, $firstacquidate), 7*$sublength - 1 ) ) < 0) {
154
        } elsif($subtype eq "weeklength" && $date && Delta_Days( split(/-/, $date), Add_Delta_Days( split(/-/, $firstacquidate), 7*$sublength - 1 ) ) < 0) {
155
            last;
155
            last;
156
        } elsif($subtype eq "months" && $date && (Delta_Days( split(/-/, $date), Add_Delta_YM( split(/-/, $firstacquidate), 0, $sublength) ) - 1) < 0 ) {
156
        } elsif($subtype eq "monthlength" && $date && (Delta_Days( split(/-/, $date), Add_Delta_YM( split(/-/, $firstacquidate), 0, $sublength) ) - 1) < 0 ) {
157
            last;
157
            last;
158
        }
158
        }
159
    }
159
    }
Lines 186-192 if ( $frequency->{unit} and not $custompattern ) { Link Here
186
}
186
}
187
187
188
if (   ( $date && $enddate && $date ne $enddate )
188
if (   ( $date && $enddate && $date ne $enddate )
189
    or ( $subtype eq 'issues' && $i < $sublength ) )
189
    or ( $subtype eq 'numberlength' && $i < $sublength ) )
190
{
190
{
191
    $template->param( not_consistent_end_date => 1 );
191
    $template->param( not_consistent_end_date => 1 );
192
}
192
}
(-)a/serials/subscription-add.pl (-8 / +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);
(-)a/serials/subscription-numberpatterns.pl (-2 / +1 lines)
Lines 104-110 if($op && ($op eq 'new' || $op eq 'modify')) { Link Here
104
    }
104
    }
105
    my @frequencies = GetSubscriptionFrequencies();
105
    my @frequencies = GetSubscriptionFrequencies();
106
    my @subtypes;
106
    my @subtypes;
107
    push @subtypes, { value => $_ } for (qw/ issues weeks months /);
107
    push @subtypes, { value => $_ } for (qw/ numberlength weeklength monthlength/);
108
108
109
    my $languages = [ map {
109
    my $languages = [ map {
110
        {
110
        {
111
- 

Return to bug 13471