Bugzilla – Attachment 59610 Details for
Bug 17846
Remove C4::Koha::get_infos_of
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17846: Remove C4::Koha::get_infos_of
Bug-17846-Remove-C4Kohagetinfosof.patch (text/plain), 3.57 KB, created by
Marcel de Rooy
on 2017-01-27 09:37:33 UTC
(
hide
)
Description:
Bug 17846: Remove C4::Koha::get_infos_of
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-01-27 09:37:33 UTC
Size:
3.57 KB
patch
obsolete
>From dd05282af4bb9b5406623b8e5ae2d0cd0887d53d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 4 Jan 2017 12:39:18 +0100 >Subject: [PATCH] Bug 17846: Remove C4::Koha::get_infos_of >Content-Type: text/plain; charset=utf-8 > >This subroutine does not longer make any senses. The call to >get_infos_of can be replaced with $dbh->selectall_hashref. >The third argument of this subroutine was never used. > >Test plan (for developer only): >Compare the 2 codes and confirm that they are equivalent > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Biblio.pm | 3 ++- > C4/Items.pm | 3 ++- > C4/Koha.pm | 48 ------------------------------------------------ > 3 files changed, 4 insertions(+), 50 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 6d0c9bb..ef2e432 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1052,6 +1052,7 @@ sub GetBiblioItemInfosOf { > > my $biblioitemnumber_values = @biblioitemnumbers ? join( ',', @biblioitemnumbers ) : "''"; > >+ my $dbh = C4::Context->dbh; > my $query = " > SELECT biblioitemnumber, > publicationyear, >@@ -1059,7 +1060,7 @@ sub GetBiblioItemInfosOf { > FROM biblioitems > WHERE biblioitemnumber IN ($biblioitemnumber_values) > "; >- return get_infos_of( $query, 'biblioitemnumber' ); >+ return $dbh->selectall_hashref($query, 'biblioitemnumber'); > } > > =head1 FUNCTIONS FOR HANDLING MARC MANAGEMENT >diff --git a/C4/Items.pm b/C4/Items.pm >index 3330a1f..e014a51 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -1200,12 +1200,13 @@ sub GetItemInfosOf { > > my $itemnumber_values = @itemnumbers ? join( ',', @itemnumbers ) : "''"; > >+ my $dbh = C4::Context->dbh; > my $query = " > SELECT * > FROM items > WHERE itemnumber IN ($itemnumber_values) > "; >- return get_infos_of( $query, 'itemnumber' ); >+ return $dbh->selectall_hashref($query, 'itemnumber'); > } > > =head2 GetItemsByBiblioitemnumber >diff --git a/C4/Koha.pm b/C4/Koha.pm >index b6e494a..4a40263 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -656,54 +656,6 @@ sub getFacets { > return $facets; > } > >-=head2 get_infos_of >- >-Return a href where a key is associated to a href. You give a query, >-the name of the key among the fields returned by the query. If you >-also give as third argument the name of the value, the function >-returns a href of scalar. The optional 4th argument is an arrayref of >-items passed to the C<execute()> call. It is designed to bind >-parameters to any placeholders in your SQL. >- >- my $query = ' >-SELECT itemnumber, >- notforloan, >- barcode >- FROM items >-'; >- >- # generic href of any information on the item, href of href. >- my $iteminfos_of = get_infos_of($query, 'itemnumber'); >- print $iteminfos_of->{$itemnumber}{barcode}; >- >- # specific information, href of scalar >- my $barcode_of_item = get_infos_of($query, 'itemnumber', 'barcode'); >- print $barcode_of_item->{$itemnumber}; >- >-=cut >- >-sub get_infos_of { >- my ( $query, $key_name, $value_name, $bind_params ) = @_; >- >- my $dbh = C4::Context->dbh; >- >- my $sth = $dbh->prepare($query); >- $sth->execute( @$bind_params ); >- >- my %infos_of; >- while ( my $row = $sth->fetchrow_hashref ) { >- if ( defined $value_name ) { >- $infos_of{ $row->{$key_name} } = $row->{$value_name}; >- } >- else { >- $infos_of{ $row->{$key_name} } = $row; >- } >- } >- $sth->finish; >- >- return \%infos_of; >-} >- > =head2 get_notforloan_label_of > > my $notforloan_label_of = get_notforloan_label_of(); >-- >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 17846
:
58587
|
58588
|
58595
|
58596
|
58597
| 59610 |
59611