From 645c58c0ae2f9043b62e1b860cb39cc224497d65 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 6 Jan 2020 23:49:37 +0100 Subject: [PATCH] Bug 24150: Add missing koha_object[s]_class methods --- Koha/Schema/Result/Deletedbiblio.pm | 7 ++++++- Koha/Schema/Result/Deletedbiblioitem.pm | 7 ++++++- Koha/Schema/Result/Deletedborrower.pm | 7 ++++++- Koha/Schema/Result/Deleteditem.pm | 7 ++++++- t/lib/TestBuilder.pm | 16 ++++++++++------ 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/Koha/Schema/Result/Deletedbiblio.pm b/Koha/Schema/Result/Deletedbiblio.pm index a502d26a18..5d02066493 100644 --- a/Koha/Schema/Result/Deletedbiblio.pm +++ b/Koha/Schema/Result/Deletedbiblio.pm @@ -184,6 +184,11 @@ __PACKAGE__->has_many( # Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-08-05 13:53:34 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FQaznWmkfR2Ge5NG8lDmSw +sub koha_objects_class { + 'Koha::Old::Biblios'; +} +sub koha_object_class { + 'Koha::Old::Biblio'; +} -# You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/Koha/Schema/Result/Deletedbiblioitem.pm b/Koha/Schema/Result/Deletedbiblioitem.pm index c83134788c..e2849ecd99 100644 --- a/Koha/Schema/Result/Deletedbiblioitem.pm +++ b/Koha/Schema/Result/Deletedbiblioitem.pm @@ -291,6 +291,11 @@ __PACKAGE__->set_primary_key("biblioitemnumber"); # Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QLYBa1Ea8Jau2Wy6U+wyQw +sub koha_objects_class { + 'Koha::Old::Biblioitems'; +} +sub koha_object_class { + 'Koha::Old::Biblioitem'; +} -# You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/Koha/Schema/Result/Deletedborrower.pm b/Koha/Schema/Result/Deletedborrower.pm index df8877ff72..1ba0873e2f 100644 --- a/Koha/Schema/Result/Deletedborrower.pm +++ b/Koha/Schema/Result/Deletedborrower.pm @@ -653,6 +653,11 @@ __PACKAGE__->add_columns( # Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-05-22 04:33:29 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zK1jC6Wawwj8B2ch9KFByw +sub koha_objects_class { + 'Koha::Old::Patrons'; +} +sub koha_object_class { + 'Koha::Old::Patron'; +} -# You can replace this text with custom code or comments, and it will be preserved on regeneration 1; diff --git a/Koha/Schema/Result/Deleteditem.pm b/Koha/Schema/Result/Deleteditem.pm index 33f1935a4b..c2703ed44f 100644 --- a/Koha/Schema/Result/Deleteditem.pm +++ b/Koha/Schema/Result/Deleteditem.pm @@ -410,6 +410,11 @@ __PACKAGE__->set_primary_key("itemnumber"); # Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-09-26 16:15:09 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:L7G0HG5gvgyhfpKb7LcUFw +sub koha_objects_class { + 'Koha::Old::Items'; +} +sub koha_object_class { + 'Koha::Old::Item'; +} -# You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm index 7b5a6bbc72..cceacc1257 100644 --- a/t/lib/TestBuilder.pm +++ b/t/lib/TestBuilder.pm @@ -81,17 +81,21 @@ sub build_object { load $class; my $source = $class->_type; - my @pks = $self->schema->source( $class->_type )->primary_columns; my $hashref = $self->build({ source => $source, value => $value }); - my @ids; + my $object; + if ( $class eq 'Koha::Old::Patrons' ) { + $object = $class->search({ borrowernumber => $hashref->{borrowernumber} })->next; + } else { + my @ids; + my @pks = $self->schema->source( $class->_type )->primary_columns; + foreach my $pk ( @pks ) { + push @ids, $hashref->{ $pk }; + } - foreach my $pk ( @pks ) { - push @ids, $hashref->{ $pk }; + $object = $class->find( @ids ); } - my $object = $class->find( @ids ); - return $object; } -- 2.11.0