[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1945] trunk/LedgerSMB.pm
- Subject: SF.net SVN: ledger-smb: [1945] trunk/LedgerSMB.pm
- From: ..hidden..
- Date: Tue, 04 Dec 2007 22:29:57 -0800
Revision: 1945
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1945&view=rev
Author: einhverfr
Date: 2007-12-04 22:29:56 -0800 (Tue, 04 Dec 2007)
Log Message:
-----------
Adding proper dateformat handling to LedgerSMB.pm
Modified Paths:
--------------
trunk/LedgerSMB.pm
Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm 2007-12-05 05:59:13 UTC (rev 1944)
+++ trunk/LedgerSMB.pm 2007-12-05 06:29:56 UTC (rev 1945)
@@ -211,6 +211,16 @@
}
$self->{_user} = LedgerSMB::User->fetch_config($self);
}
+ my %date_setting = (
+ 'mm/dd/yy' => "SQL, US",
+ 'mm-dd-yy' => "POSTGRES, US",
+ 'dd/mm/yy' => "SQL, EUROPEAN",
+ 'dd-mm-yy' => "POSTGRES, EUROPEAN",
+ 'dd.mm.yy' => "GERMAN",
+ );
+
+ $self->{dbh}->do("set DateStyle to '"
+ .$date_setting{$self->{_user}->{dateformat}}."'");
#my $locale = LedgerSMB::Locale->get_handle($self->{_user}->{countrycode})
$self->{_locale} = LedgerSMB::Locale->get_handle('en') # temporary
or $self->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
@@ -348,7 +358,7 @@
# Based on SQL-Ledger's Form::format_amount
my $self = shift @_;
my %args = @_;
- my $myconfig = $args{user};
+ my $myconfig = $args{user} || $self->{_user};
my $amount = $args{amount};
my $places = $args{precision};
my $dash = $args{neg_format};
@@ -530,7 +540,6 @@
my @results;
$procname = $self->{dbh}->quote_identifier($procname);
- print STDERR join(':', @call_args) . "\n";
for ( 1 .. scalar @call_args ) {
$argstr .= "?, ";
}
@@ -542,10 +551,11 @@
$query =~ s/\(\)/($argstr)/;
my $sth = $self->{dbh}->prepare($query);
if (scalar @call_args){
- $sth->execute(@call_args);
+ $sth->execute(@call_args) || $self->error($self->{dbh}->errstr);
} else {
- $sth->execute();
+ $sth->execute() || $self->error($self->{dbh}->errstr);
}
+
my @types = @{$sth->{TYPE}};
my @names = @{$sth->{NAME_lc}};
while ( my $ref = $sth->fetchrow_hashref('NAME_lc') ) {
@@ -684,9 +694,6 @@
-
- # TODO: Add date handling settings and the like.
-
my $query = "SELECT t.extends,
coalesce (t.table_name, 'custom_' || extends)
|| ':' || f.field_name as field_def
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.