From 1aaa9fe478fc2e9ea0fa744edb704ccacf46d07b Mon Sep 17 00:00:00 2001 From: einhverfr Date: Thu, 13 Nov 2008 01:15:47 +0000 Subject: Correcting issues with draft editing. Moving AA::post_transaction to use strict. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2392 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/AA.pm | 8 +++++++- LedgerSMB/DBObject.pm | 4 ++-- LedgerSMB/Form.pm | 12 +++++++++++- LedgerSMB/GL.pm | 2 +- 4 files changed, 21 insertions(+), 5 deletions(-) (limited to 'LedgerSMB') diff --git a/LedgerSMB/AA.pm b/LedgerSMB/AA.pm index 9d922bb0..295b89a6 100644 --- a/LedgerSMB/AA.pm +++ b/LedgerSMB/AA.pm @@ -59,8 +59,15 @@ Post transaction uses the following variables in the $form variable: =cut sub post_transaction { + use strict; my ( $self, $myconfig, $form ) = @_; + + my $exchangerate; + my $batch_class; + my %paid; + my $paidamount; + my @queries; if ($form->{separate_duties}){ $form->{approved} = '0'; } @@ -404,7 +411,6 @@ sub post_transaction { # add individual transactions foreach $ref ( @{ $form->{acc_trans}{lineitems} } ) { - # insert detail records in acc_trans if ( $ref->{amount} ) { $query = qq| diff --git a/LedgerSMB/DBObject.pm b/LedgerSMB/DBObject.pm index 57f5ac6f..dade3ab8 100644 --- a/LedgerSMB/DBObject.pm +++ b/LedgerSMB/DBObject.pm @@ -121,7 +121,7 @@ sub exec_method { $ref = $sth->fetchrow_hashref('NAME_lc'); - my $args = $ref->{proargnames}; + my $pargs = $ref->{proargnames}; my @proc_args; if ( !$ref->{proname} ) { # no such function @@ -132,7 +132,7 @@ sub exec_method { $ref->{pronargs} = 0 unless defined $ref->{pronargs}; # If the user provided args.. if (!defined $args{args}) { - @proc_args = $self->_parse_array($args); + @proc_args = $self->_parse_array($pargs); if (@proc_args) { for my $arg (@proc_args) { if ( $arg =~ s/^in_// ) { diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm index f9ae6ad5..dec0813d 100644 --- a/LedgerSMB/Form.pm +++ b/LedgerSMB/Form.pm @@ -536,7 +536,7 @@ sub redirect { my ( $self, $msg ) = @_; if ( $self->{callback} || !$msg ) { - + print STDERR "Full redirect\n"; main::redirect(); exit; } @@ -1189,6 +1189,16 @@ sub db_init { push @{ $self->{custom_db_fields}{ $ref->{extends} } }, $ref->{field_def}; } + # Roles tracking + $self->{_roles} = []; + $query = "select rolname from pg_roles + where pg_has_role(SESSION_USER, 'USAGE')"; + $sth = $dbh->prepare($query); + $sth->execute(); + while (my @roles = $sth->fetchrow_array){ + push @{$self->{_roles}}, $roles[0]; + } + $sth->finish(); } =item $form->run_custom_queries($tablename, $query_type[, $linenum]); diff --git a/LedgerSMB/GL.pm b/LedgerSMB/GL.pm index 22976c2d..7ee7ba89 100644 --- a/LedgerSMB/GL.pm +++ b/LedgerSMB/GL.pm @@ -166,7 +166,6 @@ sub post_transaction { # extract accno ($accno) = split( /--/, $form->{"accno_$i"} ); - if ($credit) { $amount = $credit; $posted = 0; @@ -564,6 +563,7 @@ sub transaction { my $results = $sth->fetchall_hashref('setting_key'); $form->{closedto} = $results->{'closedto'}->{'value'}; $form->{revtrans} = $results->{'revtrans'}->{'value'}; + #$form->{separate_duties} = $results->{'separate_duties'}->{'value'}; $sth->finish; $query = qq|SELECT g.*, d.description AS department -- cgit v1.2.3