Bugzilla – Attachment 102862 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 issues found by QA
Bug-17656-Fix-issues-found-by-QA.patch (text/plain), 12.20 KB, created by
Katrin Fischer
on 2020-04-13 15:58:31 UTC
(
hide
)
Description:
Bug 17656: Fix issues found by QA
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-04-13 15:58:31 UTC
Size:
12.20 KB
patch
obsolete
>From ff4777d6dce1eba338549bf680ed461c2963c43a 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 issues found by QA > >- 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 | 4 ++-- > t/Koha/DateUtils.t | 5 +++-- > t/db_dependent/Koha/Subscription.t | 8 ++++---- > 11 files changed, 55 insertions(+), 16 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 8d7eca01d8..7e989d63e5 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -2651,9 +2651,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 3d7c80e72c..b5f8bb2e24 100644 >--- a/Koha/Subscription.pm >+++ b/Koha/Subscription.pm >@@ -221,13 +221,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 0000000000..fb6314dc82 >--- /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 cb9cd1d40a..0000000000 >--- 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 af10ac5317..c1698a1f5d 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1978,6 +1978,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 4e1688de1c..cf6f63efe3 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 29bf9fdf56..fde9b605e8 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 0b5cebf918..f2f3b59f2a 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 >@@ -34,7 +34,7 @@ > <input type="hidden" id="nextacquidate" value="[% nextacquidate | html %]" /> > > <input type="hidden" id="to" value="[% enddate | html %]" /> >- <input type="hidden" id="subtype" value="[% subtype | html %]" /> >+ <input type="hidden" id="subtype" value="[% lengthtype | html %]" /> > <input type="hidden" id="sublength" value="[% sublength | html %]" /> > <input type="hidden" id="numberingmethod" value="[% numberpattern.numberingmethod | html %]" /> > <input type="hidden" id="lastvalue1" value="[% subscription.lastvalue1 | html %]" /> >diff --git a/serials/subscription-renew.pl b/serials/subscription-renew.pl >index 318c51c4be..2c4f959923 100755 >--- a/serials/subscription-renew.pl >+++ b/serials/subscription-renew.pl >@@ -141,7 +141,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}, >@@ -166,7 +166,7 @@ if ( $op eq "renew" ) { > startdate => $newstartdate, > nextacquidate => $nextexpected->{planneddate}, > enddate => $enddate, >- subtype => $subtype, >+ lengthtype => $lengthtype, > sublength => $sub_length, > ); > } >diff --git a/t/Koha/DateUtils.t b/t/Koha/DateUtils.t >index f0af15c404..fa47c0d491 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 7220ca129e..ac641b9bc9 100644 >--- a/t/db_dependent/Koha/Subscription.t >+++ b/t/db_dependent/Koha/Subscription.t >@@ -106,7 +106,7 @@ subtest 'Koha::Subscription->frequency' => sub { > is( $subscription->frequency->id, $frequency->id, 'Koha::Subscription->frequency should return the correct frequency' ); > }; > >-subtest 'Koha::Subscription::subtype' => sub { >+subtest 'Koha::Subscription::lengthtype' => sub { > plan tests => 3; > > my $subs = $builder->build({ >@@ -118,7 +118,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', >@@ -129,7 +129,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', >@@ -140,7 +140,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'); > }; > > my $nb_of_subs = Koha::Subscriptions->search->count; >-- >2.11.0
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