Bugzilla – Attachment 186663 Details for
Bug 40680
Many warnings on Perl 5.40 due to importing methods from not yet defined packages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40680: Fix C4::Calendar imports
Bug-40680-Fix-C4Calendar-imports.patch (text/plain), 10.36 KB, created by
Jonathan Druart
on 2025-09-22 09:00:27 UTC
(
hide
)
Description:
Bug 40680: Fix C4::Calendar imports
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-09-22 09:00:27 UTC
Size:
10.36 KB
patch
obsolete
>From 4e18cb4af881d436f4f0a2f968803af6ebc810d1 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 2 Sep 2025 12:39:36 +0200 >Subject: [PATCH] Bug 40680: Fix C4::Calendar imports > >Attempt to call undefined import method with arguments (new ...) via package C4::Calendar (Perhaps you forgot to load the package?) at t/db_dependent/Hold.t line 25. >--- > t/db_dependent/Circulation.t | 22 +++++++++++----------- > t/db_dependent/Circulation/CalcDateDue.t | 2 +- > t/db_dependent/Hold.t | 20 +++++++++++++------- > t/db_dependent/HoldsQueue.t | 2 +- > t/db_dependent/Koha/Charges/Fees.t | 2 +- > t/db_dependent/Koha/ItemTypes.t | 2 +- > 6 files changed, 28 insertions(+), 22 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index dda4983a4a2..1e90807128a 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -34,7 +34,7 @@ use t::lib::Mocks; > use t::lib::TestBuilder; > > use C4::Accounts; >-use C4::Calendar qw( new insert_single_holiday insert_week_day_holiday delete_holiday ); >+use C4::Calendar; > use C4::Circulation > qw( AddIssue AddReturn CanBookBeRenewed GetIssuingCharges AddRenewal GetSoonestRenewDate GetLatestAutoRenewDate LostItem GetUpcomingDueIssues CanBookBeIssued AddIssuingCharge MarkIssueReturned ProcessOfflinePayment transferbook ); > use C4::Biblio; >@@ -1183,7 +1183,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > my $issue = AddIssue( > $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, > undef, { auto_renew => 1 } >@@ -1333,7 +1333,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > my $issue = AddIssue( > $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, > undef, { auto_renew => 1 } >@@ -1443,7 +1443,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > > # Patron is expired and BlockExpiredPatronOpacActions='' > # => auto renew is allowed >@@ -1495,7 +1495,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > my $issue = AddIssue( > $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, > undef, { auto_renew => 1 } >@@ -1616,7 +1616,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > my $issue = AddIssue( > $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, > undef, { auto_renew => 1 } >@@ -1967,7 +1967,7 @@ subtest "GetUpcomingDueIssues" => sub { > my $a_borrower = Koha::Patrons->find($a_borrower_borrowernumber); > > my $yesterday = DateTime->today( time_zone => C4::Context->tz() )->add( days => -1 ); >- my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days => 2 ); >+ my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days => 2 ); > my $today = DateTime->today( time_zone => C4::Context->tz() ); > > my $issue = AddIssue( $a_borrower, $item_1->barcode, $yesterday ); >@@ -3879,7 +3879,7 @@ subtest 'AddReturn | is_overdue' => sub { > is( $line->status, 'RETURNED', "Overdue fine is fixed" ); > $line = $lines->next; > is( $line->amount + 0, -2, "Original payment amount remains as 2" ); >- is( $line->amountoutstanding + 0, 0, "Original payment remains applied" ); >+ is( $line->amountoutstanding + 0, 0, "Original payment remains applied" ); > $line = $lines->next; > is( $line->amount + 0, -1, "Refund amount correctly set to 1" ); > is( $line->amountoutstanding + 0, -1, "Refund amount outstanding unspent" ); >@@ -4833,7 +4833,7 @@ subtest '_FixOverduesOnReturn' => sub { > my $credit = $offset->credit; > is( ref $credit, "Koha::Account::Line", "Found matching credit for fine forgiveness" ); > is( $credit->amount + 0, -99, "Credit amount is set correctly" ); >- is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); >+ is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); > > # Bug 25417 - Only forgive fines where there is an amount outstanding to forgive > $accountline->set( >@@ -7584,7 +7584,7 @@ subtest 'NoRefundOnLostFinesPaidAge' => sub { > { > borrowernumber => $patron->id, > date => '1970-01-01 14:00:01', >- amountoutstanding => 0, >+ amountoutstanding => 0, > amount => -5, > interface => 'commandline', > credit_type_code => 'PAYMENT' >@@ -7640,7 +7640,7 @@ subtest 'NoRefundOnLostFinesPaidAge' => sub { > borrowernumber => $patron2->id, > date => '1970-01-01 14:00:01', > amount => -5, >- amountoutstanding => 0, >+ amountoutstanding => 0, > interface => 'commandline', > credit_type_code => 'PAYMENT' > } >diff --git a/t/db_dependent/Circulation/CalcDateDue.t b/t/db_dependent/Circulation/CalcDateDue.t >index 00e3c99a2ca..485b15b8181 100755 >--- a/t/db_dependent/Circulation/CalcDateDue.t >+++ b/t/db_dependent/Circulation/CalcDateDue.t >@@ -9,7 +9,7 @@ use DBI; > use DateTime; > use t::lib::Mocks; > use t::lib::TestBuilder; >-use C4::Calendar qw( new insert_single_holiday delete_holiday insert_week_day_holiday ); >+use C4::Calendar; > use Koha::DateUtils qw( dt_from_string ); > use Koha::Library::Hours; > use Koha::CirculationRules; >diff --git a/t/db_dependent/Hold.t b/t/db_dependent/Hold.t >index a6267393fdc..5ceb0aa7816 100755 >--- a/t/db_dependent/Hold.t >+++ b/t/db_dependent/Hold.t >@@ -22,7 +22,7 @@ use C4::Context; > use C4::Biblio qw( AddBiblio ); > use Koha::Database; > use Koha::Libraries; >-use C4::Calendar qw( new insert_single_holiday ); >+use C4::Calendar; > use Koha::Patrons; > use Koha::Holds; > use Koha::Item; >@@ -356,8 +356,10 @@ subtest "delete() tests" => sub { > "Koha::Hold->delete should have deleted the hold" > ); > >- my $number_of_logs = $schema->resultset('ActionLog') >- ->search( { module => 'HOLDS', action => 'DELETE', object => $hold->{reserve_id} } )->count; >+ my $number_of_logs = >+ $schema->resultset('ActionLog') >+ ->search( { module => 'HOLDS', action => 'DELETE', object => $hold->{reserve_id} } ) >+ ->count; > is( $number_of_logs, 0, 'With HoldsLogs, Koha::Hold->delete shouldn\'t have been logged' ); > > # Enable logging >@@ -376,8 +378,10 @@ subtest "delete() tests" => sub { > "Koha::Hold->delete should have deleted the hold" > ); > >- $number_of_logs = $schema->resultset('ActionLog') >- ->search( { module => 'HOLDS', action => 'DELETE', object => $hold->{reserve_id} } )->count; >+ $number_of_logs = >+ $schema->resultset('ActionLog') >+ ->search( { module => 'HOLDS', action => 'DELETE', object => $hold->{reserve_id} } ) >+ ->count; > is( $number_of_logs, 1, 'With HoldsLogs, Koha::Hold->delete should have been logged' ); > > $schema->storage->txn_rollback(); >@@ -469,7 +473,8 @@ subtest 'suspend() tests' => sub { > t::lib::Mocks::mock_preference( 'HoldsLog', 1 ); > > my $logs_count = >- $schema->resultset('ActionLog')->search( { module => 'HOLDS', action => 'SUSPEND', object => $hold->id } ) >+ $schema->resultset('ActionLog') >+ ->search( { module => 'HOLDS', action => 'SUSPEND', object => $hold->id } ) > ->count; > > $hold = $builder->build_object( >@@ -481,7 +486,8 @@ subtest 'suspend() tests' => sub { > > $hold->suspend_hold; > my $new_logs_count = >- $schema->resultset('ActionLog')->search( { module => 'HOLDS', action => 'SUSPEND', object => $hold->id } ) >+ $schema->resultset('ActionLog') >+ ->search( { module => 'HOLDS', action => 'SUSPEND', object => $hold->id } ) > ->count; > > is( $new_logs_count, $logs_count + 1, 'If logging is enabled, suspending a hold gets logged' ); >diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t >index 0d516da3407..b4db63abfe3 100755 >--- a/t/db_dependent/HoldsQueue.t >+++ b/t/db_dependent/HoldsQueue.t >@@ -12,7 +12,7 @@ use Test::NoWarnings; > use Test::More tests => 65; > use Data::Dumper; > >-use C4::Calendar qw( new insert_single_holiday ); >+use C4::Calendar; > use C4::Context; > use C4::Members; > use C4::Circulation qw( AddIssue AddReturn ); >diff --git a/t/db_dependent/Koha/Charges/Fees.t b/t/db_dependent/Koha/Charges/Fees.t >index b32b915f4db..00227828171 100755 >--- a/t/db_dependent/Koha/Charges/Fees.t >+++ b/t/db_dependent/Koha/Charges/Fees.t >@@ -29,7 +29,7 @@ use t::lib::TestBuilder; > use t::lib::Dates; > > use Time::Fake; >-use C4::Calendar qw( new insert_week_day_holiday delete_holiday ); >+use C4::Calendar; > use Koha::DateUtils qw(dt_from_string); > > BEGIN { >diff --git a/t/db_dependent/Koha/ItemTypes.t b/t/db_dependent/Koha/ItemTypes.t >index 9ba7b64dea6..c9791e91a77 100755 >--- a/t/db_dependent/Koha/ItemTypes.t >+++ b/t/db_dependent/Koha/ItemTypes.t >@@ -25,7 +25,7 @@ use Test::More tests => 19; > use t::lib::Mocks; > use t::lib::TestBuilder; > >-use C4::Calendar qw( new ); >+use C4::Calendar; > use Koha::Biblioitems; > use Koha::Libraries; > use Koha::Database; >-- >2.34.1
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 40680
:
186031
|
186032
|
186033
|
186034
|
186035
|
186036
|
186037
|
186038
|
186039
|
186040
|
186041
|
186654
|
186655
|
186656
|
186657
|
186658
|
186659
|
186660
|
186661
|
186662
|
186663
|
186664
|
187122
|
187123
|
187124
|
187125
|
187126
|
187127
|
187128
|
187129
|
187130
|
187131
|
187132
|
187385
|
187609
|
187610
|
187611
|
187612
|
187613
|
187614
|
187615
|
187616
|
187617
|
187618
|
187619