Bugzilla – Attachment 185207 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: (QA follow-up) perltidy + small fixes
Bug-17656-QA-follow-up-perltidy--small-fixes.patch (text/plain), 6.53 KB, created by
Arthur Suzuki
on 2025-08-07 09:38:20 UTC
(
hide
)
Description:
Bug 17656: (QA follow-up) perltidy + small fixes
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2025-08-07 09:38:20 UTC
Size:
6.53 KB
patch
obsolete
>From ec0fa8c0eff8af420c9f54f2a7b0bf95a9911bdd Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Thu, 7 Aug 2025 09:20:07 +0000 >Subject: [PATCH] Bug 17656: (QA follow-up) perltidy + small fixes > >--- > C4/Serials.pm | 8 ++++---- > Koha/Subscription.pm | 12 +++++------- > serials/showpredictionpattern.pl | 4 ++-- > serials/subscription-add.pl | 6 +++--- > serials/subscription-renew.pl | 14 ++++++-------- > 5 files changed, 20 insertions(+), 24 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 5a00df60002..3c714902904 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -20,7 +20,7 @@ package C4::Serials; > > use Modern::Perl; > >-use Carp qw( croak ); >+use Carp qw( croak ); > use Date::Calc qw( > Add_Delta_Days > Add_Delta_YM >@@ -30,14 +30,14 @@ use Date::Calc qw( > Today > ); > use DateTime; >-use POSIX qw( strftime ); >+use POSIX qw( strftime ); > use Scalar::Util qw( looks_like_number ); > use Try::Tiny; > >-use C4::Auth qw( haspermission ); >+use C4::Auth qw( haspermission ); > use C4::Biblio qw( GetMarcFromKohaField ModBiblio ); > use C4::Context; >-use C4::Log qw( logaction ); # logaction >+use C4::Log qw( logaction ); # logaction > use C4::Serials::Frequency qw( GetSubscriptionFrequency ); > use C4::Serials::Numberpattern; > use Koha::AdditionalFieldValues; >diff --git a/Koha/Subscription.pm b/Koha/Subscription.pm >index f6fa74c5c48..98e6b2eae73 100644 >--- a/Koha/Subscription.pm >+++ b/Koha/Subscription.pm >@@ -28,7 +28,7 @@ use Koha::Biblioitems; > use Koha::Subscriptions; > use Koha::Subscription::Frequencies; > use Koha::Subscription::Numberpatterns; >-use Koha::DateUtils; >+use Koha::DateUtils qw( dt_from_string ); > use JSON; > use Date::Calc qw( Delta_Days Add_Delta_Days Add_Delta_YM ); > >@@ -254,23 +254,21 @@ sub guess_irregularities { > my @irregularities; > my %permanent_irregularities = map { $_ => 1 } $self->permanent_irregularities; > >- my $schema = Koha::Database->new->schema; >- my $frequency = $schema->resultset('SubscriptionFrequency')->find( $self->periodicity ); >- >+ my $frequency = $self->frequency; > my $enddate = $self->enddate; > my $nextexpected = C4::Serials::GetNextExpected( $self->id ); > my $date = $nextexpected->{planneddate}; > >- my ($issuenumber) = C4::Serials::GetFictiveIssueNumber( $self->unblessed, $date ); >+ my ($issuenumber) = C4::Serials::GetFictiveIssueNumber( $self->unblessed, $date, $frequency->unblessed ); > my $dow = C4::Serials::issue_number( dt_from_string($date), $frequency->unit ); > > if ( defined( $permanent_irregularities{$dow} ) ) { > push @irregularities, $issuenumber; > } > >- while ( Delta_Days( split( /-/, $date ), split( /-/, $enddate ) ) >= 0 ) { >+ while ( $date && Delta_Days( split( /-/, $date ), split( /-/, $enddate ) ) >= 0 ) { > $issuenumber++; >- $date = C4::Serials::GetNextDate( $self->unblessed, $date ); >+ $date = C4::Serials::GetNextDate( $self->unblessed, $date, $frequency->unblessed ); > $dow = C4::Serials::issue_number( dt_from_string($date), $frequency->unit ); > > if ( defined( $permanent_irregularities{$dow} ) ) { >diff --git a/serials/showpredictionpattern.pl b/serials/showpredictionpattern.pl >index ec5156455fb..8b556ce9ee2 100755 >--- a/serials/showpredictionpattern.pl >+++ b/serials/showpredictionpattern.pl >@@ -30,9 +30,9 @@ publication date, based on frequency and first publication date. > > use Modern::Perl; > >-use CGI qw ( -utf8 ); >+use CGI qw ( -utf8 ); > use Date::Calc qw( Add_Delta_Days Add_Delta_YM Day_of_Week Delta_Days ); >-use C4::Auth qw( get_template_and_user ); >+use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_html_with_http_headers ); > use C4::Serials > qw( GetSubscription GetFictiveIssueNumber GetSeq GetSubscriptionIrregularities GetNextDate GetNextSeq issue_number ); >diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl >index bec13030e55..de62e8018ed 100755 >--- a/serials/subscription-add.pl >+++ b/serials/subscription-add.pl >@@ -17,10 +17,10 @@ > > use Modern::Perl; > >-use CGI qw ( -utf8 ); >+use CGI qw ( -utf8 ); > use Date::Calc qw( Add_Delta_Days Add_Delta_YM ); >-use C4::Koha qw( GetAuthorisedValues ); >-use C4::Auth qw( get_template_and_user ); >+use C4::Koha qw( GetAuthorisedValues ); >+use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_and_exit output_html_with_http_headers ); > use C4::Context; > use C4::Serials >diff --git a/serials/subscription-renew.pl b/serials/subscription-renew.pl >index 096a96eed31..7d993728002 100755 >--- a/serials/subscription-renew.pl >+++ b/serials/subscription-renew.pl >@@ -44,18 +44,18 @@ Id of the subscription this script has to renew > > use Modern::Perl; > >-use CGI qw ( -utf8 ); >+use CGI qw ( -utf8 ); > use Carp qw( carp ); > use C4::Koha; > use C4::Auth qw( get_template_and_user ); > use C4::Context; >-use C4::Auth qw( get_template_and_user ); >-use C4::Output qw( output_and_exit output_html_with_http_headers ); >+use C4::Auth qw( get_template_and_user ); >+use C4::Output qw( output_and_exit output_html_with_http_headers ); > use C4::Serials qw( GetSubscription GetSubscriptionLength NewSubscription ReNewSubscription GetSerials GetNextExpected); > use C4::Serials::Frequency; > use C4::Serials::Numberpattern; > use Koha::DateUtils qw( dt_from_string output_pref ); >-use Date::Calc qw(Today Day_of_Year Week_of_Year Add_Delta_Days Add_Delta_YM); >+use Date::Calc qw(Today Day_of_Year Week_of_Year Add_Delta_Days Add_Delta_YM); > > my $query = CGI->new; > my $dbh = C4::Context->dbh; >@@ -148,9 +148,8 @@ if ( $op eq "cud-renew" ) { > print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); > } > >- my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1 } ) >- or output_pref( { dt => dt_from_string, dateonly => 1 } ); >- >+ my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1, dateformat => 'iso' } ) >+ or output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ); > my ($serials_number) = GetSerials($subscriptionid); > if ( $serials_number > 1 ) { > $template->param( more_than_one_serial => 1 ); >@@ -181,7 +180,6 @@ if ( $op eq "cud-renew" ) { > my $numberpattern = GetSubscriptionNumberpattern( $subscription->{numberpattern} ); > > $template->param( >- startdate => $newstartdate, > subscription => $subscription, > numberpattern => $numberpattern, > startdate => $newstartdate, >-- >2.39.5
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
|
177497
|
177498
|
177499
|
177500
|
177501
|
177502
|
177503
|
177504
|
177505
|
177663
|
177664
|
177665
|
177666
|
177667
|
177668
|
177669
|
177670
|
177671
|
177831
|
177832
|
177833
|
177834
|
177835
|
177836
|
177837
|
177838
|
177839
|
178142
|
185196
|
185197
|
185198
|
185199
|
185200
|
185201
|
185202
|
185203
|
185204
|
185205
|
185206
| 185207 |
185208