koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Ryan Higgins
Subject: [Koha-cvs] koha/C4 Koha.pm [rel_2_2]
Date: Sun, 15 Jul 2007 16:45:06 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_2_2
Changes by:     Ryan Higgins <rych>     07/07/15 16:45:06

Modified files:
        C4             : Koha.pm 

Log message:
        adding getKohaAuthorisedValues sub

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Koha.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.22.2.9&r2=1.22.2.10

Patches:
Index: Koha.pm
===================================================================
RCS file: /sources/koha/koha/C4/Koha.pm,v
retrieving revision 1.22.2.9
retrieving revision 1.22.2.10
diff -u -b -r1.22.2.9 -r1.22.2.10
--- Koha.pm     20 Apr 2007 13:57:10 -0000      1.22.2.9
+++ Koha.pm     15 Jul 2007 16:45:06 -0000      1.22.2.10
@@ -62,7 +62,7 @@
                        &getframeworks &getframeworkinfo
                        &getauthtypes &getauthtype
                        &getallthemes &getalllanguages
-                       &getallbranches 
+                       &getallbranches &getKohaAuthorisedValues
                        $DEBUG);
 
 use vars qw();
@@ -344,6 +344,33 @@
        return (\%itemtypes);
 }
 
+=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;
+            }
+        } else {
+                       return undef;
+               }
+    return \%values;
+}
+
+
 =head2 getauthtypes
 
   $authtypes = &getauthtypes();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]