[Koha-bugs] [Bug 11518] Add new method to Koha::Schema::Result::Item that will always return the correct itemtype

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Dec 1 03:21:13 CET 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11518

--- Comment #31 from David Cook <dcook at prosentient.com.au> ---
Comment on attachment 27345
  --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=27345
[PASSED QA] Bug 11518 - Add new method to Koha::Schema::Result::Item that will
always return the correct itemtype

Review of attachment 27345:
 --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=11518&attachment=27345)
-----------------------------------------------------------------

::: Koha/Schema/Result/Biblio.pm
@@ +331,4 @@
>  # Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
>  # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0//8OGf7OteNnwT03g4QsA
>  
> +__PACKAGE__->belongs_to(

I think this already exists in master...

...and that it's not a good idea. biblio.biblionumber is a primary key. If
anything, biblioitems.biblio should have a belongs_to() relationship to
biblio.biblionumber rather than the other way around.

Of course, I think this is here so that we can grab the associated BiblioItems
object using the 'biblioitem' accessor... but it seems like a hack to me.

::: Koha/Schema/Result/Item.pm
@@ +618,4 @@
>      { "foreign.biblionumber" => "self.biblionumber" }
>  );
>  
> +__PACKAGE__->belongs_to(

I think this relationship makes sense, but if we're adding a relationship in
DBIC, we should probably be adding it in the database as well.

@@ +624,5 @@
> +  { biblioitemnumber => "biblioitemnumber" },
> +);
> +
> +use C4::Context;
> +sub itemtype {

I think this makes sense (insofar as it makes sense to have an item type stored
at the biblio level that is).

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list