@@ -, +, @@ --- 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(-) --- a/Koha/Schema/Result/Deletedbiblio.pm +++ a/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; --- a/Koha/Schema/Result/Deletedbiblioitem.pm +++ a/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; --- a/Koha/Schema/Result/Deletedborrower.pm +++ a/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; --- a/Koha/Schema/Result/Deleteditem.pm +++ a/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; --- a/t/lib/TestBuilder.pm +++ a/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; } --