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

Bruno Toumi btoumi at ouestprovence.fr
Mon Sep 25 15:43:06 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Bruno Toumi <btoumi>	06/09/25 13:43:06

Modified files:
	C4             : Members.pm 

Log message:
	add missing function : getcities and getroadtypes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Members.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.32.2.1&r2=1.32.2.2

Patches:
Index: Members.pm
===================================================================
RCS file: /sources/koha/koha/C4/Members.pm,v
retrieving revision 1.32.2.1
retrieving revision 1.32.2.2
diff -u -b -r1.32.2.1 -r1.32.2.2
--- Members.pm	29 Aug 2006 07:27:13 -0000	1.32.2.1
+++ Members.pm	25 Sep 2006 13:43:06 -0000	1.32.2.2
@@ -19,7 +19,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Members.pm,v 1.32.2.1 2006/08/29 07:27:13 toins Exp $
+# $Id: Members.pm,v 1.32.2.2 2006/09/25 13:43:06 btoumi Exp $
 
 use strict;
 require Exporter;
@@ -31,7 +31,7 @@
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
 
-$VERSION = do { my @v = '$Revision: 1.32.2.1 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.32.2.2 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -65,6 +65,7 @@
   &ethnicitycategories get_institutions add_member_orgs
   &get_age &GetBorrowersFromSurname &GetBranchCodeFromBorrowers
   &GetFlagsAndBranchFromBorrower
+ &GetCities &GetRoadTypes
 );
 
 
@@ -1373,6 +1374,90 @@
      return ($count,\@results);
 }
 
+
+
+
+
+
+=head2 citycaracteristiques (OUEST-PROVENCE)
+
+  ($id_cityarrayref, $city_hashref) = &citycaracteristic();
+
+Looks up the different city and zip in the database. Returns two
+elements: a reference-to-array, which lists the zip city
+codes, and a reference-to-hash, which maps the name of the city.
+WHERE =>OUEST PROVENCE OR EXTERIEUR
+
+=cut
+sub GetCities {
+    #my ($type_city) = @_;
+    my $dbh = C4::Context->dbh;
+    my $sth=$dbh->prepare("Select cityid,city_name from cities order by cityid  ");
+    #$sth->execute($type_city);
+    $sth->execute();    
+    my %city;
+    my @id;
+#    insert empty value to create a empty choice in cgi popup 
+	 
+while (my $data=$sth->fetchrow_hashref){
+      
+	push @id,$data->{'cityid'};
+      $city{$data->{'cityid'}}=$data->{'city_name'};
+    }
+	
+	#test to know if the table contain some records if no the function return nothing
+	my $id=@id;
+	$sth->finish;
+	if ($id eq 0)
+	{
+	return();
+	}
+	else{
+	unshift (@id ,"");
+	return(\@id,\%city);
+	}
+}
+
+
+=head2 roadtypecaracteristic (OUEST-PROVENCE)
+
+  ($idroadtypearrayref, $roadttype_hashref) = &roadtypecaracteristic();
+
+Looks up the different road type . Returns two
+elements: a reference-to-array, which lists the id_roadtype
+codes, and a reference-to-hash, which maps the road type of the road .
+
+
+=cut
+sub GetRoadTypes {
+    my $dbh = C4::Context->dbh;
+    my $sth=$dbh->prepare("Select roadtypeid,road_type from roadtype order by road_type  ");
+    $sth->execute();    
+    my %roadtype;
+    my @id;
+#    insert empty value to create a empty choice in cgi popup 
+	 
+while (my $data=$sth->fetchrow_hashref){
+      
+	push @id,$data->{'roadtypeid'};
+      $roadtype{$data->{'roadtypeid'}}=$data->{'road_type'};
+    }
+	
+	#test to know if the table contain some records if no the function return nothing
+	my $id=@id;
+	$sth->finish;
+	if ($id eq 0)
+	{
+	return();
+	}
+	else{
+	unshift (@id ,"");
+	return(\@id,\%roadtype);
+	}
+}
+
+
+
 END { }       # module clean-up code here (global destructor)
 
 1;





More information about the Koha-cvs mailing list