[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 Koha.pm [rel_3_0]
From: |
Antoine Farnault |
Subject: |
[Koha-cvs] koha/C4 Koha.pm [rel_3_0] |
Date: |
Tue, 31 Oct 2006 17:21:59 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_3_0
Changes by: Antoine Farnault <toins> 06/10/31 17:21:59
Modified files:
C4 : Koha.pm
Log message:
GetBranches was writed twice & getbranchname was not exported.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Koha.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.40.2.17&r2=1.40.2.18
Patches:
Index: Koha.pm
===================================================================
RCS file: /sources/koha/koha/C4/Koha.pm,v
retrieving revision 1.40.2.17
retrieving revision 1.40.2.18
diff -u -b -r1.40.2.17 -r1.40.2.18
--- Koha.pm 23 Oct 2006 16:52:35 -0000 1.40.2.17
+++ Koha.pm 31 Oct 2006 17:21:58 -0000 1.40.2.18
@@ -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.17 2006/10/23 16:52:35 tipaul Exp $
+# $Id: Koha.pm,v 1.40.2.18 2006/10/31 17:21:58 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.17 $' =~ /\d+/g; shift(@v) . "." .
join("_", map {sprintf "%03d", $_ } @v); };
+$VERSION = do { my @v = '$Revision: 1.40.2.18 $' =~ /\d+/g; shift(@v) . "." .
join("_", map {sprintf "%03d", $_ } @v); };
=head1 NAME
@@ -80,6 +80,7 @@
&GetDepartementLib
&getitemtypeimagedir
&getitemtypeimagesrc
+ &getbranchname
$DEBUG);
use vars qw();
@@ -222,70 +223,9 @@
$sth->execute($branchcode);
my $branchname = $sth->fetchrow_array;
$sth->finish;
-
return($branchname);
}
-=head2 GetBranches
-
- $branches = &GetBranches();
- returns informations about ALL branches.
- Create a branch selector with the following code
- IndependantBranches Insensitive...
-
-=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
-
-
-sub GetBranches {
-# returns a reference to a hash of references to ALL branches...
- my %branches;
- my $dbh = C4::Context->dbh;
- my $sth;
- $sth = $dbh->prepare("Select * from branches order by branchname");
- $sth->execute;
- while (my $branch=$sth->fetchrow_hashref) {
- my $nsth = $dbh->prepare("select categorycode from branchrelations
where branchcode = ?");
- $nsth->execute($branch->{'branchcode'});
- while (my ($cat) = $nsth->fetchrow_array) {
- # FIXME - This seems wrong. It ought to be
- # $branch->{categorycodes}{$cat} = 1;
- # otherwise, there's a namespace collision if there's a
- # category with the same name as a field in the 'branches'
- # table (i.e., don't create a category called "issuing").
- # In addition, the current structure doesn't really allow
- # you to list the categories that a branch belongs to:
- # you'd have to list keys %$branch, and remove those keys
- # that aren't fields in the "branches" table.
- $branch->{$cat} = 1;
- }
- $branches{$branch->{'branchcode'}}=$branch;
- }
- return (\%branches);
-}
-
-
=head2 GetItemTypes
$itemtypes = &GetItemTypes();
- [Koha-cvs] koha/C4 Koha.pm [rel_3_0], Antoine Farnault, 2006/10/02
- [Koha-cvs] koha/C4 Koha.pm [rel_3_0], Antoine Farnault, 2006/10/03
- [Koha-cvs] koha/C4 Koha.pm [rel_3_0], Antoine Farnault, 2006/10/03
- [Koha-cvs] koha/C4 Koha.pm [rel_3_0], Antoine Farnault, 2006/10/09
- [Koha-cvs] koha/C4 Koha.pm [rel_3_0], Antoine Farnault, 2006/10/17
- [Koha-cvs] koha/C4 Koha.pm [rel_3_0], Antoine Farnault, 2006/10/17
- [Koha-cvs] koha/C4 Koha.pm [rel_3_0], Antoine Farnault, 2006/10/18
- [Koha-cvs] koha/C4 Koha.pm [rel_3_0], Antoine Farnault, 2006/10/19
- [Koha-cvs] koha/C4 Koha.pm [rel_3_0],
Antoine Farnault <=