[Koha-cvs] CVS: koha/C4 Input.pm,1.16,1.16.4.1
Henri-Damien LAURENT
hdl at users.sourceforge.net
Tue Jun 28 13:52:01 CEST 2005
Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28209/C4
Modified Files:
Tag: rel_2_2
Input.pm
Log Message:
Adding choice lists for sort1/Sort2 For biblios and patrons management.
Commiting along Help Modifications
Index: Input.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Input.pm,v
retrieving revision 1.16
retrieving revision 1.16.4.1
diff -C2 -r1.16 -r1.16.4.1
*** Input.pm 28 Nov 2003 14:06:57 -0000 1.16
--- Input.pm 28 Jun 2005 11:51:58 -0000 1.16.4.1
***************
*** 50,53 ****
--- 50,54 ----
@EXPORT = qw(
&checkdigit &checkvalidisbn
+ &buildCGIsort
);
***************
*** 172,175 ****
--- 173,211 ----
} # sub checkvalidisbn
+ =item buildCGISort
+
+ $CGIScrollingList = &BuildCGISort($name string, $input_name string);
+
+ Returns the scrolling list with name $input_name, built on authorised Values named $name.
+ Returns NULL if no authorised values found
+
+ =cut
+ sub buildCGIsort {
+ use strict;
+ my ($name,$input_name,$data) = @_;
+ my $dbh=C4::Context->dbh;
+ my $query=qq{SELECT * FROM authorised_values WHERE category=?};
+ my $sth=$dbh->prepare($query);
+ $sth->execute($name);
+ my $CGISort;
+ if ($sth->rows>0){
+ my @values;
+ my %labels;
+ for (my $i =0;$i<=$sth->rows;$i++){
+ my $results = $sth->fetchrow_hashref;
+ push @values, $results->{authorised_value};
+ $labels{$results->{authorised_value}}=$results->{lib};
+ }
+ $CGISort= CGI::scrolling_list(
+ -name => $input_name,
+ -values => \@values,
+ -labels => \%labels,
+ -default=> $data,
+ -size => 1,
+ -multiple => 0);
+ }
+ $sth->finish;
+ return $CGISort;
+ }
END { } # module clean-up code here (global destructor)
More information about the Koha-cvs
mailing list