[Bug 25044] New: No need to define koha_object[s]_çlass for standard object class names
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Bug ID: 25044 Summary: No need to define koha_object[s]_çlass for standard object class names Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: ASSIGNED Severity: normal Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: jonathan.druart@bugs.koha-community.org Reporter: jonathan.druart@bugs.koha-community.org QA Contact: testopia@bugs.koha-community.org Depends on: 24356 In Koha::Object[s]->prefetch_whitelist, there is a call to the koha_object[s]_class DBIC resultset class. We should not, otherwise those 2 methods will have to be defined all the time, even when we can guess it easily. Koha::Item <> Schema::Result::Item => standard Koha::Acquisition::Order <> Schema::Result::Aqorder => non-standard sub _get_object_class { my ( $type ) = @_; return unless $type; if( $type->can('koha_object_class') ) { return $type->koha_object_class; } $type =~ s|Schema::Result::||; return ${type}; } Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24356 [Bug 24356] objects.search prefetch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|No need to define |No need to define |koha_object[s]_çlass for |koha_object[s]_lass for |standard object class names |standard object class names -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|No need to define |No need to define |koha_object[s]_lass for |koha_object[s]_class for |standard object class names |standard object class names -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 102297 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102297&action=edit Bug 25044: Remove the need to define koha_object[s]_class for standard object class names In Koha::Object[s]->prefetch_whitelist, there is a call to the koha_object[s]_class DBIC resultset class. We should not, otherwise those 2 methods will have to be defined all the time, even when we can guess it easily. Koha::Item <> Schema::Result::Item => standard Koha::Acquisition::Order <> Schema::Result::Aqorder => non-standard sub _get_object_class { my ( $type ) = @_; return unless $type; if( $type->can('koha_object_class') ) { return $type->koha_object_class; } $type =~ s|Schema::Result::||; return ${type}; } Test plan: % prove t/db_dependent/Koha/Object.t t/db_dependent/Koha/Objects.t should return green before and after this patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |20936 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20936 [Bug 20936] Holds History for patrons in OPAC -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |tomascohen@gmail.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Good catch, I think we missed that method. Still, wouldn't it be more efficient to just have this information as schema metadata? (not even a method, just metadata in the big schema hash) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #102297|0 |1 is obsolete| | --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 102298 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102298&action=edit Bug 25044: Remove the need to define koha_object[s]_class for standard object class names In Koha::Object[s]->prefetch_whitelist, there is a call to the koha_object[s]_class DBIC resultset class. We should not, otherwise those 2 methods will have to be defined all the time, even when we can guess it easily. Koha::Item <> Schema::Result::Item => standard Koha::Acquisition::Order <> Schema::Result::Aqorder => non-standard sub _get_object_class { my ( $type ) = @_; return unless $type; if( $type->can('koha_object_class') ) { return $type->koha_object_class; } $type =~ s|Schema::Result::||; return ${type}; } Test plan: % prove t/db_dependent/Koha/Object.t t/db_dependent/Koha/Objects.t should return green before and after this patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |agustinmoyano@theke.io, | |martin.renvoize@ptfs-europe | |.com Version|unspecified |master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #102298|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 102529 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102529&action=edit Bug 25044: Remove the need to define koha_object[s]_class for standard object class names In Koha::Object[s]->prefetch_whitelist, there is a call to the koha_object[s]_class DBIC resultset class. We should not, otherwise those 2 methods will have to be defined all the time, even when we can guess it easily. Koha::Item <> Schema::Result::Item => standard Koha::Acquisition::Order <> Schema::Result::Aqorder => non-standard sub _get_object_class { my ( $type ) = @_; return unless $type; if( $type->can('koha_object_class') ) { return $type->koha_object_class; } $type =~ s|Schema::Result::||; return ${type}; } Test plan: % prove t/db_dependent/Koha/Object.t t/db_dependent/Koha/Objects.t should return green before and after this patch Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|tomascohen@gmail.com | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #102529|0 |1 is obsolete| | --- Comment #5 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 102774 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102774&action=edit Bug 25044: Remove the need to define koha_object[s]_class for standard object class names In Koha::Object[s]->prefetch_whitelist, there is a call to the koha_object[s]_class DBIC resultset class. We should not, otherwise those 2 methods will have to be defined all the time, even when we can guess it easily. Koha::Item <> Schema::Result::Item => standard Koha::Acquisition::Order <> Schema::Result::Aqorder => non-standard sub _get_object_class { my ( $type ) = @_; return unless $type; if( $type->can('koha_object_class') ) { return $type->koha_object_class; } $type =~ s|Schema::Result::||; return ${type}; } Test plan: % prove t/db_dependent/Koha/Object.t t/db_dependent/Koha/Objects.t should return green before and after this patch Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Trusting Tomas and Jonathan here as experts - not a big code change and tests pass. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 --- Comment #7 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Katrin Fischer from comment #6)
Trusting Tomas and Jonathan here as experts - not a big code change and tests pass.
Yeah, we are just 'doing it right' on something Agustin and I overlooked a bit. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |20.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Tomas, one test is failing: t/Koha/REST/Plugin/Query.t .. 1/6 # Failed test 'exact match for JSON Pointer "/prefetch/0"' # at t/Koha/REST/Plugin/Query.t line 350. # Structures begin differing at: # $got = HASH(0x55daaa8747c8) # $expected = 'biblio' # Looks like you failed 1 test of 10. I do not understand what was supposed to do the code prior to this change. Koha::Schema::Result::Biblio does not have a koha_object_class, so the try was failing, and undef was assigned. I am suspecting the tests to be wrong, but it would be good if you or Agustin could confirm it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 --- Comment #10 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 102927 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102927&action=edit Bug 25044: (follow-up) Fix wrong tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact| |katrin.fischer@bsz-bw.de -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 --- Comment #11 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Joy Nelson <joy@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joy@bywatersolutions.com --- Comment #12 from Joy Nelson <joy@bywatersolutions.com> --- missing dependencies. not backported to 19.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25044 Agustín Moyano <agustinmoyano@theke.io> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|20936 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20936 [Bug 20936] Holds History for patrons in OPAC -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org