[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4155] trunk
- Subject: SF.net SVN: ledger-smb:[4155] trunk
- From: ..hidden..
- Date: Tue, 06 Dec 2011 00:20:51 +0000
Revision: 4155
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4155&view=rev
Author: einhverfr
Date: 2011-12-06 00:20:51 +0000 (Tue, 06 Dec 2011)
Log Message:
-----------
Merging from branches/1.3
Modified Paths:
--------------
trunk/Changelog
trunk/INSTALL
trunk/LedgerSMB/File.pm
trunk/LedgerSMB/Form.pm
trunk/LedgerSMB.pm
Property Changed:
----------------
trunk/
trunk/LedgerSMB/Scripts/admin.pm
trunk/LedgerSMB/Scripts/employee.pm
trunk/LedgerSMB/Scripts/file.pm
trunk/LedgerSMB/Scripts/payment.pm
trunk/LedgerSMB/Scripts/setup.pm
trunk/sql/upgrade/1.2-1.3-manual.sql
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3:3711-4147
+ /branches/1.3:3711-4154
Modified: trunk/Changelog
===================================================================
--- trunk/Changelog 2011-12-06 00:10:22 UTC (rev 4154)
+++ trunk/Changelog 2011-12-06 00:20:51 UTC (rev 4155)
@@ -26,7 +26,12 @@
* Fixed quotation number increasing when saving existing quotation (Chris T)
* Fixed invalid from address on backup routine (Chris T)
* Fixed error "RROR: lower bound of FOR loop cannot be null" (Chris T)
+* Updated documentation regarding retaining old migrated data (Herman V)
+Chris T is Chris Travers
+David B is David Bandel
+Herman V is Herman Vierendeels
+
Changelog for LedgerSMB 1.3.7 (Categorized due to length)
Database
* Added foreign key of entity_credit_account.language_code (Herman V)
Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL 2011-12-06 00:10:22 UTC (rev 4154)
+++ trunk/INSTALL 2011-12-06 00:20:51 UTC (rev 4155)
@@ -255,6 +255,10 @@
scripts. In particular, you must have the contrib_dir directive set to point
to those scripts properly in your ledgersmb.conf before you begin.
+If you are upgrading from 1.2, your 1.2 tables will be moved to schema lsmb12.
+Please keep this schema for some months. Updates which need this schema may
+still be necessary.
+
An alternative method is the 'prepare-company-database.sh' script contributed by
Erik Huelsmann. This script can be useful in creating and populating databases
from the command line and it offers a reference implementation written in BASH
Modified: trunk/LedgerSMB/File.pm
===================================================================
--- trunk/LedgerSMB/File.pm 2011-12-06 00:10:22 UTC (rev 4154)
+++ trunk/LedgerSMB/File.pm 2011-12-06 00:20:51 UTC (rev 4155)
@@ -108,6 +108,8 @@
x_info => '%'
};
+my $logger = Log::Log4perl->get_logger('LedgerSMB::File');
+
=head1 METHODS
=over
@@ -171,14 +173,23 @@
my ($self, $args) = @_;
my $dbobject;
my $rc = 0; # Success
+ $logger->debug("begin");
+ $logger->trace("self=".Data::Dumper::Dumper(\$self)." args=".Data::Dumper::Dumper(\$args)." ref=".ref($args->{base}));
if (ref $args->{base} eq 'Form'){
#$ENV{LSMB_NOHEAD} = 1;
use LedgerSMB::Locale;
- my $lsmb = LedgerSMB->new();
+ #HV trying to avoid msg:Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Pg::db handle
+ # new LedgerSMB will acquire dbh_handle.This newly created dbh_handle will be unset in merge() with dbh_handle from Form
+ $logger->debug("LedgerSMB->new begin");
+ my $lsmb = LedgerSMB->new($args->{base}->{dbh});
+ $logger->debug("LedgerSMB->new end");
+ $logger->debug("LedgerSMB->merge begin");
$lsmb->merge($args->{base});
+ $logger->debug("LedgerSMB->merge end");
if ((ref $args->{locale}) =~ /^LedgerSMB::Locale/){
$lsmb->{_locale} = $args->{locale};
$dbobject = LedgerSMB::DBObject->new({base => $lsmb});
+ $logger->debug("\$dbobject->{dbh}=$dbobject->{dbh}");
} else {
$rc | 2; # No locale
}
@@ -189,6 +200,7 @@
else {
$rc | 4; # Incorrect base type
}
+ $logger->debug("end");
if (!$dbobject->{dbh}){
$rc | 1; # No database handle
}
Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm 2011-12-06 00:10:22 UTC (rev 4154)
+++ trunk/LedgerSMB/Form.pm 2011-12-06 00:20:51 UTC (rev 4155)
@@ -129,9 +129,8 @@
if($self->{header})
{
- $logger->trace("self->{header}=$self->{header}");
delete $self->{header};
- $logger->trace("self->{header} unset!!");
+ $logger->error("self->{header} unset!!");
}
if ( substr( $self->{action}, 0, 1 ) !~ /( |\.)/ ) {
$self->{action} = lc $self->{action};
@@ -1162,6 +1161,7 @@
sub db_init {
my ( $self, $myconfig ) = @_;
+ $logger->trace("begin");
# Handling of HTTP Basic Auth headers
my $auth = $ENV{'HTTP_AUTHORIZATION'};
@@ -1181,6 +1181,7 @@
};
$self->{dbh} = $self->dbconnect_noauto($dbconfig) || $self->dberror();
+ $logger->debug("acquired dbh \$self->{dbh}=$self->{dbh}");
$self->{dbh}->{pg_server_prepare} = 0;
my $dbh = $self->{dbh};
my %date_query = (
@@ -1239,6 +1240,7 @@
}
LedgerSMB::Company_Config::initialize($self);
$sth->finish();
+ $logger->trace("end");
}
=item $form->run_custom_queries($tablename, $query_type[, $linenum]);
Property changes on: trunk/LedgerSMB/Scripts/admin.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4147
/branches/1.3/scripts/admin.pl:3711-3903
+ /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4154
/branches/1.3/scripts/admin.pl:3711-3903
Property changes on: trunk/LedgerSMB/Scripts/employee.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4147
/branches/1.3/scripts/employee.pl:3842-3843
+ /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4154
/branches/1.3/scripts/employee.pl:3842-3843
Property changes on: trunk/LedgerSMB/Scripts/file.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4147
/branches/1.3/scripts/file.pl:3711-4138
+ /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4154
/branches/1.3/scripts/file.pl:3711-4138
Property changes on: trunk/LedgerSMB/Scripts/payment.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4147
/branches/1.3/scripts/payment.pl:3711-4147
+ /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4154
/branches/1.3/scripts/payment.pl:3711-4147
Property changes on: trunk/LedgerSMB/Scripts/setup.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4147
/branches/1.3/scripts/setup.pl:3711-4147
+ /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4154
/branches/1.3/scripts/setup.pl:3711-4147
Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm 2011-12-06 00:10:22 UTC (rev 4154)
+++ trunk/LedgerSMB.pm 2011-12-06 00:20:51 UTC (rev 4155)
@@ -229,6 +229,8 @@
sub new {
#my $type = "" unless defined shift @_;
#my $argstr = "" unless defined shift @_;
+ (my $package,my $filename,my $line)=caller;
+
my $type = shift @_;
my $argstr = shift @_;
my %cookie;
@@ -237,22 +239,32 @@
$type = "" unless defined $type;
$argstr = "" unless defined $argstr;
- $logger->debug("Begin LedgerSMB.pm");
+ $logger->debug("Begin called from \$filename=$filename \$line=$line \$type=$type \$argstr=$argstr ref argstr=".ref $argstr);
$self->{version} = $VERSION;
$self->{dbversion} = "1.3.999";
bless $self, $type;
- $logger->debug("LedgerSMB::new: \$argstr = $argstr");
- my $query = ($argstr) ? new CGI::Simple($argstr) : new CGI::Simple;
- # my $params = $query->Vars; returns a tied hash with keys that
- # are not parameters of the CGI query.
- my %params = $query->Vars;
- for my $p(keys %params){
- utf8::decode($params{$p});
- utf8::upgrade($params{$p});
+
+ my $query;
+ my %params=();
+ if(ref($argstr) eq 'DBI::db')
+ {
+ $self->{dbh}=$argstr;
+ $logger->info("setting dbh from argstr \$self->{dbh}=$self->{dbh}");
}
- $logger->debug("LedgerSMB::new: params = ", Data::Dumper::Dumper(\%params));
+ else
+ {
+ $query = ($argstr) ? new CGI::Simple($argstr) : new CGI::Simple;
+ # my $params = $query->Vars; returns a tied hash with keys that
+ # are not parameters of the CGI query.
+ %params = $query->Vars;
+ for my $p(keys %params){
+ utf8::decode($params{$p});
+ utf8::upgrade($params{$p});
+ }
+ }
+ $logger->debug("params=", Data::Dumper::Dumper(\%params));
$self->{VERSION} = $VERSION;
$self->{_request} = $query;
@@ -326,9 +338,9 @@
$ccookie =~ s/.*:([^:]*)$/$1/;
if($ccookie ne 'Login') { $self->{company} = $ccookie; }
}
- $logger->debug("LedgerSMB.pm: \$self->{company} = $self->{company}");
+ $logger->debug("\$self->{company} = $self->{company}");
- $self->_db_init;
+ if(!$self->{dbh}){$self->_db_init;}
LedgerSMB::Company_Config::initialize($self);
@@ -796,9 +808,9 @@
sub _db_init {
my $self = shift @_;
my %args = @_;
+ $logger->debug("start");
my $creds = LedgerSMB::Auth::get_credentials();
- $logger->debug("start");
$self->{login} = $creds->{login};
if (!$self->{company}){
@@ -810,33 +822,35 @@
# connection fails since this probably means bad credentials are entered.
# Just in case, however, I think it is a good idea to include the DBI
# error string. CT
+ $logger->debug("before DBI->connect dbh=$self->{dbh}");
$self->{dbh} = DBI->connect(
"dbi:Pg:dbname=$dbname", "$creds->{login}", "$creds->{password}", { AutoCommit => 0 }
);
- my $dbh = $self->{dbh};
+ $logger->debug("after DBI->connect dbh=$self->{dbh}");
+ #my $dbh = $self->{dbh};
if (($self->{script} eq 'login.pl') && ($self->{action} eq
'authenticate')){
- if (!$dbh){
+ if (!$self->{dbh}){
$self->{_auth_error} = $DBI::errstr;
}
return;
}
- elsif (!$dbh){
+ elsif (!$self->{dbh}){
$self->_get_password;
}
- $dbh->{pg_server_prepare} = 0;
- $dbh->{pg_enable_utf8} = 1;
+ $self->{dbh}->{pg_server_prepare} = 0;
+ $self->{dbh}->{pg_enable_utf8} = 1;
# This is the general version check
- my $sth = $dbh->prepare("
+ my $sth = $self->{dbh}->prepare("
SELECT value FROM defaults
WHERE setting_key = 'version'");
$sth->execute;
my ($dbversion) = $sth->fetchrow_array;
- $sth = $dbh->prepare("
+ $sth = $self->{dbh}->prepare("
SELECT value FROM defaults
WHERE setting_key = 'role_prefix'");
$sth->execute;
@@ -847,12 +861,12 @@
$self->error("Database is not the expected version. Was $dbversion, expected $self->{dbversion}. Please re-run setup.pl against this database to correct.");
}
- $sth = $dbh->prepare('SELECT check_expiration()');
+ $sth = $self->{dbh}->prepare('SELECT check_expiration()');
$sth->execute;
($self->{warn_expire}) = $sth->fetchrow_array;
if ($self->{warn_expire}){
- $sth = $dbh->prepare('SELECT user__check_my_expiration()');
+ $sth = $self->{dbh}->prepare('SELECT user__check_my_expiration()');
$sth->execute;
($self->{pw_expires}) = $sth->fetchrow_array;
}
@@ -875,11 +889,12 @@
$self->{_roles} = [];
$query = "select rolname from pg_roles
where pg_has_role(SESSION_USER, 'USAGE')";
- $sth = $dbh->prepare($query);
+ $sth = $self->{dbh}->prepare($query);
$sth->execute();
while (my @roles = $sth->fetchrow_array){
push @{$self->{_roles}}, $roles[0];
}
+ $sth->finish();
$logger->debug("end");
}
@@ -948,7 +963,7 @@
sub merge {
(my $package,my $filename,my $line)=caller;
my ( $self, $src ) = @_;
- $logger->debug("begin caller \$filename=$filename \$line=$line");
+ $logger->debug("begin caller \$filename=$filename \$line=$line \$self->{dbh}=$self->{dbh}");
for my $arg ( $self, $src ) {
shift;
}
@@ -987,7 +1002,7 @@
}
$self->{$dst_arg} = $src->{$arg};
}
- $logger->debug("end");
+ $logger->debug("end caller \$filename=$filename \$line=$line \$self->{dbh}=$self->{dbh}");
}
sub type {
Property changes on: trunk/sql/upgrade/1.2-1.3-manual.sql
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4147
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
+ /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4154
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.