C4::Koha - added GetAuthorisedValueCategories
authorGalen Charlton <galen.charlton@liblime.com>
Mon, 12 May 2008 13:32:50 +0000 (08:32 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Mon, 12 May 2008 14:03:02 +0000 (09:03 -0500)
New convenience function to get list of authorised
value categories.

No user-visible changes.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Koha.pm

index c473644..af9b913 100644 (file)
@@ -51,6 +51,7 @@ BEGIN {
                &getitemtypeimagedir
                &getitemtypeimagesrc
                &GetAuthorisedValues
+               &GetAuthorisedValueCategories
                &GetKohaAuthorisedValues
                &GetAuthValCode
                &GetManagedTagSubfields
@@ -969,6 +970,26 @@ sub GetAuthorisedValues {
     return \@results; #$data;
 }
 
+=head2 GetAuthorisedValueCategories
+
+$auth_categories = GetAuthorisedValueCategories();
+
+Return an arrayref of all of the available authorised
+value categories.
+
+=cut
+
+sub GetAuthorisedValueCategories {
+    my $dbh = C4::Context->dbh;
+    my $sth = $dbh->prepare("SELECT DISTINCT category FROM authorised_values ORDER BY category");
+    $sth->execute;
+    my @results;
+    while (my $category = $sth->fetchrow_array) {
+        push @results, $category;
+    }
+    return \@results;
+}
+
 =head2 GetKohaAuthorisedValues
        
        Takes $kohafield, $fwcode as parameters.