[Koha-cvs] CVS: koha/C4 Output.pm,1.6.2.8,1.6.2.9

Alan Millar amillar at users.sourceforge.net
Wed Jun 26 09:21:30 CEST 2002


Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv19686/C4

Modified Files:
      Tag: rel-1-2
	Output.pm 
Log Message:
Subroutine for pull-down list from key table

Index: Output.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Output.pm,v
retrieving revision 1.6.2.8
retrieving revision 1.6.2.9
diff -C2 -r1.6.2.8 -r1.6.2.9
*** Output.pm	25 Apr 2002 23:35:17 -0000	1.6.2.8
--- Output.pm	26 Jun 2002 07:21:28 -0000	1.6.2.9
***************
*** 1,3 ****
! package C4::Output; #asummes C4/Output
  
  #package to deal with marking up output
--- 1,5 ----
! package C4::Output;
! 
! # $Id$
  
  #package to deal with marking up output
***************
*** 8,11 ****
--- 10,15 ----
  require Exporter;
  
+ use C4::Database;
+ 
  use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
  
***************
*** 14,20 ****
  
  @ISA = qw(Exporter);
! @EXPORT = qw(&startpage &endpage &mktablehdr &mktableft &mktablerow &mklink
! &startmenu &endmenu &mkheadr &center &endcenter &mkform &mkform2 &bold
! &gotopage &mkformnotable &mkform3);
  %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
  
--- 18,30 ----
  
  @ISA = qw(Exporter);
! @EXPORT = qw(
! 	&startpage &endpage 
! 	&mktablehdr &mktableft &mktablerow &mklink
! 	&startmenu &endmenu &mkheadr 
! 	&center &endcenter 
! 	&mkform &mkform2 &bold
! 	&gotopage &mkformnotable &mkform3
! 	&getkeytableselectoptions
! );
  %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
  
***************
*** 456,461 ****
  }
  
! END { }       # module clean-up code here (global destructor)
!     
  
  
--- 466,512 ----
  }
  
! #---------------------------------------------
! # Create an HTML option list for a <SELECT> form tag by using
! #    values from a DB file
! sub getkeytableselectoptions {
! 	use strict;
! 	# inputs
! 	my (
! 		$dbh,		# DBI handle
! 		$tablename,	# name of table containing list of choices
! 		$keyfieldname,	# column name of code to use in option list
! 		$descfieldname,	# column name of descriptive field
! 		$showkey,	# flag to show key in description
! 	)=@_;
! 	my $selectclause;	# return value
! 
! 	my (
! 		$sth, $query, 
! 		$key, $desc, $orderfieldname,
! 	);
! 	my $debug=0;
! 
!     	requireDBI($dbh,"getkeytableselectoptions");
! 
! 	if ( $showkey ) {
! 		$orderfieldname=$keyfieldname;
! 	} else {
! 		$orderfieldname=$descfieldname;
! 	}
! 	$query= "select $keyfieldname,$descfieldname
! 		from $tablename
! 		order by $orderfieldname ";
! 	print "<PRE>Query=$query </PRE>\n" if $debug; 
! 	$sth=$dbh->prepare($query);
! 	$sth->execute;
! 	while ( ($key, $desc) = $sth->fetchrow) {
! 	    if ($showkey || ! $desc ) { $desc="$key - $desc"; }
! 	    $selectclause.="<option value='$key'>$desc\n";
! 	    print "<PRE>Sel=$selectclause </PRE>\n" if $debug; 
! 	}
! 	return $selectclause;
! } # sub getkeytableselectoptions
  
+ #---------------------------------
  
+ END { }       # module clean-up code here (global destructor)





More information about the Koha-cvs mailing list