Bug 14819

Summary: Add missing DBIx::Class relationships - biblio<->biblioitem<->item
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: dcook, kyle.m.hall, kyle
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14544
Change sponsored?: --- Patch complexity: ---
Who signed the patch off: Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 14818    
Attachments: Bug 14819: Add missing DBIx::Class relationships - biblio<->biblioitem<->item
[SIGNED-OFF] Bug 14819: Add missing DBIx::Class relationships - biblio<->biblioitem<->item

Description Jonathan Druart 2015-09-14 16:05:32 UTC

    
Comment 1 Jonathan Druart 2015-09-14 16:08:32 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall 2015-10-27 15:40:40 UTC
Koha::Item::biblioitem appears to return a DBIC object. Can you create Koha::Biblioitem and use the _wrap method so it can return a Koha::Biblioitem object?
Comment 3 Bernardo Gonzalez Kriegel 2015-10-27 15:45:52 UTC
Created attachment 44093 [details] [review]
[SIGNED-OFF] Bug 14819: Add missing DBIx::Class relationships - biblio<->biblioitem<->item

To access the biblio from an item, we should not use the
biblioitemnumber relationship autogenerated by
DBIx::Class::Schema::Loader but create our own one.

Test plan:
Confirm the tests pass and that there is no regression on bug 14726.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Test pass, no regressions, no errors
Comment 4 Kyle M Hall 2015-10-30 18:25:29 UTC
Koha::Item::biblioitem should return a Koha::Biblioitem object, rather than a DBIC object.

Another possibility would be to extend Koha::Biblio so that it handles both the biblio and biblioitem tables internally, so they look like one unified table from the perspective using using Koha::Biblio. The auto method on Koha::Biblio could be extended to check for a valid biblio field first, and if it doesn't find one, a valid biblioitem field.
Comment 5 Jonathan Druart 2019-11-27 10:23:21 UTC
Done by
  commit 2410afd7b768bbdd69db5fa21bee9715bd4650d1
  Bug 14544: Add missing biblio <=> biblioitems <=> items relationships to the schema

among others...