diff options
-rw-r--r-- | LedgerSMB/AA.pm | 3 | ||||
-rw-r--r-- | LedgerSMB/Form.pm | 4 | ||||
-rw-r--r-- | LedgerSMB/GL.pm | 12 | ||||
-rw-r--r-- | LedgerSMB/RP.pm | 5 | ||||
-rw-r--r-- | bin/aa.pl | 5 | ||||
-rw-r--r-- | bin/gl.pl | 5 | ||||
-rw-r--r-- | sql/Pg-database.sql | 2 |
7 files changed, 30 insertions, 6 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|; @@ -889,6 +889,11 @@ sub form_footer { { ndx => 8, key => 'D', value => $locale->text('Delete') }, ); + if ($form->{separate_duties}){ + $button{post}->{value} = $locale->text('Save'); + $form->hide_form('separate_duties'); + } + if ( $form->{id} ) { if ( $form->{locked} || ( $transdate && $transdate <= $closedto ) ) @@ -1256,6 +1256,11 @@ sub form_footer { { ndx => 8, key => 'D', value => $locale->text('Delete') }, ); + if ($form->{separate_duties}){ + $form->hide_form('separate_duties'); + $button{post}->{value} = $locale->text('Save'); + } + %a = (); if ( $form->{id} ) { diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql index fc8e79a1..c9f2bea3 100644 --- a/sql/Pg-database.sql +++ b/sql/Pg-database.sql @@ -139,7 +139,7 @@ CREATE TABLE location ( line_two text, line_three text, city text check (city ~ '[[:alnum:]_]') NOT NULL, - state text check(state ~ '[[:alnum:]_]') NOT NULL, + state text check(state ~ '[[:alnum:]_]'), country_id integer not null REFERENCES country(id), mail_code text not null check (mail_code ~ '[[:alnum:]_]'), created date not null, |