[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [232] trunk



Revision: 232
          http://svn.sourceforge.net/ledger-smb/?rev=232&view=rev
Author:   einhverfr
Date:     2006-10-18 21:24:58 -0700 (Wed, 18 Oct 2006)

Log Message:
-----------
Fixed user creation bug

Modified Paths:
--------------
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB/User.pm
    trunk/bin/admin.pl

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2006-10-19 02:52:02 UTC (rev 231)
+++ trunk/LedgerSMB/Form.pm	2006-10-19 04:24:58 UTC (rev 232)
@@ -2714,12 +2714,15 @@
 
 	my ($self, $myconfig, $fld) = @_;
 
-	if (!$self->{dbh}){
+	if (!$self->{dbh} && $self){
 		$self->db_init($myconfig);
-	}
-
+	} 
+		
 	my $dbh = $self->{dbh};
 
+	if (!$self){
+		$dbh = $_[3];
+	}
 
 	my $query = qq|SELECT $fld FROM defaults FOR UPDATE|;
 	($_) = $dbh->selectrow_array($query);

Modified: trunk/LedgerSMB/User.pm
===================================================================
--- trunk/LedgerSMB/User.pm	2006-10-19 02:52:02 UTC (rev 231)
+++ trunk/LedgerSMB/User.pm	2006-10-19 04:24:58 UTC (rev 232)
@@ -752,7 +752,6 @@
 
 
 sub save_member {
-
 	my ($self, $memberfile, $userspath) = @_;
 
 	# format dbconnect and dboptions string
@@ -797,7 +796,6 @@
 		$self->{dbpasswd} = pack 'u', $self->{dbpasswd};
 		chop $self->{dbpasswd};
 	}
-
 	if ($self->{password} ne $self->{old_password}) {
 		$self->{password} = crypt $self->{password}, substr($self->{login}, 0, 2) if $self->{password};
 	}
@@ -818,7 +816,6 @@
 	print CONF "\n";
 	close CONF;
 	unlink "${memberfile}.LCK";
-
 	# create conf file
 	if (! $self->{'root login'}) {
 
@@ -840,7 +837,6 @@
 
 		my ($id) = $sth->fetchrow_array;
 		$sth->finish;
-
 		if ($id) {
 
 			$query = qq|UPDATE employee SET

Modified: trunk/bin/admin.pl
===================================================================
--- trunk/bin/admin.pl	2006-10-19 02:52:02 UTC (rev 231)
+++ trunk/bin/admin.pl	2006-10-19 04:24:58 UTC (rev 232)
@@ -793,11 +793,9 @@
 
 
 	$myconfig = new User "$memberfile", "$form->{login}";
-	$form->db_init(%myconfig);
 
 	# redo acs variable and delete all the acs codes
 	@acs = split /;/, $form->{acs};
-
 	$form->{acs} = "";
 
 	foreach $item (@acs) {
@@ -818,7 +816,6 @@
 	$form->{dbpasswd} = $form->{"$form->{dbdriver}_dbpasswd"};
 	$form->{dbuser} = $form->{"$form->{dbdriver}_dbuser"};
 	$form->{dbname} = $form->{"$form->{dbdriver}_dbname"};
-
 	$form->isblank("dbname", $locale->text('Dataset missing!'));
 	$form->isblank("dbuser", $locale->text('Database User missing!'));
 
@@ -839,7 +836,6 @@
 	$myconfig->{packpw} = 1;
 
 	$myconfig->save_member($memberfile, $userspath);
-
 	# create user template directory and copy master files
 	if (! -d "$form->{templates}") {
 
@@ -875,7 +871,6 @@
 	}
 
 	$form->redirect($locale->text('User saved!'));
-
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.