Bugzilla – Attachment 29544 Details for
Bug 11518
Add new method to Koha::Schema::Result::Item that will always return the correct itemtype
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[NOT-PUSHED]Bug 11518: WIP - Remove useless constraints previously added
Bug-11518-WIP---Remove-useless-constraints-previou.patch (text/plain), 2.60 KB, created by
Jonathan Druart
on 2014-07-07 12:59:50 UTC
(
hide
)
Description:
[NOT-PUSHED]Bug 11518: WIP - Remove useless constraints previously added
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-07-07 12:59:50 UTC
Size:
2.60 KB
patch
obsolete
>From 1f0614a4c9b1126de0294bca86a3843923aacb68 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 7 Jul 2014 14:57:25 +0200 >Subject: [PATCH] Bug 11518: WIP - Remove useless constraints previously added > >This patch removes the 3 constraints added by patch from bug 11518. >Having 1-n + 1-1 relations for the same field is a non-sense. >--- > Koha/Schema/Result/Biblio.pm | 11 ++++++----- > Koha/Schema/Result/Item.pm | 16 +++++----------- > t/db_dependent/Items.t | 3 +-- > 3 files changed, 12 insertions(+), 18 deletions(-) > >diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm >index 5f2e399..2b4305a 100644 >--- a/Koha/Schema/Result/Biblio.pm >+++ b/Koha/Schema/Result/Biblio.pm >@@ -331,10 +331,11 @@ __PACKAGE__->many_to_many("sets", "oai_sets_biblios", "set"); > # 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( >- "biblioitem", >- "Koha::Schema::Result::Biblioitem", >- { "foreign.biblionumber" => "self.biblionumber" } >-); >+sub biblioitem { >+ my ( $self ) = @_; >+ my @biblioitems = $self->biblioitems; >+ return $biblioitems[0]; >+} > > 1; >+ >diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm >index fd50d15..e4bb045 100644 >--- a/Koha/Schema/Result/Item.pm >+++ b/Koha/Schema/Result/Item.pm >@@ -612,17 +612,11 @@ __PACKAGE__->might_have( > # Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-12-19 06:29:02 > # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:h6fPG62SifJ5T8QKPZNBBw > >-__PACKAGE__->belongs_to( >- "biblio", >- "Koha::Schema::Result::Biblio", >- { "foreign.biblionumber" => "self.biblionumber" } >-); >- >-__PACKAGE__->belongs_to( >- "biblioitem", >- "Koha::Schema::Result::Biblioitem", >- { biblioitemnumber => "biblioitemnumber" }, >-); >+sub biblioitem { >+ my ( $self ) = @_; >+ my @biblioitems = $self->biblioitemnumber; >+ return $biblioitems[0]; >+} > > sub effective_itemtype { > my ( $self ) = @_; >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index f5561fc..30a7684 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -204,8 +204,7 @@ subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { > } > ); > >- my $biblioitem = $biblio->biblioitem(); >- my ( $item ) = $biblioitem->items(); >+ my ( $item ) = $biblio->biblioitem->items(); > > C4::Context->set_preference( 'item-level_itypes', 0 ); > ok( $item->effective_itemtype() eq 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' ); >-- >2.0.0.rc2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11518
:
24121
|
24143
|
25448
|
25510
|
26983
|
26985
|
26987
|
27343
|
27344
|
27345
|
27346
|
27347
|
27348
|
29544
|
31240
|
31241
|
31242