Koha-clms/t/db_dependent/Koha
Julian Maurice aace5d0990 Bug 36526: Remove circular dependency from Koha::Objects
Koha::Objects depends on Koha::DateUtils, which depends on C4::Context,
which depends on Koha::Config::SysPrefs, which depends on Koha::Objects

Apart from the circular dependency, the dependency on C4::Context alone
is problematic as it loads a bunch of modules that are not needed at all
in Koha::Objects (YAML::XS and ZOOM for instance).
As Koha::Objects is used as a base for a lot of modules, we should take
care to only load the minimum required.

This patch removes uses of Koha::DateUtils from Koha::Objects.
It was only used in Koha::Objects::filter_by_last_update

filter_by_last_update now requires that the 'from' and 'to' parameters
must be DateTime objects. Previously it would also allow date and
datetime strings. This possibility was only used in two places:
* misc/cronjobs/cleanup_database.pl
* tools/cleanborrowers.pl

Now they call dt_from_string first and pass a DateTime object to
filter_by_last_update

Test plan:
1. Run `perl -cw Koha/Objects.pm`. It should only say:
   "Koha/Objects.pm syntax OK" without warnings
2. Run `prove t/db_dependent/Koha/Objects.t`
3. Verify that misc/cronjobs/cleanup_database.pl works as before,
   especially with the options --pseudo-transactions,
   --pseudo-transactions-from and --pseudo-transactions-to
4. Go to Tools » Batch patron deletion and anonymization, check "Verify
   you want to anonymize patron checkout history" and enter a date in
   the text input below. Then click Next and verify that the correct
   count of borrowers is shown. Click on the "Finish" button and verify
   that the circulation history has been correctly anonymized

See also bug 36432

Signed-off-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 675c8263b7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-05-24 14:59:19 +02:00
..
Account Bug 32496: Reduce unnecessary unblessings of objects in Circulation.pm 2023-09-22 10:52:39 -03:00
Acquisition Bug 32496: Fix tests 2023-09-22 12:35:47 -03:00
Auth Bug 29523: Fix tests 2023-10-28 09:47:38 -03:00
BackgroundJob Bug 35979: (follow-up) Add check in ->enqueue 2024-05-23 17:09:01 +02:00
BackgroundJobs Bug 34587: (QA follow-up) Tidy 2023-10-31 16:46:32 -03:00
Biblio Bug 34828: Make normalized_oclc use Koha::Biblio::Metadata::Extractor 2023-10-09 16:41:32 -03:00
Cash
…
Charges
…
Checkouts Bug 33362: Allow return claims to be resolved even if the issue has since been delete from the database 2023-05-24 11:21:31 -03:00
CirculationRules
…
Club
…
Config Bug 32478: (QA follow-up) Shebang and chmod for Koha/Config/SysPrefs.t 2023-06-07 15:25:22 -03:00
Database Bug 33584: Fix failures for Commenter.t on MySQL8 2023-04-24 12:08:00 -03:00
ERM Bug 35418: Add TR_B2 tests 2023-11-29 17:36:11 -03:00
Edifact Bug 34415: Remove T::D::C from EdiTransport.t, move to t/db 2023-09-18 12:06:28 -03:00
Filter Bug 33214: (follow-up) Make tests less fragile 2023-03-13 16:53:25 -03:00
Import Bug 32437: Add replace method to Koha::Import::Record objects 2023-03-31 13:13:26 +02:00
Item
…
Items Bug 32019: Unit tests 2023-02-20 09:54:19 -03:00
Library
…
Notice Bug 30287: (follow-up) Make unit test more reliable in ktd 2024-01-03 16:03:42 +01:00
Object/Mixin Bug 11844: (follow-up) Fix tests 2023-05-16 12:58:38 +02:00
Objects Bug 33083: Add a generic class to handle methods for collections of records 2023-03-13 15:11:59 -03:00
Old Bug 35353: Add REST API endpoint to retrieve old holds 2024-05-24 10:07:38 +02:00
Patron Bug 31503: (QA follow-up) Improve count of available_types 2023-10-25 10:35:24 -03:00
Patrons Bug 34621: Tidy Import.t 2024-05-23 14:56:02 +02:00
Plugins Bug 35070: Add test verifying plugins cannot override core templates 2024-01-08 15:18:37 +01:00
Policy Bug 30825: Move holds_control_library to Koha::Policy::Holds 2023-09-22 12:35:46 -03:00
Preservation Bug 33547: (QA follow-up) Tidy 2023-10-23 11:33:53 -03:00
REST Bug 29510: Regression tests 2024-02-19 14:41:11 +01:00
SMTP Bug 33964: Use Email::Sender::Transport::SMTP::Persistent for sending email 2023-07-24 14:55:33 -03:00
SearchEngine Bug 36678: Adjust unit tests 2024-05-24 14:34:11 +02:00
Subscription
…
Tags
…
Template/Plugin Bug 35955: Add tests 2024-03-12 11:55:23 +01:00
Ticket Bug 31028: Add new Koha::Object(s) classes 2023-03-06 11:23:17 -03:00
UI/Form/Builder Bug 24879: (follow-up) Fix test suite 2024-03-27 10:23:07 +01:00
XSLT
…
Z3950Responder Bug 29234: Further clean Z3950 Tests 2023-04-03 10:49:58 -03:00
Account.t Bug 34912: Add 14 hours to 1970 date in Account(s).t 2023-10-04 09:15:39 -04:00
ActionLogs.t
…
AdditionalContents.t Bug 31383: (QA follow-up) Tidy 2023-10-20 14:44:03 -03:00
AdditionalField.t Bug 35190: Adjust tests 2023-11-03 14:22:46 -03:00
ApiKey.t
…
ArticleRequest.t Bug 35030: Add 'article' to patron activity triggers 2023-10-24 10:05:26 -03:00
ArticleRequests.t Bug 34916: Fix wrong borrowernumber in ArticleRequests.t 2023-10-04 09:15:39 -04:00
Authorities.t Bug 32735: (follow-up) Make Koha::Objects::Record::Collections->print_collection work with Authorities and Biblios 2023-05-05 12:13:50 -03:00
BackgroundJob.t Bug 35962: (bug 35843 follow-up 2) Fix BackgroundJob.t on D10 2024-02-13 11:35:51 +01:00
BackgroundJobs.t
…
Biblio.t Bug 33036: Use Koha::Objects 2024-03-21 10:43:30 +01:00
BiblioFrameworks.t
…
Biblios.t Bug 33974: Add Koha::Biblios->api_query_fixer 2023-07-03 14:51:42 -03:00
Booking.t Bug 35248: Add tests for Koha::Booking->_assign_item_for_booking 2024-03-19 09:00:57 +01:00
Checkout.t
…
Checkouts.t Bug 34924: Handle final renewal errors 2023-10-31 11:02:47 -03:00
CirculationRules.t Bug 32271: Unit test 2023-07-19 13:00:37 -03:00
Cities.t
…
ClassSortRules.t
…
ClassSources.t
…
ClassSplitRules.t
…
CoverImages.t
…
CsvProfiles.t
…
CurbsidePickups.t Bug 32891: (QA follow-up) Fix perlcritic error 2023-02-21 10:22:33 -03:00
Database.t
…
Desks.t
…
EDI.t Bug 35398: (QA follow-up) Tidy code 2024-03-11 10:37:00 +01:00
Encryption.t
…
Hold.t Bug 35353: Add REST API endpoint to retrieve old holds 2024-05-24 10:07:38 +02:00
Holds.t Bug 34972: Add tests for ModReservesCancelAll 2024-05-22 14:44:24 +02:00
Illbackend.t Bug 34223: (QA follow-up) Fix file permissions 2023-09-06 16:47:09 -03:00
Illbatch.t Bug 30719: Rename `batch` for `ill_batch` in Koha::Illrequest 2023-10-17 14:45:25 -03:00
Illrequest.t Bug 35105: Regression tests 2023-10-19 16:00:49 -03:00
Illrequests.t Bug 22440: Add Koha::Illrequests->filter_by_visible 2023-05-05 09:13:40 -03:00
Item.t Bug 35248: Add unit tests for Koha::Item->check_booking 2024-03-19 09:00:57 +01:00
ItemTypes.t Bug 34357: Replace SUPER->imageurl in ItemTypes 2023-08-15 12:16:48 +03:00
Items.t Bug 33608: (QA follow-up) Restore older gt zero tests 2023-10-25 11:07:58 -03:00
KeyboardShortcuts.t
…
Libraries.t Bug 9525: (QA follow-up) Tidy 2023-10-04 16:40:12 -04:00
Library.t Bug 36480: Add Koha::Library->desks 2024-05-24 10:10:44 +02:00
MarcSubfieldStructures.t
…
Notice_Util.t Bug 33360: Extend Koha::Notice::Util with domain groups 2023-04-14 11:35:30 -03:00
Notices.t
…
Object.t Bug 36432: Remove circular dependency from Koha::Object 2024-05-23 11:19:11 +02:00
Objects.t Bug 36526: Remove circular dependency from Koha::Objects 2024-05-24 14:59:19 +02:00
Old.t
…
Patron.t Bug 19613: Scrub borrowers fields: borrowernotes opacnote 2024-04-24 07:36:20 +02:00
Patron_generate_userid.t Bug 32426: Patron::generate_userid - add plugin hook 2023-03-27 12:49:50 +02:00
Patrons.t Bug 36159: (QA follow-up) Tidy code 2024-04-17 17:12:01 +02:00
Pseudonymization.t Bug 35277: (follow-up) Fix tests 2024-02-09 09:08:05 +01:00
Quotes.t
…
Ratings.t Bug 33953: Adjust tests 2023-07-13 15:19:36 -03:00
Recall.t Bug 32496: Reduce unnecessary unblessings of objects in Circulation.pm 2023-09-22 10:52:39 -03:00
Recalls.t Bug 32496: Reduce unnecessary unblessings of objects in Circulation.pm 2023-09-22 10:52:39 -03:00
Reports.t Bug 27824: Add a test 2023-07-13 15:19:32 -03:00
Reviews.t
…
SMS_Providers.t
…
SearchField.t
…
Session.t Bug 36098: (follow-up) extend test to check driver 2024-03-11 10:03:04 +01:00
SharedContent.t
…
Statistics.t Bug 33608: (QA follow-up) Remove ->insert method 2023-10-25 11:07:59 -03:00
Subscription.t
…
Suggestion.t
…
Suggestions.t Bug 36122: Update unit test 2024-05-24 14:48:25 +02:00
Tags.t
…
Ticket.t Bug 31028: (follow-up) Fix executable bit 2023-03-07 14:54:29 -03:00
Virtualshelf.t
…
Virtualshelves.t
…
Z3950Servers.t
…