aboutsummaryrefslogtreecommitdiffstats
path: root/sql/dawn.sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql/dawn.sql')
-rw-r--r--sql/dawn.sql2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql
index 088f71b5..8535d659 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -521,7 +521,7 @@ CREATE OR REPLACE FUNCTION update_account()
RETURNS TRIGGER
AS $$
BEGIN
-SELECT cash_account INTO STRICT NEW.cash_account FROM accounts2 LEFT JOIN account_counterparty ON accounts2.id=account_id WHERE trade_type=TG_ARGV[0] AND fund=NEW.fund AND account_counterparty.cp_code=NEW.cp_code;
+SELECT cash_account INTO STRICT NEW.cash_account FROM accounts2 LEFT JOIN account_counterparty ON accounts2.id=account_id WHERE trade_type=TG_ARGV[0] AND fund=NEW.fund AND account_counterparty.cp_code=NEW.cp_code AND active;
RETURN NEW;
END
$$ LANGUAGE plpgsql;