[Koha-cvs] koha/members memberentry.pl

Bruno Toumi btoumi at ouestprovence.fr
Fri Jun 9 17:10:40 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Changes by:	Bruno Toumi <btoumi>	06/06/09 15:10:40

Modified files:
	members        : memberentry.pl 

Log message:
	-bug fix :modify condition to autoinsert value in  city and zipcode field (in borrowers form 2)
	-add fonctionnality to affect good default value in $GIbranch 

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/members/memberentry.pl?cvsroot=koha&r1=1.27&r2=1.28

Patches:
Index: memberentry.pl
===================================================================
RCS file: /sources/koha/koha/members/memberentry.pl,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- memberentry.pl	7 Jun 2006 14:55:37 -0000	1.27
+++ memberentry.pl	9 Jun 2006 15:10:39 -0000	1.28
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: memberentry.pl,v 1.27 2006/06/07 14:55:37 btoumi Exp $
+# $Id: memberentry.pl,v 1.28 2006/06/09 15:10:39 btoumi Exp $
 
 # Copyright 2006 SAN OUEST PROVENCE et Paul POULAIN
 #
@@ -56,7 +56,6 @@
 			     flagsrequired => {borrowers => 1},
 			     debug => 1,
 			     });
-
 my $borrowerid=$input->param('borrowerid');
 my $guarantorid=$input->param('guarantorid');
 my $borrowernumber=$input->param('borrowernumber');
@@ -123,12 +122,12 @@
 # STEP 1
 	if ($step eq 1) {
 		###############test to take the right zipcode and city name ##############
-		if ($category_type ne 'I' and $guarantorid){
+		if ($category_type ne 'I' and $guarantorid eq ''){
 			my ($borrower_city,$borrower_zipcode)=&getzipnamecity($select_city);
 			$data{'city'}= $borrower_city;
 			$data{'zipcode'}=$borrower_zipcode;
 		}
-		if ($category_type eq 'C' and $guarantorid){
+		if ($category_type eq 'C' and $guarantorid ne ''){
 			my $guarantordata=getguarantordata($guarantorid);
 			if (($data{'contactname'} eq '' or $data{'contactname'} ne $guarantordata->{'surname'})) {
 				$data{'contactfirstname'}=$guarantordata->{'firstname'};	
@@ -364,41 +363,38 @@
 	my @branches;
 	my @select_branch;
 	my %select_branches;
-	my $branches=getbranches();
+	my $branches=getbranches('IS');
 	my $default;
 	# -----------------------------------------------------
 	#  the value of ip from the branches hash table
-		my $select_ip;
+# 		my $select_ip;
 	# $ip is the ip of user when is connect to koha 
-		my $ip = $ENV{'REMOTE_ADDR'};
+# 		my $ip = $ENV{'REMOTE_ADDR'};
+	
 	# -----------------------------------------------------
 	foreach my $branch (keys %$branches) {
 		if ((not C4::Context->preference("IndependantBranches")) || (C4::Context->userenv->{'flags'} == 1)) {
 			push @select_branch, $branch;
 			$select_branches{$branch} = $branches->{$branch}->{'branchname'};
-# 		 take the ip number from branches "op"
-			$select_ip = $branches->{$branch}->{'branchip'} || '';
-				
-# 		test $select_ip equal $ip to attribute the default value for the scrolling list
-			if ($select_ip eq $ip)  {
 						$default = $branches->{$branch}->{'branchcode'};
-						}
 			} else {
-				push @select_branch, $branch if ($branch eq C4::Context->userenv->{'branch'});
+				push @select_branch,$branch if ($branch eq C4::Context->userenv->{'branch'});
 				$select_branches{$branch} = $branches->{$branch}->{'branchname'} if ($branch eq C4::Context->userenv->{'branch'});
-					
  				$default = C4::Context->userenv->{'branch'};
 					
 				}
 	}
 # --------------------------------------------------------------------------------------------------------
+ 	#in modify mod :default value from $CGIbranch comes from borrowers table
+	#in add mod: default value come from branches table (ip correspendence)
+	$default=$data{'branchcode'}  if ($op eq 'modify');
+	
  	my $CGIbranch = CGI::scrolling_list(-id    => 'branchcode',
 					   -name   => 'branchcode',
 					   -values => \@select_branch,
 					   -labels => \%select_branches,
 					   -size   => 1,
 				           -multiple =>0,
-					   -override => 1,	
  					   -default => $default,
 					);
        my $CGIorganisations;





More information about the Koha-cvs mailing list