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

(-)a/C4/Serials.pm (-2 / +2 lines)
Lines 2713-2721 sub findSerialsByStatus { Link Here
2713
    return @$serials;
2713
    return @$serials;
2714
}
2714
}
2715
2715
2716
=head2 GessEnddate
2716
=head2 GuessEnddate
2717
2717
2718
my $enddate = GessEnddate($startdate_iso $frequencyid, $numberlength, $weeklength, $monthlength);
2718
my $enddate = GuessEnddate($startdate_iso $frequencyid, $numberlength, $weeklength, $monthlength);
2719
2719
2720
=cut
2720
=cut
2721
2721
(-)a/Koha/Subscription.pm (-2 / +2 lines)
Lines 72-84 sub permanent_irregularities { Link Here
72
    return split(';', $self->permanent_irregularity);
72
    return split(';', $self->permanent_irregularity);
73
}
73
}
74
74
75
=head3 subtype
75
=head3 lengthtype
76
76
77
Return the length type (issues, weeks, months)
77
Return the length type (issues, weeks, months)
78
78
79
=cut
79
=cut
80
80
81
sub subtype {
81
sub lengthtype {
82
    my ($self) = @_;
82
    my ($self) = @_;
83
83
84
    if ($self->numberlength) {
84
    if ($self->numberlength) {
(-)a/installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.perl (+9 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    if( !column_exists( 'subscription', 'permanent_irregularity' ) ) {
4
        $dbh->do( "ALTER TABLE `subscription` ADD permanent_irregularity text AFTER irregularity" );
5
    }
6
7
    SetVersion( $DBversion );
8
    print "Upgrade to $DBversion done (Bug 17656 - Irregularities in serial prediction pattern are planned only for current subscription)\n";
9
}
(-)a/installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.sql (-1 lines)
Line 1 Link Here
1
ALTER TABLE `subscription` ADD permanent_irregularity text AFTER irregularity;
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2095-2100 CREATE TABLE `subscription` ( -- information related to the subscription Link Here
2095
  `firstacquidate` date default NULL, -- first issue received date
2095
  `firstacquidate` date default NULL, -- first issue received date
2096
  `manualhistory` tinyint(1) NOT NULL default 0, -- yes or no to managing the history manually
2096
  `manualhistory` tinyint(1) NOT NULL default 0, -- yes or no to managing the history manually
2097
  `irregularity` text, -- any irregularities in the subscription
2097
  `irregularity` text, -- any irregularities in the subscription
2098
  `permanent_irregularity` text,
2098
  skip_serialseq BOOLEAN NOT NULL DEFAULT 0,
2099
  skip_serialseq BOOLEAN NOT NULL DEFAULT 0,
2099
  `letter` varchar(20) default NULL,
2100
  `letter` varchar(20) default NULL,
2100
  `numberpattern` integer default null, -- the numbering pattern used links to subscription_numberpatterns.id
2101
  `numberpattern` integer default null, -- the numbering pattern used links to subscription_numberpatterns.id
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_daily_choice.inc (-1 / +13 lines)
Lines 4-9 Link Here
4
</em></p>
4
</em></p>
5
[% daily_choice = [ {name => 'monday', desc => 'Monday', value => 1}, {name => 'tuesday', desc => 'Tuesday', value => 2}, {name => 'wednesday', desc => 'Wednesday', value => 3}, {name => 'thursday', desc => 'Thursday', value => 4}, {name => 'friday', desc => 'Friday', value => 5}, {name => 'saturday', desc => 'Saturday', value => 6}, {name => 'sunday', desc => 'Sunday', value => 7} ] %]
5
[% daily_choice = [ {name => 'monday', desc => 'Monday', value => 1}, {name => 'tuesday', desc => 'Tuesday', value => 2}, {name => 'wednesday', desc => 'Wednesday', value => 3}, {name => 'thursday', desc => 'Thursday', value => 4}, {name => 'friday', desc => 'Friday', value => 5}, {name => 'saturday', desc => 'Saturday', value => 6}, {name => 'sunday', desc => 'Sunday', value => 7} ] %]
6
6
7
[% BLOCK days %]
8
    [% SWITCH d %]
9
        [% CASE 'monday' %]Monday
10
        [% CASE 'tuesday' %]Tuesday
11
        [% CASE 'wednesday' %]Wednesday
12
        [% CASE 'thursday' %]Thursday
13
        [% CASE 'friday' %]Friday
14
        [% CASE 'saturday' %]Saturday
15
        [% CASE 'sunday' %]Sunday
16
    [% END %]
17
[% END %]
18
7
[% FOREACH day IN daily_choice %]
19
[% FOREACH day IN daily_choice %]
8
    [% IF permanent_irreg.grep( day.value ).0 == day.value %]
20
    [% IF permanent_irreg.grep( day.value ).0 == day.value %]
9
        <input type="checkbox" name="permanent_irregularity"
21
        <input type="checkbox" name="permanent_irregularity"
Lines 17-21 Link Here
17
               value="[% day.value %]" class="skip"
29
               value="[% day.value %]" class="skip"
18
        />
30
        />
19
    [% END %]
31
    [% END %]
20
    <label for="[% day.name %]">[% day.desc %]</label>
32
    <label for="[% day.name %]">[% PROCESS days d=day.name %]</label>
21
[% END %]
33
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_monthly_choice.inc (-1 / +18 lines)
Lines 4-9 Link Here
4
</em></p>
4
</em></p>
5
[% monthly_choice = [ {name => 'january', desc => 'January', value => 1}, {name => 'february', desc => 'February', value => 2}, {name => 'march', desc => 'March', value => 3}, {name => 'april', desc => 'April', value => 4}, {name => 'may', desc => 'May', value => 5}, {name => 'june', desc => 'June', value => 6}, {name => 'july', desc => 'July', value => 7}, {name => 'august', desc => 'August', value => 8}, {name => 'september', desc => 'September', value => 9}, {name => 'october', desc => 'October', value => 10}, {name => 'november', desc => 'November', value => 11}, {name => 'december', desc => 'December', value =>12} ] %]
5
[% monthly_choice = [ {name => 'january', desc => 'January', value => 1}, {name => 'february', desc => 'February', value => 2}, {name => 'march', desc => 'March', value => 3}, {name => 'april', desc => 'April', value => 4}, {name => 'may', desc => 'May', value => 5}, {name => 'june', desc => 'June', value => 6}, {name => 'july', desc => 'July', value => 7}, {name => 'august', desc => 'August', value => 8}, {name => 'september', desc => 'September', value => 9}, {name => 'october', desc => 'October', value => 10}, {name => 'november', desc => 'November', value => 11}, {name => 'december', desc => 'December', value =>12} ] %]
6
6
7
[% BLOCK months %]
8
    [% SWITCH m %]
9
        [% CASE 'january' %]January
10
        [% CASE 'february' %]February
11
        [% CASE 'march' %]March
12
        [% CASE 'april' %]April
13
        [% CASE 'may' %]May
14
        [% CASE 'june' %]June
15
        [% CASE 'july' %]July
16
        [% CASE 'august' %]August
17
        [% CASE 'september' %]September
18
        [% CASE 'october' %]October
19
        [% CASE 'november' %]November
20
        [% CASE 'december' %]December
21
    [% END %]
22
[% END %]
23
7
[% FOREACH month IN monthly_choice %]
24
[% FOREACH month IN monthly_choice %]
8
    [% IF permanent_irreg.grep( month.value ).0 == month.value %]
25
    [% IF permanent_irreg.grep( month.value ).0 == month.value %]
9
        <input type="checkbox" name="permanent_irregularity"
26
        <input type="checkbox" name="permanent_irregularity"
Lines 17-21 Link Here
17
               value="[% month.value %]" class="skip"
34
               value="[% month.value %]" class="skip"
18
        />
35
        />
19
    [% END %]
36
    [% END %]
20
    <label for="[% month.name %]">[% month.desc %]</label>
37
    <label for="[% month.name %]">[% PROCESS months m=month.name %]</label>
21
[% END %]
38
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt (-1 / +1 lines)
Lines 29-35 Link Here
29
        <input type="hidden" id="nextacquidate" value="[% nextacquidate %]" />
29
        <input type="hidden" id="nextacquidate" value="[% nextacquidate %]" />
30
30
31
        <input type="hidden" id="to" value="[% enddate %]" />
31
        <input type="hidden" id="to" value="[% enddate %]" />
32
        <input type="hidden" id="subtype" value="[% subtype %]" />
32
        <input type="hidden" id="subtype" value="[% lengthtype %]" />
33
        <input type="hidden" id="sublength" value="[% sublength %]" />
33
        <input type="hidden" id="sublength" value="[% sublength %]" />
34
        <input type="hidden" id="numberingmethod" value="[% numberingmethod %]" />
34
        <input type="hidden" id="numberingmethod" value="[% numberingmethod %]" />
35
        <input type="hidden" id="lastvalue1" value="[% lastvalue1 %]" />
35
        <input type="hidden" id="lastvalue1" value="[% lastvalue1 %]" />
(-)a/serials/subscription-renew.pl (-2 / +2 lines)
Lines 108-114 if ($serials_number > 1) { Link Here
108
}
108
}
109
109
110
my $subscription_o = Koha::Subscriptions->find($subscription->{subscriptionid});
110
my $subscription_o = Koha::Subscriptions->find($subscription->{subscriptionid});
111
my $subtype = $subscription_o->subtype;
111
my $lengthtype = $subscription_o->lengthtype;
112
my $nextexpected = GetNextExpected($subscriptionid);
112
my $nextexpected = GetNextExpected($subscriptionid);
113
my $enddate = GuessEnddate($subscription->{enddate} || dt_from_string,
113
my $enddate = GuessEnddate($subscription->{enddate} || dt_from_string,
114
                             $subscription->{periodicity},
114
                             $subscription->{periodicity},
Lines 137-143 $template->param( Link Here
137
    firstacquidate  => $subscription->{firstacquidate},
137
    firstacquidate  => $subscription->{firstacquidate},
138
    nextacquidate   => $nextexpected->{planneddate},
138
    nextacquidate   => $nextexpected->{planneddate},
139
    enddate         => $enddate,
139
    enddate         => $enddate,
140
    subtype         => $subtype,
140
    lengthtype         => $lengthtype,
141
    sublength       => $sub_length,
141
    sublength       => $sub_length,
142
    numberingmethod => $numberpattern->{numberingmethod},
142
    numberingmethod => $numberpattern->{numberingmethod},
143
    lastvalue1      => $subscription->{lastvalue1},
143
    lastvalue1      => $subscription->{lastvalue1},
(-)a/t/Koha/DateUtils.t (-2 / +3 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 9;
20
use Test::More tests => 10;
21
use Test::Warn;
21
use Test::Warn;
22
22
23
BEGIN {
23
BEGIN {
Lines 27-32 BEGIN { Link Here
27
my $dt = DateTime->new(year => 2017, month => 1, day => 1);
27
my $dt = DateTime->new(year => 2017, month => 1, day => 1);
28
28
29
eval { issue_number('2017', 'day'); };
29
eval { issue_number('2017', 'day'); };
30
is(ref($@), 'Koha::Exceptions::WrongParameter');
30
is($@, 'Date passed to issue_number is not a valid DateTime object');
31
is($@, 'Date passed to issue_number is not a valid DateTime object');
31
32
32
is(issue_number($dt, 'day'), 7, '2017-01-01 is the seventh day of week');
33
is(issue_number($dt, 'day'), 7, '2017-01-01 is the seventh day of week');
Lines 41-46 is(issue_number($dt, 'day'), 6, '2022-09-17 is the sixth day of week'); Link Here
41
42
42
is(issue_number($dt, 'week'), 37, '2022-09-17 is the week #37 of the year');
43
is(issue_number($dt, 'week'), 37, '2022-09-17 is the week #37 of the year');
43
44
44
is(issue_number($dt, 'month'), 9, '2017-09-17 is the ninth month of the year');
45
is(issue_number($dt, 'month'), 9, '2022-09-17 is the ninth month of the year');
45
46
46
is(issue_number($dt, 'foo'), 0, 'issue_number return 0 for others issue type');
47
is(issue_number($dt, 'foo'), 0, 'issue_number return 0 for others issue type');
(-)a/t/db_dependent/Koha/Subscription.t (-5 / +4 lines)
Lines 42-48 subtest 'Koha::Subscription::biblio' => sub { Link Here
42
    is($b->biblionumber, $biblio->biblionumber, 'Koha::Subscription::biblio returns the correct biblio');
42
    is($b->biblionumber, $biblio->biblionumber, 'Koha::Subscription::biblio returns the correct biblio');
43
};
43
};
44
44
45
subtest 'Koha::Subscription::subtype' => sub {
45
subtest 'Koha::Subscription::lengthtype' => sub {
46
    plan tests => 3;
46
    plan tests => 3;
47
47
48
    my $subs = $builder->build({
48
    my $subs = $builder->build({
Lines 54-60 subtest 'Koha::Subscription::subtype' => sub { Link Here
54
        }
54
        }
55
    });
55
    });
56
    my $subscription = Koha::Subscriptions->find($subs->{subscriptionid});
56
    my $subscription = Koha::Subscriptions->find($subs->{subscriptionid});
57
    is($subscription->subtype, 'issues', 'Subscription with numberlength has issues type');
57
    is($subscription->lengthtype, 'issues', 'Subscription with numberlength has issues type');
58
58
59
    my $subs2 = $builder->build({
59
    my $subs2 = $builder->build({
60
        source => 'Subscription',
60
        source => 'Subscription',
Lines 65-71 subtest 'Koha::Subscription::subtype' => sub { Link Here
65
        }
65
        }
66
    });
66
    });
67
    my $subscription2 = Koha::Subscriptions->find($subs2->{subscriptionid});
67
    my $subscription2 = Koha::Subscriptions->find($subs2->{subscriptionid});
68
    is($subscription2->subtype, 'weeks', 'Subscription with weeklength has weeks type');
68
    is($subscription2->lengthtype, 'weeks', 'Subscription with weeklength has weeks type');
69
69
70
    my $subs3 = $builder->build({
70
    my $subs3 = $builder->build({
71
        source => 'Subscription',
71
        source => 'Subscription',
Lines 76-82 subtest 'Koha::Subscription::subtype' => sub { Link Here
76
        }
76
        }
77
    });
77
    });
78
    my $subscription3 = Koha::Subscriptions->find($subs3->{subscriptionid});
78
    my $subscription3 = Koha::Subscriptions->find($subs3->{subscriptionid});
79
    is($subscription3->subtype, 'months', 'Subscription with monthlength has months type');
79
    is($subscription3->lengthtype, 'months', 'Subscription with monthlength has months type');
80
};
80
};
81
81
82
$schema->storage->txn_rollback;
82
$schema->storage->txn_rollback;
83
- 

Return to bug 17656