Bugzilla – Attachment 56345 Details for
Bug 17094
Methods of Koha::Object[s]-based classed should not return DBIx::Class objects
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 17094: Make Koha::Virtualshelf methods return Koha::Objects-based objects
PASSED-QA-Bug-17094-Make-KohaVirtualshelf-methods-.patch (text/plain), 8.27 KB, created by
Martin Renvoize (ashimema)
on 2016-10-13 10:54:59 UTC
(
hide
)
Description:
[PASSED QA] Bug 17094: Make Koha::Virtualshelf methods return Koha::Objects-based objects
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2016-10-13 10:54:59 UTC
Size:
8.27 KB
patch
obsolete
>From 69673bc5e473be03864171f8739364677f9ca397 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 9 Aug 2016 16:26:07 +0100 >Subject: [PATCH] [PASSED QA] Bug 17094: Make Koha::Virtualshelf methods return > Koha::Objects-based objects > >Instead of DBIx::Class objects. > >Test plan: >1/ Add content to a list and share it with another patron >2/ Try to view the list with the other patron >3/ download and send a shelf and check if the biblio list is correct >4/ prove t/db_dependent/Virtualshelves.t should return green > >Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Virtualshelf.pm | 7 +++++-- > opac/opac-downloadshelf.pl | 4 ++-- > opac/opac-sendshelf.pl | 2 +- > opac/opac-shelves.pl | 7 +++++-- > virtualshelves/downloadshelf.pl | 4 ++-- > virtualshelves/sendshelf.pl | 2 +- > virtualshelves/shelves.pl | 12 ++++++++---- > 7 files changed, 24 insertions(+), 14 deletions(-) > >diff --git a/Koha/Virtualshelf.pm b/Koha/Virtualshelf.pm >index a693eba..4e45c31 100644 >--- a/Koha/Virtualshelf.pm >+++ b/Koha/Virtualshelf.pm >@@ -28,6 +28,7 @@ use Koha::Exceptions; > use Koha::Virtualshelfshare; > use Koha::Virtualshelfshares; > use Koha::Virtualshelfcontent; >+use Koha::Virtualshelfcontents; > > use base qw(Koha::Object); > >@@ -105,13 +106,15 @@ sub is_shelfname_valid { > > sub get_shares { > my ( $self ) = @_; >- my $shares = $self->{_result}->virtualshelfshares; >+ my $rs = $self->{_result}->virtualshelfshares; >+ my $shares = Koha::Virtualshelfshares->_new_from_dbic( $rs ); > return $shares; > } > > sub get_contents { > my ( $self ) = @_; >- my $contents = $self->{_result}->virtualshelfcontents; >+ my $rs = $self->{_result}->virtualshelfcontents; >+ my $contents = Koha::Virtualshelfcontents->_new_from_dbic( $rs ); > return $contents; > } > >diff --git a/opac/opac-downloadshelf.pl b/opac/opac-downloadshelf.pl >index 142577b..51769c4 100755 >--- a/opac/opac-downloadshelf.pl >+++ b/opac/opac-downloadshelf.pl >@@ -70,7 +70,7 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { > if ($format =~ /^\d+$/) { > my @biblios; > while ( my $content = $contents->next ) { >- push @biblios, $content->biblionumber->biblionumber; >+ push @biblios, $content->biblionumber; > } > $output = marc2csv(\@biblios, $format); > # Other formats >@@ -79,7 +79,7 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { > filters => 'ViewPolicy' > }); > while ( my $content = $contents->next ) { >- my $biblionumber = $content->biblionumber->biblionumber; >+ my $biblionumber = $content->biblionumber; > > my $record = GetMarcBiblio($biblionumber, 1); > my $framework = &GetFrameworkCode( $biblionumber ); >diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl >index a0682bc..242caca 100755 >--- a/opac/opac-sendshelf.pl >+++ b/opac/opac-sendshelf.pl >@@ -86,7 +86,7 @@ if ( $email ) { > my @results; > > while ( my $content = $contents->next ) { >- my $biblionumber = $content->biblionumber->biblionumber; >+ my $biblionumber = $content->biblionumber; > my $fw = GetFrameworkCode($biblionumber); > my $dat = GetBiblioData($biblionumber); > my $record = GetMarcBiblio($biblionumber, 1); >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index 065f517..b29ade6 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -28,6 +28,8 @@ use C4::Members; > use C4::Output; > use C4::Tags qw( get_tags ); > use C4::XSLT; >+ >+use Koha::Biblioitems; > use Koha::Virtualshelves; > use Koha::RecordProcessor; > >@@ -258,7 +260,7 @@ if ( $op eq 'view' ) { > my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' }); > my @items; > while ( my $content = $contents->next ) { >- my $biblionumber = $content->biblionumber->biblionumber; >+ my $biblionumber = $content->biblionumber; > my $this_item = GetBiblioData($biblionumber); > my $record = GetMarcBiblio($biblionumber); > my $framework = GetFrameworkCode( $biblionumber ); >@@ -274,7 +276,8 @@ if ( $op eq 'view' ) { > } > > my $marcflavour = C4::Context->preference("marcflavour"); >- my $itemtypeinfo = getitemtypeinfo( $content->biblionumber->biblioitems->first->itemtype, 'opac' ); >+ my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype; >+ my $itemtypeinfo = getitemtypeinfo( $itemtype, 'opac' ); > $this_item->{imageurl} = $itemtypeinfo->{imageurl}; > $this_item->{description} = $itemtypeinfo->{description}; > $this_item->{notforloan} = $itemtypeinfo->{notforloan}; >diff --git a/virtualshelves/downloadshelf.pl b/virtualshelves/downloadshelf.pl >index d988161..5a9f440 100755 >--- a/virtualshelves/downloadshelf.pl >+++ b/virtualshelves/downloadshelf.pl >@@ -64,13 +64,13 @@ if ($shelfid && $format) { > if ($format =~ /^\d+$/) { > my @biblios; > while ( my $content = $contents->next ) { >- push @biblios, $content->biblionumber->biblionumber; >+ push @biblios, $content->biblionumber; > } > $output = marc2csv(\@biblios, $format); > } > else { #Other formats > while ( my $content = $contents->next ) { >- my $biblionumber = $content->biblionumber->biblionumber; >+ my $biblionumber = $content->biblionumber; > my $record = GetMarcBiblio($biblionumber, 1); > if ($format eq 'iso2709') { > $output .= $record->as_usmarc(); >diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl >index 02999ea..1226d3e 100755 >--- a/virtualshelves/sendshelf.pl >+++ b/virtualshelves/sendshelf.pl >@@ -77,7 +77,7 @@ if ($email) { > my @results; > > while ( my $content = $contents->next ) { >- my $biblionumber = $content->biblionumber->biblionumber; >+ my $biblionumber = $content->biblionumber; > my $fw = GetFrameworkCode($biblionumber); > my $dat = GetBiblioData($biblionumber); > my $record = GetMarcBiblio($biblionumber, 1); >diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl >index 11a90ae..691e215 100755 >--- a/virtualshelves/shelves.pl >+++ b/virtualshelves/shelves.pl >@@ -27,6 +27,8 @@ use C4::Members; > use C4::Output; > use C4::XSLT; > >+use Koha::Biblios; >+use Koha::Biblioitems; > use Koha::CsvProfiles; > use Koha::Virtualshelves; > >@@ -223,7 +225,7 @@ if ( $op eq 'view' ) { > my @items; > while ( my $content = $contents->next ) { > my $this_item; >- my $biblionumber = $content->biblionumber->biblionumber; >+ my $biblionumber = $content->biblionumber; > my $record = GetMarcBiblio($biblionumber); > > if ( $xslfile ) { >@@ -232,9 +234,11 @@ if ( $op eq 'view' ) { > } > > my $marcflavour = C4::Context->preference("marcflavour"); >- my $itemtypeinfo = getitemtypeinfo( $content->biblionumber->biblioitems->first->itemtype, 'intranet' ); >- $this_item->{title} = $content->biblionumber->title; >- $this_item->{author} = $content->biblionumber->author; >+ my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype; >+ my $itemtypeinfo = getitemtypeinfo( $itemtype, 'intranet' ); >+ my $biblio = Koha::Biblios->find( $content->biblionumber ); >+ $this_item->{title} = $biblio->title; >+ $this_item->{author} = $biblio->author; > $this_item->{dateadded} = $content->dateadded; > $this_item->{imageurl} = $itemtypeinfo->{imageurl}; > $this_item->{description} = $itemtypeinfo->{description}; >-- >2.1.4
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 17094
:
54239
|
54240
|
54795
|
54796
| 56345