From 7e8ff3f4b8d640db1fabf31d083c9c91a4decc11 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 12 May 2008 08:32:50 -0500 Subject: [PATCH] C4::Koha - added GetAuthorisedValueCategories New convenience function to get list of authorised value categories. No user-visible changes. Signed-off-by: Joshua Ferraro --- C4/Koha.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/C4/Koha.pm b/C4/Koha.pm index c473644f7a..af9b91365e 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -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. -- 2.39.5