[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [2155] trunk
- Subject: SF.net SVN: ledger-smb: [2155] trunk
- From: ..hidden..
- Date: Sun, 25 May 2008 11:27:33 -0700
Revision: 2155
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2155&view=rev
Author: einhverfr
Date: 2008-05-25 11:27:28 -0700 (Sun, 25 May 2008)
Log Message:
-----------
Fixes to per-transaction separation of duties
Modified Paths:
--------------
trunk/LedgerSMB/AA.pm
trunk/LedgerSMB/Form.pm
trunk/LedgerSMB/GL.pm
trunk/LedgerSMB/RP.pm
trunk/bin/aa.pl
trunk/bin/gl.pl
trunk/sql/Pg-database.sql
Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm 2008-05-21 18:12:52 UTC (rev 2154)
+++ trunk/LedgerSMB/AA.pm 2008-05-25 18:27:28 UTC (rev 2155)
@@ -61,6 +61,9 @@
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_$_"}
Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm 2008-05-21 18:12:52 UTC (rev 2154)
+++ trunk/LedgerSMB/Form.pm 2008-05-25 18:27:28 UTC (rev 2155)
@@ -2160,7 +2160,7 @@
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 @@
$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
Modified: trunk/LedgerSMB/GL.pm
===================================================================
--- trunk/LedgerSMB/GL.pm 2008-05-21 18:12:52 UTC (rev 2154)
+++ trunk/LedgerSMB/GL.pm 2008-05-25 18:27:28 UTC (rev 2155)
@@ -79,6 +79,9 @@
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 @@
$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 @@
$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}){
Modified: trunk/LedgerSMB/RP.pm
===================================================================
--- trunk/LedgerSMB/RP.pm 2008-05-21 18:12:52 UTC (rev 2154)
+++ trunk/LedgerSMB/RP.pm 2008-05-25 18:27:28 UTC (rev 2155)
@@ -2307,7 +2307,9 @@
(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 @@
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|;
Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl 2008-05-21 18:12:52 UTC (rev 2154)
+++ trunk/bin/aa.pl 2008-05-25 18:27:28 UTC (rev 2155)
@@ -889,6 +889,11 @@
{ 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 ) )
Modified: trunk/bin/gl.pl
===================================================================
--- trunk/bin/gl.pl 2008-05-21 18:12:52 UTC (rev 2154)
+++ trunk/bin/gl.pl 2008-05-25 18:27:28 UTC (rev 2155)
@@ -1256,6 +1256,11 @@
{ 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} ) {
Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql 2008-05-21 18:12:52 UTC (rev 2154)
+++ trunk/sql/Pg-database.sql 2008-05-25 18:27:28 UTC (rev 2155)
@@ -139,7 +139,7 @@
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,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.