Bugzilla – Attachment 75723 Details for
Bug 17656
Irregularities in serial prediction pattern are planned only for current subscription
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17656 - Fix QA comments - Make day and month names translatable, - Update unit tests, - Fix a typo in C4/Serials.pm (GessEndDate), - rename subtype subroutine to lengthtype - DB Change: add changes in kohastructure.sql and Bug_17656-add-permanent-irre
Bug-17656---Fix-QA-comments---Make-day-and-month-n.patch (text/plain), 12.17 KB, created by
Alex Arnaud
on 2018-06-01 08:05:14 UTC
(
hide
)
Description:
Bug 17656 - Fix QA comments - Make day and month names translatable, - Update unit tests, - Fix a typo in C4/Serials.pm (GessEndDate), - rename subtype subroutine to lengthtype - DB Change: add changes in kohastructure.sql and Bug_17656-add-permanent-irre
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2018-06-01 08:05:14 UTC
Size:
12.17 KB
patch
obsolete
>From 02994591f6394be86bd5c71c9998df649723f2ca Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Thu, 11 Jan 2018 14:08:25 +0000 >Subject: [PATCH] Bug 17656 - Fix QA comments - Make day and month names > translatable, - Update unit tests, - Fix a typo in C4/Serials.pm > (GessEndDate), - rename subtype subroutine to lengthtype - DB Change: add > changes in kohastructure.sql and Bug_17656-add-permanent-irregularities.perl > >--- > C4/Serials.pm | 4 ++-- > Koha/Subscription.pm | 4 ++-- > .../Bug_17656-add-permanent-irregularities.perl | 9 +++++++++ > .../Bug_17656-add-permanent-irregularities.sql | 1 - > installer/data/mysql/kohastructure.sql | 1 + > .../en/includes/serials/subscription_daily_choice.inc | 14 +++++++++++++- > .../includes/serials/subscription_monthly_choice.inc | 19 ++++++++++++++++++- > .../prog/en/modules/serials/subscription-renew.tt | 2 +- > serials/subscription-renew.pl | 5 ++--- > t/Koha/DateUtils.t | 5 +++-- > t/db_dependent/Koha/Subscription.t | 8 ++++---- > 11 files changed, 55 insertions(+), 17 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.perl > delete mode 100644 installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.sql > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index e6aec3c..b828f4b 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -2716,9 +2716,9 @@ sub findSerialsByStatus { > return @$serials; > } > >-=head2 GessEnddate >+=head2 GuessEnddate > >-my $enddate = GessEnddate($startdate_iso $frequencyid, $numberlength, $weeklength, $monthlength); >+my $enddate = GuessEnddate($startdate_iso $frequencyid, $numberlength, $weeklength, $monthlength); > > =cut > >diff --git a/Koha/Subscription.pm b/Koha/Subscription.pm >index 40b2ae0..f00e88c 100644 >--- a/Koha/Subscription.pm >+++ b/Koha/Subscription.pm >@@ -130,13 +130,13 @@ sub permanent_irregularities { > return split(';', $self->permanent_irregularity); > } > >-=head3 subtype >+=head3 lengthtype > > Return the length type (issues, weeks, months) > > =cut > >-sub subtype { >+sub lengthtype { > my ($self) = @_; > > if ($self->numberlength) { >diff --git a/installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.perl b/installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.perl >new file mode 100644 >index 0000000..fb6314d >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.perl >@@ -0,0 +1,9 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ if( !column_exists( 'subscription', 'permanent_irregularity' ) ) { >+ $dbh->do( "ALTER TABLE `subscription` ADD permanent_irregularity MEDIUMTEXT AFTER irregularity" ); >+ } >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 17656 - Irregularities in serial prediction pattern are planned only for current subscription)\n"; >+} >diff --git a/installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.sql b/installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.sql >deleted file mode 100644 >index cb9cd1d..0000000 >--- a/installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.sql >+++ /dev/null >@@ -1 +0,0 @@ >-ALTER TABLE `subscription` ADD permanent_irregularity text AFTER irregularity; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 909eda2..f219c3d 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2091,6 +2091,7 @@ CREATE TABLE `subscription` ( -- information related to the subscription > `firstacquidate` date default NULL, -- first issue received date > `manualhistory` tinyint(1) NOT NULL default 0, -- yes or no to managing the history manually > `irregularity` MEDIUMTEXT, -- any irregularities in the subscription >+ `permanent_irregularity` MEDIUMTEXT, > skip_serialseq BOOLEAN NOT NULL DEFAULT 0, > `letter` varchar(20) default NULL, > `numberpattern` integer default null, -- the numbering pattern used links to subscription_numberpatterns.id >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_daily_choice.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_daily_choice.inc >index 4e1688d..cf6f63e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_daily_choice.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_daily_choice.inc >@@ -4,6 +4,18 @@ > </em></p> > [% 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} ] %] > >+[% BLOCK days %] >+ [% SWITCH d %] >+ [% CASE 'monday' %]Monday >+ [% CASE 'tuesday' %]Tuesday >+ [% CASE 'wednesday' %]Wednesday >+ [% CASE 'thursday' %]Thursday >+ [% CASE 'friday' %]Friday >+ [% CASE 'saturday' %]Saturday >+ [% CASE 'sunday' %]Sunday >+ [% END %] >+[% END %] >+ > [% FOREACH day IN daily_choice %] > [% IF permanent_irreg.grep( day.value ).0 == day.value %] > <input type="checkbox" name="permanent_irregularity" >@@ -17,5 +29,5 @@ > value="[% day.value %]" class="skip" > /> > [% END %] >- <label for="[% day.name %]">[% day.desc %]</label> >+ <label for="[% day.name %]">[% PROCESS days d=day.name %]</label> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_monthly_choice.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_monthly_choice.inc >index 29bf9fd..fde9b60 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_monthly_choice.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_monthly_choice.inc >@@ -4,6 +4,23 @@ > </em></p> > [% 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} ] %] > >+[% BLOCK months %] >+ [% SWITCH m %] >+ [% CASE 'january' %]January >+ [% CASE 'february' %]February >+ [% CASE 'march' %]March >+ [% CASE 'april' %]April >+ [% CASE 'may' %]May >+ [% CASE 'june' %]June >+ [% CASE 'july' %]July >+ [% CASE 'august' %]August >+ [% CASE 'september' %]September >+ [% CASE 'october' %]October >+ [% CASE 'november' %]November >+ [% CASE 'december' %]December >+ [% END %] >+[% END %] >+ > [% FOREACH month IN monthly_choice %] > [% IF permanent_irreg.grep( month.value ).0 == month.value %] > <input type="checkbox" name="permanent_irregularity" >@@ -17,5 +34,5 @@ > value="[% month.value %]" class="skip" > /> > [% END %] >- <label for="[% month.name %]">[% month.desc %]</label> >+ <label for="[% month.name %]">[% PROCESS months m=month.name %]</label> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt >index 7816cc7..723bde0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt >@@ -32,7 +32,7 @@ > <input type="hidden" id="nextacquidate" value="[% nextacquidate %]" /> > > <input type="hidden" id="to" value="[% enddate %]" /> >- <input type="hidden" id="subtype" value="[% subtype %]" /> >+ <input type="hidden" id="subtype" value="[% lengthtype %]" /> > <input type="hidden" id="sublength" value="[% sublength %]" /> > <input type="hidden" id="numberingmethod" value="[% numberpattern.numberingmethod %]" /> > <input type="hidden" id="lastvalue1" value="[% subscription.lastvalue1 %]" /> >diff --git a/serials/subscription-renew.pl b/serials/subscription-renew.pl >index 9bd24f6..602461c 100755 >--- a/serials/subscription-renew.pl >+++ b/serials/subscription-renew.pl >@@ -119,7 +119,7 @@ if ( $op eq "renew" ) { > } > > my $subscription_o = Koha::Subscriptions->find($subscription->{subscriptionid}); >- my $subtype = $subscription_o->subtype; >+ my $lengthtype = $subscription_o->lengthtype; > my $nextexpected = GetNextExpected($subscriptionid); > my $enddate = GuessEnddate($subscription->{enddate} || dt_from_string, > $subscription->{periodicity}, >@@ -144,14 +144,13 @@ if ( $op eq "renew" ) { > startdate => $newstartdate, > nextacquidate => $nextexpected->{planneddate}, > enddate => $enddate, >- subtype => $subtype, >+ lengthtype => $lengthtype, > sublength => $sub_length, > ); > } > > $template->param( > op => $op, >- #$op => 1, > popup => ($mode eq 'popup'), > ); > >diff --git a/t/Koha/DateUtils.t b/t/Koha/DateUtils.t >index f0af15c..fa47c0d 100644 >--- a/t/Koha/DateUtils.t >+++ b/t/Koha/DateUtils.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 9; >+use Test::More tests => 10; > use Test::Warn; > > BEGIN { >@@ -27,6 +27,7 @@ BEGIN { > my $dt = DateTime->new(year => 2017, month => 1, day => 1); > > eval { issue_number('2017', 'day'); }; >+is(ref($@), 'Koha::Exceptions::WrongParameter'); > is($@, 'Date passed to issue_number is not a valid DateTime object'); > > is(issue_number($dt, 'day'), 7, '2017-01-01 is the seventh day of week'); >@@ -41,6 +42,6 @@ is(issue_number($dt, 'day'), 6, '2022-09-17 is the sixth day of week'); > > is(issue_number($dt, 'week'), 37, '2022-09-17 is the week #37 of the year'); > >-is(issue_number($dt, 'month'), 9, '2017-09-17 is the ninth month of the year'); >+is(issue_number($dt, 'month'), 9, '2022-09-17 is the ninth month of the year'); > > is(issue_number($dt, 'foo'), 0, 'issue_number return 0 for others issue type'); >diff --git a/t/db_dependent/Koha/Subscription.t b/t/db_dependent/Koha/Subscription.t >index d9700bc..2d9e096 100644 >--- a/t/db_dependent/Koha/Subscription.t >+++ b/t/db_dependent/Koha/Subscription.t >@@ -90,7 +90,7 @@ subtest 'Koha::Subscription->vendor' => sub { > is( $object->vendor->id, $subscription->{aqbooksellerid}, 'Koha::Subscription->vendor should return the correct vendor' ); > }; > >-subtest 'Koha::Subscription::subtype' => sub { >+subtest 'Koha::Subscription::lengthtype' => sub { > plan tests => 3; > > my $subs = $builder->build({ >@@ -102,7 +102,7 @@ subtest 'Koha::Subscription::subtype' => sub { > } > }); > my $subscription = Koha::Subscriptions->find($subs->{subscriptionid}); >- is($subscription->subtype, 'issues', 'Subscription with numberlength has issues type'); >+ is($subscription->lengthtype, 'issues', 'Subscription with numberlength has issues type'); > > my $subs2 = $builder->build({ > source => 'Subscription', >@@ -113,7 +113,7 @@ subtest 'Koha::Subscription::subtype' => sub { > } > }); > my $subscription2 = Koha::Subscriptions->find($subs2->{subscriptionid}); >- is($subscription2->subtype, 'weeks', 'Subscription with weeklength has weeks type'); >+ is($subscription2->lengthtype, 'weeks', 'Subscription with weeklength has weeks type'); > > my $subs3 = $builder->build({ > source => 'Subscription', >@@ -124,7 +124,7 @@ subtest 'Koha::Subscription::subtype' => sub { > } > }); > my $subscription3 = Koha::Subscriptions->find($subs3->{subscriptionid}); >- is($subscription3->subtype, 'months', 'Subscription with monthlength has months type'); >+ is($subscription3->lengthtype, 'months', 'Subscription with monthlength has months type'); > }; > > $schema->storage->txn_rollback; >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17656
:
68259
|
68261
|
68607
|
68608
|
68665
|
69124
|
69207
|
69279
|
69553
|
69814
|
69820
|
69915
|
70335
|
70336
|
70430
|
70619
|
75403
|
75404
|
75405
|
75406
|
75407
|
75408
|
75721
|
75722
|
75723
|
75724
|
75725
|
75726
|
75953
|
102724
|
102725
|
102726
|
102727
|
102728
|
102729
|
102730
|
102860
|
102861
|
102862
|
102863
|
102864
|
102865
|
102866
|
102867
|
102960
|
102961
|
102962
|
102963
|
102964
|
102965
|
102966
|
102967
|
102968
|
103623
|
103624
|
103625
|
103626
|
103627
|
103628
|
103629
|
103630
|
103631
|
103657
|
103658
|
103659
|
103660
|
103661
|
103662
|
103663
|
103664
|
103665
|
103667
|
117789
|
117790
|
117791
|
117792
|
117846
|
117851
|
117852
|
118856
|
119106
|
120863
|
121082
|
121083
|
121084
|
121085
|
121086
|
121087
|
121088
|
121192
|
121193
|
121194
|
121195
|
121196
|
121197
|
121198
|
121296
|
121297
|
121298
|
121299
|
121300
|
121301
|
121302
|
128489
|
128491
|
128492
|
128493
|
128494
|
128495
|
128496
|
128498
|
128499
|
128500
|
128501
|
128502
|
128503
|
128504
|
132412
|
132413
|
132415
|
132416
|
132417
|
132418
|
132447
|
132448
|
132692
|
132779