Bugzilla – Attachment 96871 Details for
Bug 24150
Add missing Koha::Old::*[s] classes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24150: Add missing koha_object[s]_class methods and skip for deletedborrowers
Bug-24150-Add-missing-kohaobjectsclass-methods-and.patch (text/plain), 5.25 KB, created by
Jonathan Druart
on 2020-01-07 10:40:49 UTC
(
hide
)
Description:
Bug 24150: Add missing koha_object[s]_class methods and skip for deletedborrowers
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-01-07 10:40:49 UTC
Size:
5.25 KB
patch
obsolete
>From 18d5ca57b8963389f3f1913814e9eb204e8a57c9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 6 Jan 2020 23:49:37 +0100 >Subject: [PATCH] Bug 24150: Add missing koha_object[s]_class methods and skip > for deletedborrowers > >deletedborrowers does not have a PK, and adding it is out of the scope >of this patchset. Indeed we will have to handle possible duplication of >borrowernumber values, which does not seem trivial. >Having bug 20271 in mind, we will have to deal with this problematic >anyway later. >--- > 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/db_dependent/TestBuilder.t | 6 ++++-- > t/lib/TestBuilder.pm | 16 ++++++++++------ > 6 files changed, 38 insertions(+), 12 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/db_dependent/TestBuilder.t b/t/db_dependent/TestBuilder.t >index e8cfeb9e4d..593a596e09 100644 >--- a/t/db_dependent/TestBuilder.t >+++ b/t/db_dependent/TestBuilder.t >@@ -395,8 +395,10 @@ subtest 'build_object() tests' => sub { > eval "require $module"; > my $object = $builder->build_object( { class => $module } ); > is( ref($object), $module->object_class, "Testing $module" ); >- eval {$object->get_from_storage}; >- is( $@, '', "Module $module should have koha_object[s]_class method if needed" ); >+ if ( $module ne 'Koha::Old::Patrons' ) { # FIXME deletedborrowers does not have a PK >+ eval {$object->get_from_storage}; >+ is( $@, '', "Module $module should have koha_object[s]_class method if needed" ); >+ } > > # Testing koha_object_class and koha_objects_class > my $object_class = Koha::Object::_get_object_class($object->_result->result_class); >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
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 24150
:
95954
|
95955
|
96266
|
96267
|
96268
|
96428
|
96867
| 96871 |
96897