From afad25ad782574f9a4d593560ad8fda3918cee62 Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Sun, 15 Mar 2026 15:02:46 +0000 Subject: [PATCH] Bug 17656: (QA follow-up) fix DB update and weekly permanent irregularities selection --- Koha/Subscription.pm | 4 ++- ...ug_17656-add-permanent-irregularities.perl | 2 +- installer/data/mysql/kohastructure.sql | 2 +- .../serials/subscription_weekly_choice.inc | 32 ++++++------------- serials/showpredictionpattern.pl | 11 +++---- 5 files changed, 20 insertions(+), 31 deletions(-) diff --git a/Koha/Subscription.pm b/Koha/Subscription.pm index ab53cd8d755..aeac71ba35e 100644 --- a/Koha/Subscription.pm +++ b/Koha/Subscription.pm @@ -79,7 +79,9 @@ sub subscribers { my ($self) = @_; my $schema = Koha::Database->new->schema; my @borrowernumbers = - $schema->resultset('Alert')->search( { externalid => $self->subscriptionid } )->get_column('borrowernumber') + $schema->resultset('Alert') + ->search( { externalid => $self->subscriptionid } ) + ->get_column('borrowernumber') ->all; return Koha::Patrons->search( { borrowernumber => { -in => \@borrowernumbers } } ); } diff --git a/installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.perl b/installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.perl index 0f7ca0a0fec..5c11bd7654f 100644 --- a/installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.perl +++ b/installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.perl @@ -12,7 +12,7 @@ return { $dbh->do(q{ ALTER TABLE `subscription` - ADD permanent_irregularity MEDIUMTEXT + ADD permanent_irregularity MEDIUMTEXT COMMENT 'permanent irregularities for renewal', AFTER irregularity }); diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index fa91cb7b530..ee88d078242 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -6491,7 +6491,7 @@ CREATE TABLE `subscription` ( `firstacquidate` date DEFAULT NULL COMMENT 'first issue received date', `manualhistory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes or no to managing the history manually', `irregularity` mediumtext DEFAULT NULL COMMENT 'any irregularities in the subscription', - `permanent_irregularity` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'permanent irregularities for renewal', + `permanent_irregularity` mediumtext DEFAULT NULL COMMENT 'permanent irregularities for renewal', `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0, `letter` varchar(20) DEFAULT NULL, `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id', diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_weekly_choice.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_weekly_choice.inc index af552e9cc4e..d9a5e394c9c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_weekly_choice.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_weekly_choice.inc @@ -1,26 +1,14 @@ -
-
-
- - +
+ [% FOREACH p IN predictions_loop %] +
+ [% IF permanent_irreg.grep( p.dow ).0 == p.dow %] + + [% ELSE %] + + [% END %] +
-
+ [% END %]

Check weeks in the above list in order to keep them unpublished throughout upcoming renewals (permanent irregularities). diff --git a/serials/showpredictionpattern.pl b/serials/showpredictionpattern.pl index 8e38e4b0b94..5314f7ea750 100755 --- a/serials/showpredictionpattern.pl +++ b/serials/showpredictionpattern.pl @@ -30,12 +30,11 @@ publication date, based on frequency and first publication date. use Modern::Perl; -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::Output qw( output_html_with_http_headers ); -use C4::Serials - qw( GetSubscription GetFictiveIssueNumber GetSeq GetSubscriptionIrregularities GetNextDate GetNextSeq ); +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::Output qw( output_html_with_http_headers ); +use C4::Serials qw( GetSubscription GetFictiveIssueNumber GetSeq GetSubscriptionIrregularities GetNextDate GetNextSeq ); use C4::Serials::Frequency; use Koha::DateUtils qw( dt_from_string ); -- 2.39.5