[Koha-cvs] koha/C4 Koha.pm [rel_3_0]

Antoine Farnault antoine at koha-fr.org
Mon Jan 8 18:07:29 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	07/01/08 17:07:29

Modified files:
	C4             : Koha.pm 

Log message:
	sync with dev_week. (new function: GetKohaAuthorisedValues)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Koha.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.40.2.29&r2=1.40.2.30

Patches:
Index: Koha.pm
===================================================================
RCS file: /sources/koha/koha/C4/Koha.pm,v
retrieving revision 1.40.2.29
retrieving revision 1.40.2.30
diff -u -b -r1.40.2.29 -r1.40.2.30
--- Koha.pm	19 Dec 2006 16:48:16 -0000	1.40.2.29
+++ Koha.pm	8 Jan 2007 17:07:28 -0000	1.40.2.30
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Koha.pm,v 1.40.2.29 2006/12/19 16:48:16 alaurin Exp $
+# $Id: Koha.pm,v 1.40.2.30 2007/01/08 17:07:28 toins Exp $
 
 use strict;
 require Exporter;
@@ -25,7 +25,7 @@
 use C4::Output;
 use vars qw($VERSION @ISA @EXPORT);
 
-$VERSION = do { my @v = '$Revision: 1.40.2.29 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.40.2.30 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -77,6 +77,7 @@
   &getitemtypeimagedir
   &getitemtypeimagesrc
   &GetAuthorisedValues
+  &GetKohaAuthorisedValues
   $DEBUG
   );
 
@@ -1511,6 +1512,31 @@
     return \@authloop;
 }
 
+=head2 GetKohaAuthorisedValues
+	
+	Takes $dbh , $kohafield as parameters.
+	returns hashref of authvalCode => liblibrarian
+	or undef if no authvals defined for kohafield.
+
+=cut
+
+sub getKohaAuthorisedValues {
+	my ($dbh, $kohafield) = @_;
+	my %values;
+    my   $sthnflstatus = $dbh->prepare('select authorised_value from marc_subfield_structure where kohafield=?');
+        $sthnflstatus->execute($kohafield);
+    my    $authorised_valuecode = $sthnflstatus->fetchrow;
+        if ($authorised_valuecode) {  
+            $sthnflstatus = $dbh->prepare("select authorised_value, lib from authorised_values where category=? ");
+            $sthnflstatus->execute($authorised_valuecode);
+            while ( my ($val, $lib) = $sthnflstatus->fetchrow_array ) { 
+				$values{$val}= $lib;
+			}
+		}
+	return \%values;
+}
+
+
 1;
 
 __END__





More information about the Koha-cvs mailing list