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

Antoine Farnault antoine at koha-fr.org
Tue Nov 14 16:01:08 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	06/11/14 15:01:08

Modified files:
	C4             : Koha.pm 

Log message:
	* new function : GetAuthorisedValue($category);
	* fix some POD errors.

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

Patches:
Index: Koha.pm
===================================================================
RCS file: /sources/koha/koha/C4/Koha.pm,v
retrieving revision 1.40.2.20
retrieving revision 1.40.2.21
diff -u -b -r1.40.2.20 -r1.40.2.21
--- Koha.pm	13 Nov 2006 09:33:20 -0000	1.40.2.20
+++ Koha.pm	14 Nov 2006 15:01:08 -0000	1.40.2.21
@@ -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.20 2006/11/13 09:33:20 hdl Exp $
+# $Id: Koha.pm,v 1.40.2.21 2006/11/14 15:01:08 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.20 $' =~ /\d+/g; shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
+$VERSION = do { my @v = '$Revision: 1.40.2.21 $' =~ /\d+/g; shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 =head1 NAME
 
@@ -57,8 +57,7 @@
 	        &GetCcodes
 			&GetAuthItemlost
 			&GetAuthItembinding
-                        get_itemtypeinfos_of
-
+            &get_itemtypeinfos_of
             &getframeworks &getframeworkinfo
             &getauthtypes &getauthtype
 	    &getallthemes &GetLanguages
@@ -80,6 +79,7 @@
             &getitemtypeimagedir
             &getitemtypeimagesrc
             &getbranchname
+            &GetAuthorisedValues
             $DEBUG);
 
 use vars qw();
@@ -111,6 +111,7 @@
 Koha database ("European" or "Pacific Islander").
 
 =cut
+
 #'
 
 sub fixEthnicity($) {
@@ -550,6 +551,7 @@
     }
     return (\%printers);
 }
+
 sub getbranch ($$) {
     my($query, $branches) = @_; # get branch for this query from branches
     my $branch = $query->param('branch');
@@ -836,6 +838,7 @@
     }
 	return $facets;
 }
+
 =head2 get_branchinfos_of
 
   my $branchinfos_of = get_branchinfos_of(@branchcodes);
@@ -849,6 +852,7 @@
   print 'branchname is ', $branchinfos_of->{$code}->{branchname};
 
 =cut
+
 sub get_branchinfos_of {
     my @branchcodes = @_;
 
@@ -883,6 +887,7 @@
   print $barcode_of_item->{$itemnumber};
 
 =cut
+
 sub get_infos_of {
     my ($query, $key_name, $value_name) = @_;
 
@@ -924,6 +929,7 @@
   }
 
 =cut
+
 sub get_notforloan_label_of {
     my $dbh = C4::Context->dbh;
 
@@ -980,6 +986,7 @@
     return $sort_by_loop;
 
 }
+
 sub displayIndexes {
 	my $indexes = [
     { value => '', label => 'Keyword' },
@@ -1020,6 +1027,7 @@
 	];
 	return $indexes;
 }
+
 sub displaySubtypesLimit {
 	my $outer_subtype_limits_loop = [
 
@@ -1293,7 +1301,34 @@
     	return(@lib);
 	}
 	
+=head2 GetAuthorisedValues
+
+$authvalues = GetAuthorisedValues($category);
+
+this function get all authorised values from 'authosied_value' table into a reference to array which
+each value containt an hashref.
+
+Set C<$category> on input args if you want to limits your query to this one. This params is not mandatory.
+
+=cut
+
+sub GetAuthorisedValues {
+    my $category = shift;
+    my $dbh = C4::Context->dbh;
+    my $query ="SELECT * FROM authorised_values";
+    $query .=" WHERE category = '".$category."'" if $category;
+    
+    my $sth = $dbh->prepare($query);
+    $sth->execute;
+    my @authloop;
+    while(my $data = $sth->fetchrow_hashref){
+        push @authloop, $data;
+    }
+    return \@authloop;
+}
+
 1;
+
 __END__
 
 =back





More information about the Koha-cvs mailing list