Bug 14819 - Add missing DBIx::Class relationships - biblio<->biblioitem<->item
Summary: Add missing DBIx::Class relationships - biblio<->biblioitem<->item
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 14818
  Show dependency treegraph
 
Reported: 2015-09-14 16:05 UTC by Jonathan Druart
Modified: 2020-11-30 21:45 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 14819: Add missing DBIx::Class relationships - biblio<->biblioitem<->item (4.34 KB, patch)
2015-09-14 16:08 UTC, Jonathan Druart
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 14819: Add missing DBIx::Class relationships - biblio<->biblioitem<->item (4.45 KB, patch)
2015-10-27 15:45 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 (khall) 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...