Bugzilla – Attachment 3318 Details for
Bug 5880
C4/Koha.pm : adding two functions GetAuthorisedValueByCode and GetKohaImageurlFromAuthorisedValues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed Patch
0001-Bug-5880-C4-Koha.pm-adding-two-functions-GetAutorise.patch (text/plain), 2.19 KB, created by
Chris Cormack
on 2011-03-16 03:07:07 UTC
(
hide
)
Description:
Proposed Patch
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-03-16 03:07:07 UTC
Size:
2.19 KB
patch
obsolete
>From ef329c7f0b0e3d614f4ded4253feaf98de69da76 Mon Sep 17 00:00:00 2001 >From: Paul Poulain <paul.poulain@biblibre.com> >Date: Wed, 15 Dec 2010 13:58:11 +0100 >Subject: [PATCH] Bug 5880 : C4/Koha.pm : adding two functions GetAutorisedValueByCode and GetKohaImageurlFromAuthorisedValues > >just for convenience >--- > C4/Koha.pm | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 40 insertions(+), 0 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 2bdcc28..2f94aa0 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -57,6 +57,8 @@ BEGIN { > &GetKohaAuthorisedValues > &GetKohaAuthorisedValuesFromField > &GetKohaAuthorisedValueLib >+ &GetAuthorisedValueByCode >+ &GetKohaImageurlFromAuthorisedValues > &GetAuthValCode > &GetNormalizedUPC > &GetNormalizedISBN >@@ -941,6 +943,25 @@ sub displayServers { > return \@primaryserverloop; > } > >+ >+=head2 GetKohaImageurlFromAuthorisedValues >+ >+$authhorised_value = GetKohaImageurlFromAuthorisedValues( $category, $authvalcode ); >+ >+Return the first url of the authorised value image represented by $lib. >+ >+=cut >+ >+sub GetKohaImageurlFromAuthorisedValues { >+ my ( $category, $lib ) = @_; >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare("SELECT imageurl FROM authorised_values WHERE category=? AND lib =?"); >+ $sth->execute( $category, $lib ); >+ while ( my $data = $sth->fetchrow_hashref ) { >+ return $data->{'imageurl'}; >+ } >+} >+ > =head2 GetAuthValCode > > $authvalcode = GetAuthValCode($kohafield,$frameworkcode); >@@ -1035,6 +1056,25 @@ sub GetAuthorisedValueCategories { > return \@results; > } > >+=head2 GetAuthorisedValueByCode >+ >+$authhorised_value = GetAuthorisedValueByCode( $category, $authvalcode ); >+ >+Return an hashref of the authorised value represented by $authvalcode. >+ >+=cut >+ >+sub GetAuthorisedValueByCode { >+ my ( $category, $authvalcode ) = @_; >+ >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare("SELECT lib FROM authorised_values WHERE category=? AND authorised_value =?"); >+ $sth->execute( $category, $authvalcode ); >+ while ( my $data = $sth->fetchrow_hashref ) { >+ return $data->{'lib'}; >+ } >+} >+ > =head2 GetKohaAuthorisedValues > > Takes $kohafield, $fwcode as parameters. >-- >1.7.1 >
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 5880
: 3318 |
3336
|
3340
|
3399