From 70c29cebc700cf9cd2f63b0a333b61aca85ac30d Mon Sep 17 00:00:00 2001 From: einhverfr Date: Mon, 20 Oct 2008 01:05:26 +0000 Subject: Removing references to ca.pl's list_transactions function and moving these to a gl report. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2374 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/Auth/DB.pm | 2 +- LedgerSMB/GL.pm | 11 ++++++++--- UI/ca-list-selector.html | 23 +++++++++++++++++------ bin/gl.pl | 9 +++++++-- bin/rp.pl | 6 ++++-- 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/LedgerSMB/Auth/DB.pm b/LedgerSMB/Auth/DB.pm index de9d23fe..4ffa5a0a 100755 --- a/LedgerSMB/Auth/DB.pm +++ b/LedgerSMB/Auth/DB.pm @@ -70,6 +70,7 @@ sub session_check { || $form->dberror( __FILE__ . ':' . __LINE__ . ': Looking for session: ' ); my $sessionValid = $checkQuery->rows; + $dbh->commit; if ($sessionValid) { @@ -112,7 +113,6 @@ sub session_check { print qq|Set-Cookie: ${LedgerSMB::Sysconfig::cookie_name}=; path=$path;\n|; return 0; } - $dbh->commit; } sub session_create { diff --git a/LedgerSMB/GL.pm b/LedgerSMB/GL.pm index 25b0206d..63201e69 100644 --- a/LedgerSMB/GL.pm +++ b/LedgerSMB/GL.pm @@ -234,6 +234,12 @@ sub all_transactions { my $sth; my $var; my $null; + if ($form->{accno} and !$form->{chart_id}){ + my $sth = $dbh->prepare('SELECT id FROM chart WHERE accno = ?'); + $sth->execute($form->{accno}); + ($form->{chart_id}) = $sth->fetchrow_array(); + delete $form->{accno}; + } my ( $glwhere, $arwhere, $apwhere ) = ( "1 = 1", "1 = 1", "1 = 1" ); @@ -304,13 +310,13 @@ sub all_transactions { $var = $dbh->quote( $form->like( lc $form->{description} ) ); $glwhere .= " AND lower(g.description) LIKE $var"; - $arwhere .= " AND (lower(ct.name) LIKE $var + $arwhere .= " AND (lower(e.name) LIKE $var OR lower(ac.memo) LIKE $var OR a.id IN (SELECT DISTINCT trans_id FROM invoice WHERE lower(description) LIKE $var))"; - $apwhere .= " AND (lower(ct.name) LIKE $var + $apwhere .= " AND (lower(e.name) LIKE $var OR lower(ac.memo) LIKE $var OR a.id IN (SELECT DISTINCT trans_id FROM invoice @@ -485,7 +491,6 @@ sub all_transactions { $approved = (ac.approved AND a.approved)) ORDER BY $sortorder|; - my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); diff --git a/UI/ca-list-selector.html b/UI/ca-list-selector.html index 4f4798ad..7f1d66ee 100644 --- a/UI/ca-list-selector.html +++ b/UI/ca-list-selector.html @@ -16,9 +16,9 @@ -
- - + + 'hidden', name => hidden, value => form.item(hidden)}; END ?> @@ -29,9 +29,9 @@ - + - + @@ -69,9 +69,20 @@ 'hidden', name => hidden, value => form.$hidden}; END ?> + +
- "submit", name => "action", value => "list_transactions", text => text('List Transactions')} ?> + "submit", name => "action", value => "generate_report", text => text('List Transactions')} ?> diff --git a/bin/gl.pl b/bin/gl.pl index 9a0d8572..95e9a438 100644 --- a/bin/gl.pl +++ b/bin/gl.pl @@ -401,6 +401,11 @@ qq| | + + +
'date', name => 'fromdate' size => '11', title="yyyy-mm-dd"} ?> 'date', name => 'datefrom' size => '11', title="yyyy-mm-dd"} ?> 'date', name => 'todate' size => '11', title="yyyy-mm-dd"} ?> 'date', name => 'dateto' size => '11', title="yyyy-mm-dd"} ?>
| . $locale->text('Subtotal') + . qq|
| + . $locale->text('Balance') . qq|
@@ -478,7 +483,7 @@ sub generate_report { $ml = ( $form->{category} =~ /(A|E)/ ) ? -1 : 1; - unless ( $form->{category} eq 'X' ) { + if (defined $form->{category} and $form->{category} ne 'X' ) { $form->{title} .= " : " . $locale->text( $acctype{ $form->{category} } ); } @@ -590,7 +595,7 @@ sub generate_report { $form->{l_cleared} = "Y"; } - if ( $form->{accno} || $form->{gifi_accno} ) { + if ( $form->{chart_id} || $form->{gifi_accno} ) { @columns = grep !/(accno|gifi_accno)/, @columns; push @columns, "balance"; $form->{l_balance} = "Y"; diff --git a/bin/rp.pl b/bin/rp.pl index 1426824e..257a6bb2 100644 --- a/bin/rp.pl +++ b/bin/rp.pl @@ -715,8 +715,10 @@ sub list_accounts { my %column_data; my $description = $form->escape( $ref->{description} ); + # gl.pl requires datefrom instead of fromdate, etc. We will get this + # consistent.... eventually.... --CT my $href = -qq|ca.pl?path=$form->{path}&action=list_transactions&accounttype=$form->{accounttype}&login=$form->{login}&sessionid=$form->{sessionid}&fromdate=$form->{fromdate}&todate=$form->{todate}&sort=transdate&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}&prevreport=$form->{callback}|; +qq|gl.pl?path=$form->{path}&action=generate_report&accounttype=$form->{accounttype}&datefrom=$form->{fromdate}&dateto=$form->{todate}&sort=transdate&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&l_balance=Y&department=$department&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}&prevreport=$form->{callback}&category=X&l_reference=Y&l_transdate=Y&l_description=Y&l_debit=Y&l_credit=Y|; if ( $form->{accounttype} eq 'gifi' ) { $href .= "&gifi_accno=$ref->{accno}&gifi_description=$description"; @@ -726,7 +728,7 @@ qq|ca.pl?path=$form->{path}&action=list_transactions&accounttype=$form->{account } } else { - $href .= "&accno=$ref->{accno}&description=$description"; + $href .= "&accno=$ref->{accno}"; } $ml = ( $ref->{category} =~ /(A|E)/ ) ? -1 : 1; -- cgit v1.2.3