From b6bdae7e9d0eef1247907534f8c856014b53d6c1 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 25 Feb 2022 06:42:25 -0300 Subject: [PATCH] Bug 30181: Make Koha::BackgroundJob->_derived_class return the right thing This patch makes _derived_class rely on _new_from_dbic to generate a new object with the right class, but based on the same DB row. Not an empty one as it was before. This way we can remove some biolerplate that is required now when writing background job classes. To test: 1. Apply the regression tests 2. Run: $ kshell k$ prove t/db_dependent/Koha/BackgroundJob.t => FAIL: Boo, tests fail 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Kyle M Hall Signed-off-by: Fridolin Somers --- Koha/BackgroundJob.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/BackgroundJob.pm b/Koha/BackgroundJob.pm index 9f3be705e9..2a53702195 100644 --- a/Koha/BackgroundJob.pm +++ b/Koha/BackgroundJob.pm @@ -240,7 +240,7 @@ sub _derived_class { unless $class; eval "require $class"; - return $class->new; + return $class->_new_from_dbic( $self->_result ); } =head3 type_to_class_mapping -- 2.39.5