[Koha-cvs] CVS: koha/C4 Biblio.pm,1.86,1.87 Koha.pm,1.16,1.17

Paul POULAIN tipaul at users.sourceforge.net
Tue May 18 13:54:11 CEST 2004


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6853/C4

Modified Files:
	Biblio.pm Koha.pm 
Log Message:
getitemtypes moved in Koha.pm

Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.86
retrieving revision 1.87
diff -C2 -r1.86 -r1.87
*** Biblio.pm	3 May 2004 09:19:22 -0000	1.86
--- Biblio.pm	18 May 2004 11:54:07 -0000	1.87
***************
*** 41,45 ****
  	     &modsubtitle &modsubject &modaddauthor &moditem &countitems
  	     &delitem &deletebiblioitem &delbiblio
! 	     &getitemtypes &getbiblio
  	     &getbiblioitembybiblionumber
  	     &getbiblioitem &getitemsbybiblioitem
--- 41,45 ----
  	     &modsubtitle &modsubject &modaddauthor &moditem &countitems
  	     &delitem &deletebiblioitem &delbiblio
! 	     &getbiblio
  	     &getbiblioitembybiblionumber
  	     &getbiblioitem &getitemsbybiblioitem
***************
*** 1868,1887 ****
  }
  
- sub getitemtypes {
-   my $dbh   = C4::Context->dbh;
-   my $sth   = $dbh->prepare("select * from itemtypes order by description");
-   my $count = 0;
-   my @results;
- 
-   $sth->execute;
-   while (my $data = $sth->fetchrow_hashref) {
-     $results[$count] = $data;
-     $count++;
-   } # while
- 
-   $sth->finish;
-   return($count, @results);
- } # sub getitemtypes
- 
  sub getbiblio {
      my ($biblionumber) = @_;
--- 1868,1871 ----
***************
*** 2195,2198 ****
--- 2179,2185 ----
  # $Id$
  # $Log$
+ # Revision 1.87  2004/05/18 11:54:07  tipaul
+ # getitemtypes moved in Koha.pm
+ #
  # Revision 1.86  2004/05/03 09:19:22  tipaul
  # some fixes for mysql prepare & execute

Index: Koha.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Koha.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** Koha.pm	4 May 2004 16:15:56 -0000	1.16
--- Koha.pm	18 May 2004 11:54:07 -0000	1.17
***************
*** 56,61 ****
  			&ethnicitycategories
  			&subfield_is_koha_internal_p
! 			&getbranches &getbranch &CGIbranches
  			&getprinters &getprinter
  			$DEBUG);
  
--- 56,62 ----
  			&ethnicitycategories
  			&subfield_is_koha_internal_p
! 			&getbranches &getbranch
  			&getprinters &getprinter
+ 			&getitemtypes &getitemtypeinfo
  			$DEBUG);
  
***************
*** 64,68 ****
  my $DEBUG = 0;
  
! =item slashifyDate
  
    $slash_date = &slashifyDate($dash_date);
--- 65,69 ----
  my $DEBUG = 0;
  
! =head2 slashifyDate
  
    $slash_date = &slashifyDate($dash_date);
***************
*** 80,84 ****
  }
  
! =item fixEthnicity
  
    $ethn_name = &fixEthnicity($ethn_code);
--- 81,85 ----
  }
  
! =head2 fixEthnicity
  
    $ethn_name = &fixEthnicity($ethn_code);
***************
*** 102,106 ****
  }
  
! =item borrowercategories
  
    ($codes_arrayref, $labels_hashref) = &borrowercategories();
--- 103,107 ----
  }
  
! =head2 borrowercategories
  
    ($codes_arrayref, $labels_hashref) = &borrowercategories();
***************
*** 128,132 ****
  }
  
! =item ethnicitycategories
  
    ($codes_arrayref, $labels_hashref) = &ethnicitycategories();
--- 129,133 ----
  }
  
! =head2 ethnicitycategories
  
    ($codes_arrayref, $labels_hashref) = &ethnicitycategories();
***************
*** 165,185 ****
  }
  
! =item getbranches
  
    $branches = &getbranches();
!   @branch_codes = keys %$branches;
!   %main_branch_info = %{$branches->{"MAIN"}};
  
- Returns information about existing library branches.
  
! C<$branches> is a reference-to-hash. Its keys are the branch codes for
! all of the existing library branches, and its values are
! references-to-hash describing that particular branch.
! 
! In each branch description (C<%main_branch_info>, above), there is a
! key for each field in the branches table of the Koha database. In
! addition, there is a key for each branch category code to which the
! branch belongs (the category codes are taken from the branchrelations
! table).
  
  =cut
--- 166,196 ----
  }
  
! =head2 getbranches
  
    $branches = &getbranches();
!   returns informations about branches.
!   Create a branch selector with the following code
!   
! =head3 in PERL SCRIPT
! 
! my $branches = getbranches;
! my @branchloop;
! foreach my $thisbranch (keys %$branches) {
! 	my $selected = 1 if $thisbranch eq $branch;
! 	my %row =(value => $thisbranch,
! 				selected => $selected,
! 				branchname => $branches->{$thisbranch}->{'branchname'},
! 			);
! 	push @branchloop, \%row;
! }
  
  
! =head3 in TEMPLATE  
! 			<select name="branch">
! 				<option value="">Default</option>
! 			<!-- TMPL_LOOP name="branchloop" -->
! 				<option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="branchname" --></option>
! 			<!-- /TMPL_LOOP -->
! 			</select>
  
  =cut
***************
*** 211,215 ****
  }
  
! =item getprinters
  
    $printers = &getprinters($env);
--- 222,294 ----
  }
  
! =head2 itemtypes
! 
!   $itemtypes = &getitemtypes();
! 
! Returns information about existing itemtypes.
! 
! build a HTML select with the following code :
! 
! =head3 in PERL SCRIPT
! 
! my $itemtypes = getitemtypes;
! my @itemtypesloop;
! foreach my $thisitemtype (keys %$itemtypes) {
! 	my $selected = 1 if $thisitemtype eq $itemtype;
! 	my %row =(value => $thisitemtype,
! 				selected => $selected,
! 				description => $itemtypes->{$thisitemtype}->{'description'},
! 			);
! 	push @itemtypesloop, \%row;
! }
! $template->param(itemtypeloop => \@itemtypesloop);
! 
! =head3 in TEMPLATE
! 
! <form action='<!-- TMPL_VAR name="script_name" -->' method=post>
! 	<select name="itemtype">
! 		<option value="">Default</option>
! 	<!-- TMPL_LOOP name="itemtypeloop" -->
! 		<option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="description" --></option>
! 	<!-- /TMPL_LOOP -->
! 	</select>
! 	<input type=text name=searchfield value="<!-- TMPL_VAR name="searchfield" -->">
! 	<input type="submit" value="OK" class="button">
! </form>
! 
! 
! =cut
! 
! sub getitemtypes {
! # returns a reference to a hash of references to branches...
! 	my %itemtypes;
! 	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("select * from itemtypes");
! 	$sth->execute;
! 	while (my $IT=$sth->fetchrow_hashref) {
! 			$itemtypes{$IT->{'itemtype'}}=$IT;
! 	}
! 	return (\%itemtypes);
! }
! 
! 
! =head2 itemtypes
! 
!   $itemtype = &getitemtype($itemtype);
! 
! Returns information about an itemtype.
! 
! =cut
! 
! sub getitemtypeinfo {
! 	my ($itemtype) = @_;
! 	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("select * from itemtypes where itemtype=?");
! 	$sth->execute($itemtype);
! 	my $res = $sth->fetchrow_hashref;
! 	return $res;
! }
! 
! =head2 getprinters
  
    $printers = &getprinters($env);
***************
*** 261,265 ****
  =head1 AUTHOR
  
! Pat Eyler, pate at gnu.org
  
  =cut
--- 340,344 ----
  =head1 AUTHOR
  
! Koha Team
  
  =cut





More information about the Koha-cvs mailing list