Bugzilla – Attachment 91141 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.00 KB, created by
Nick Clemens (kidclamp)
on 2019-07-01 12:15:21 UTC
(
hide
)
Description:
Bug 15148: Predict serials issues from subscription start date
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-07-01 12:15:21 UTC
Size:
5.00 KB
patch
obsolete
>From 85006f275f2ef318aac81b52ce1a7179a5f8b301 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 | 3 +-- > serials/showpredictionpattern.pl | 8 +++++--- > 3 files changed, 7 insertions(+), 7 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 44d1cacf6a..f2597c162d 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 >@@ -341,7 +341,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]; >@@ -349,7 +349,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 4c6bf22c29..f88e1ef9e2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >@@ -304,7 +304,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', > 'sfdescription', 'unitsperissue', 'issuesperunit', 'unit' > ]; > for(i in ajaxParams) { >@@ -313,7 +313,6 @@ function testPredictionPattern() { > if(value.length > 0) > ajaxData[param] = value; > } >- > $.ajax({ > url:"/cgi-bin/koha/serials/showpredictionpattern.pl", > data: ajaxData, >diff --git a/serials/showpredictionpattern.pl b/serials/showpredictionpattern.pl >index 4a3f7b2a64..69bc59f2d0 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('to'); >+my $startdate = $input->param('from'); > my $subtype = $input->param('subtype'); > my $sublength = $input->param('sublength'); > my $custompattern = $input->param('custompattern'); >@@ -93,6 +94,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' } ); }; > >@@ -154,14 +157,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