[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1963] branches/1.2/LedgerSMB/Form.pm
- Subject: SF.net SVN: ledger-smb: [1963] branches/1.2/LedgerSMB/Form.pm
- From: ..hidden..
- Date: Fri, 07 Dec 2007 17:09:10 -0800
Revision: 1963
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1963&view=rev
Author: einhverfr
Date: 2007-12-07 17:09:10 -0800 (Fri, 07 Dec 2007)
Log Message:
-----------
converting all_years to use extract and group by
Modified Paths:
--------------
branches/1.2/LedgerSMB/Form.pm
Modified: branches/1.2/LedgerSMB/Form.pm
===================================================================
--- branches/1.2/LedgerSMB/Form.pm 2007-12-07 22:23:22 UTC (rev 1962)
+++ branches/1.2/LedgerSMB/Form.pm 2007-12-08 01:09:10 UTC (rev 1963)
@@ -2165,34 +2165,13 @@
$dbh = $self->{dbh};
+ $self->{all_years} = [];
+
# get years
my $query = qq|
- SELECT (SELECT transdate FROM acc_trans ORDER BY transdate asc
- LIMIT 1),
- (SELECT transdate FROM acc_trans ORDER BY transdate desc
- LIMIT 1)|;
+ SELECT extract('YEARS' FROM transdate) FROM acc_trans
+ GROUP BY extract('YEARS' FROM transdate) ORDER BY 1 DESC|;
- my ( $startdate, $enddate ) = $dbh->selectrow_array($query);
-
- if ( $myconfig->{dateformat} =~ /^yy/ ) {
- ($startdate) = split /\W/, $startdate;
- ($enddate) = split /\W/, $enddate;
- }
- else {
- (@_) = split /\W/, $startdate;
- $startdate = $_[2];
- (@_) = split /\W/, $enddate;
- $enddate = $_[2];
- }
-
- $self->{all_years} = ();
- $startdate = substr( $startdate, 0, 4 );
- $enddate = substr( $enddate, 0, 4 );
-
- while ( $enddate >= $startdate ) {
- push @{ $self->{all_years} }, $enddate--;
- }
-
#this should probably be changed to use locale
%{ $self->{all_month} } = (
'01' => 'January',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.