summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-05-25 18:27:28 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-05-25 18:27:28 +0000
commitdd779e7ff888ad90d0cefff239b5e77fc80d991e (patch)
tree4cea8b5691ba1bccbdbe092f1cec15527b42cefa /LedgerSMB
parent6bff0e985bd6e56bf31184df4d5ca460d5545f34 (diff)
Fixes to per-transaction separation of duties
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2155 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r--LedgerSMB/AA.pm3
-rw-r--r--LedgerSMB/Form.pm4
-rw-r--r--LedgerSMB/GL.pm12
-rw-r--r--LedgerSMB/RP.pm5
4 files changed, 19 insertions, 5 deletions
diff --git a/LedgerSMB/AA.pm b/LedgerSMB/AA.pm
index ce8679a7..4663971b 100644
--- a/LedgerSMB/AA.pm
+++ b/LedgerSMB/AA.pm
@@ -61,6 +61,9 @@ Post transaction uses the following variables in the $form variable:
sub post_transaction {
my ( $self, $myconfig, $form ) = @_;
+ if ($form->{separate_duties}){
+ $form->{approved} = '0';
+ }
for (1 .. $form->{rowcount}){
$form->{"amount_$_"} = $form->parse_amount(
$myconfig, $form->{"amount_$_"}
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index b33a239a..cb938c8d 100644
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -2160,7 +2160,7 @@ describing acc_trans table entries corresponding to the transaction $form->{id}.
The elements in the acc_trans entry hashes are accno, description, source,
amount, memo, transdate, cleared, project_id, projectnumber, and exchangerate.
-The closedto, revtrans, and currencies $form attributes are filled with values
+The closedto, separate_duties, revtrans, and currencies $form attributes are filled with values
from the defaults table, while $form->{current_date} is populated with the
current date. If $form->{id} is not set, then $form->{transdate} also takes on
the current date.
@@ -2325,7 +2325,7 @@ sub create_links {
$self->lastname_used( $myconfig, $dbh, $vc, $module );
}
}
- for (qw(current_date curr closedto revtrans)) {
+ for (qw(separate_duties current_date curr closedto revtrans)) {
if ($_ eq 'closedto'){
$query = qq|
SELECT value::date FROM defaults
diff --git a/LedgerSMB/GL.pm b/LedgerSMB/GL.pm
index 30688e8f..2009c037 100644
--- a/LedgerSMB/GL.pm
+++ b/LedgerSMB/GL.pm
@@ -79,6 +79,9 @@ sub post_transaction {
my $sth;
my $id = $dbh->quote( $form->{id} );
+ if ($form->{separate_duties}){
+ $form->approved = '0';
+ }
if ( $form->{id} ) {
$query = qq|SELECT id FROM gl WHERE id = $id|;
@@ -545,7 +548,9 @@ sub transaction {
$query = "SELECT setting_key, value
FROM defaults
WHERE setting_key IN
- ('closedto', 'revtrans')";
+ ('closedto',
+ 'revtrans',
+ 'separate_duties')";
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
@@ -595,12 +600,15 @@ sub transaction {
$query = "SELECT current_date AS transdate, setting_key, value
FROM defaults
WHERE setting_key IN
- ('closedto', 'revtrans')";
+ ('closedto',
+ 'separate_duties',
+ 'revtrans')";
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
my $results = $sth->fetchall_hashref('setting_key');
+ $form->{separate_duties} = $results->{'separate_duties'}->{'value'};
$form->{closedto} = $results->{'closedto'}->{'value'};
$form->{revtrans} = $results->{'revtrans'}->{'value'};
if (!$form->{transdate}){
diff --git a/LedgerSMB/RP.pm b/LedgerSMB/RP.pm
index 9c937bf6..1a236ea8 100644
--- a/LedgerSMB/RP.pm
+++ b/LedgerSMB/RP.pm
@@ -2307,7 +2307,9 @@ sub payments {
(a.person_id = e.entity_id)
LEFT JOIN entity ee ON (e.entity_id = ee.id)
$dpt_join
- WHERE ac.chart_id = $ref->{id} $where|;
+ WHERE ac.chart_id = $ref->{id}
+ AND ac.approved AND a.approved
+ $where|;
if ( $form->{till} ne "" ) {
$query .= " AND a.invoice = '1' AND NOT a.till IS NULL";
@@ -2337,6 +2339,7 @@ sub payments {
JOIN entity ee ON (e.entity_id = ee.id)
$dpt_join
WHERE ac.chart_id = $ref->{id} $glwhere
+ AND ac.approved AND g.approved
AND (ac.amount * $ml) > 0
GROUP BY g.description, ac.transdate,
ac.source, ac.memo, ee.name|;