Bugzilla – Attachment 3755 Details for
Bug 6096
GetAllShelves has obfuscated return type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed Patch
0001-Bug-6096-Correctly-return-arrayref-from-GetAllShelve.patch (text/plain), 2.86 KB, created by
Colin Campbell
on 2011-04-06 15:37:13 UTC
(
hide
)
Description:
Proposed Patch
Filename:
MIME Type:
Creator:
Colin Campbell
Created:
2011-04-06 15:37:13 UTC
Size:
2.86 KB
patch
obsolete
>From 4c8c5bf73dfac61a9d0a605bbedb4b851b6d1e91 Mon Sep 17 00:00:00 2001 >From: Colin Campbell <colin.campbell@ptfs-europe.com> >Date: Wed, 6 Apr 2011 16:28:56 +0100 >Subject: [PATCH] Bug 6096 Correctly return arrayref from GetAllShelves >Content-Type: text/plain; charset="utf-8" > >Follow on from bug 5529 GetAllShelves was also vaguely stuffing >an arrayref into an array >Some signs of cut and paste (unnecessary @params variable) >Calling code now does not have to shuffle the return about >to get the reference. Also removed a debug warn >--- > C4/VirtualShelves.pm | 17 +++++++---------- > opac/opac-addbybiblionumber.pl | 11 ++++------- > 2 files changed, 11 insertions(+), 17 deletions(-) > >diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm >index 5bddadb..6ed7549 100644 >--- a/C4/VirtualShelves.pm >+++ b/C4/VirtualShelves.pm >@@ -220,9 +220,9 @@ sub GetRecentShelves { > > =head2 GetAllShelves > >- ($shelflist) = GetAllShelves($owner) >+ $shelflist = GetAllShelves($owner) > >-This function returns a references to an array of hashrefs containing all shelves sorted >+This function returns a reference to an array of hashrefs containing all shelves sorted > by the shelf name. > > This function is intended to return a dataset reflecting all the shelves for >@@ -230,15 +230,12 @@ the submitted parameters. > > =cut > >-sub GetAllShelves ($$) { >+sub GetAllShelves { > my ($category,$owner) = @_; >- my (@shelflist); >- my @params = ($category,$owner); >- my $query = "SELECT * FROM virtualshelves WHERE category = ? AND owner = ? ORDER BY shelfname ASC"; >- my $sth = $dbh->prepare($query); >- $sth->execute(@params); >- @shelflist = $sth->fetchall_arrayref({}); >- return ( \@shelflist ); >+ my $query = 'SELECT * FROM virtualshelves WHERE category = ? AND owner = ? ORDER BY shelfname ASC'; >+ my $sth = $dbh->prepare( $query ); >+ $sth->execute( $category, $owner ); >+ return $sth->fetchall_arrayref({}); > } > > =head2 GetShelf >diff --git a/opac/opac-addbybiblionumber.pl b/opac/opac-addbybiblionumber.pl >index c72afe5..fd3124b 100755 >--- a/opac/opac-addbybiblionumber.pl >+++ b/opac/opac-addbybiblionumber.pl >@@ -98,19 +98,16 @@ else { > } else { > > my $privateshelves = GetAllShelves(1,$loggedinuser); >- my @privateshelves = @{$privateshelves}; >- warn scalar($privateshelves); >- if(@privateshelves){ >+ if(@{$privateshelves}){ > $template->param ( >- privatevirtualshelves => @privateshelves, >+ privatevirtualshelves => $privateshelves, > existingshelves => 1 > ); > } > my $publicshelves = GetAllShelves(2,$loggedinuser); >- my @publicshelves = @{$publicshelves}; >- if(@publicshelves){ >+ if(@{$publicshelves}){ > $template->param ( >- publicvirtualshelves => @publicshelves, >+ publicvirtualshelves => $publicshelves, > existingshelves => 1 > ); > } >-- >1.7.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 6096
: 3755