Created attachment 42531 [details] [review] 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.
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?
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
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.
Done by commit 2410afd7b768bbdd69db5fa21bee9715bd4650d1 Bug 14544: Add missing biblio <=> biblioitems <=> items relationships to the schema among others...