Bugzilla – Attachment 84312 Details for
Bug 15148
Serials: Test prediction pattern starts at First issue date, not Subscription start date
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15148: Predict serials issues from subscription start date
Bug-15148-Predict-serials-issues-from-subscription.patch (text/plain), 5.14 KB, created by
Nick Clemens (kidclamp)
on 2019-01-23 01:03:48 UTC
(
hide
)
Description:
Bug 15148: Predict serials issues from subscription start date
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-01-23 01:03:48 UTC
Size:
5.14 KB
patch
obsolete
>From e729f68b393de3a073e7c247c29ca6f3355036fc Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 23 Jan 2019 00:57:51 +0000 >Subject: [PATCH] Bug 15148: Predict serials issues from subscription start > date > >To test: >1 - Create a new serial >2 - Set 'First issue plublication date' to some date in 2016 >3 - Set subscription start date to today >4 - Set length to 104 weeks >5 - Test prediction pattern - only one generated >6 - Apply patch >7 - Test prediction patern - many generated! >--- > .../prog/en/modules/serials/subscription-numberpatterns.tt | 3 +-- > koha-tmpl/intranet-tmpl/prog/js/subscription-add.js | 5 ++--- > serials/showpredictionpattern.pl | 8 +++++--- > 3 files changed, 8 insertions(+), 8 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt >index ccd21bc567..b77d1b0231 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt >@@ -342,7 +342,7 @@ > 'lastvalue1', 'lastvalue2', 'lastvalue3', 'add1', 'add2', 'add3', > 'every1', 'every2', 'every3', 'innerloop1', 'innerloop2', 'innerloop3', > 'setto1', 'setto2', 'setto3', 'numbering1', 'numbering2', 'numbering3', >- 'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale' >+ 'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale', 'from' > ]; > for(i in ajaxParams) { > var param = ajaxParams[i]; >@@ -350,7 +350,6 @@ > if(value.length > 0) > ajaxData[param] = value; > } >- > $.ajax({ > url: "/cgi-bin/koha/serials/showpredictionpattern.pl", > data: ajaxData, >diff --git a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >index c995751431..4a2800e11b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >@@ -275,7 +275,7 @@ function testPredictionPattern() { > 'lastvalue1', 'lastvalue2', 'lastvalue3', 'add1', 'add2', 'add3', > 'every1', 'every2', 'every3', 'innerloop1', 'innerloop2', 'innerloop3', > 'setto1', 'setto2', 'setto3', 'numbering1', 'numbering2', 'numbering3', >- 'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale' >+ 'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale', 'from' > ]; > for(i in ajaxParams) { > var param = ajaxParams[i]; >@@ -283,7 +283,6 @@ function testPredictionPattern() { > if(value.length > 0) > ajaxData[param] = value; > } >- > $.ajax({ > url:"/cgi-bin/koha/serials/showpredictionpattern.pl", > data: ajaxData, >@@ -496,4 +495,4 @@ $(document).ready(function() { > e.preventDefault(); > testPredictionPattern(); > }); >-}); >\ No newline at end of file >+}); >diff --git a/serials/showpredictionpattern.pl b/serials/showpredictionpattern.pl >index 6986b5efad..c38b075871 100755 >--- a/serials/showpredictionpattern.pl >+++ b/serials/showpredictionpattern.pl >@@ -52,6 +52,7 @@ my $frequencyid = $input->param('frequency'); > my $firstacquidate = $input->param('firstacquidate'); > my $nextacquidate = $input->param('nextacquidate'); > my $enddate = $input->param('enddate'); >+my $startdate = $input->param('from'); > my $subtype = $input->param('subtype'); > my $sublength = $input->param('sublength'); > my $custompattern = $input->param('custompattern'); >@@ -79,6 +80,8 @@ my %pattern = ( > > $firstacquidate = eval { output_pref( { str => $firstacquidate, dateonly => 1, dateformat => 'iso' } ); } > or output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ); >+$startdate = eval { output_pref( { str => $firstacquidate, dateonly => 1, dateformat => 'iso' } ); } >+ or output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ); > > $enddate = eval { output_pref( { str => $enddate, dateonly => 1, dateformat => 'iso' } ); }; > >@@ -141,14 +144,13 @@ while( $i < 1000 ) { > $line{'publicationdate'} = $date; > $line{'dow'} = Day_of_Week(split /-/, $date); > } >- > # Check if we don't have exceed end date > if($sublength){ > if($subtype eq "issues" && $i >= $sublength){ > last; >- } elsif($subtype eq "weeks" && $date && Delta_Days( split(/-/, $date), Add_Delta_Days( split(/-/, $firstacquidate), 7*$sublength - 1 ) ) < 0) { >+ } elsif($subtype eq "weeks" && $date && Delta_Days( split(/-/, $date), Add_Delta_Days( split(/-/, $startdate), 7*$sublength - 1 ) ) < 0) { > last; >- } elsif($subtype eq "months" && $date && (Delta_Days( split(/-/, $date), Add_Delta_YM( split(/-/, $firstacquidate), 0, $sublength) ) - 1) < 0 ) { >+ } elsif($subtype eq "months" && $date && (Delta_Days( split(/-/, $date), Add_Delta_YM( split(/-/, $startdate), 0, $sublength) ) - 1) < 0 ) { > last; > } > } >-- >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 15148
:
84312
|
91141
|
91142