summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-08-20 21:06:06 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-08-20 21:06:06 +0000
commit49c0b62ecacd828569849c4a05607f4161f0cbac (patch)
tree778fa12f1a1c33678e5b38300d5b947a5ab716b0 /sql
parent9924b1bea3e50f6a1570a44d43577bb544e282cc (diff)
Correcting issues with editing contact info
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2287 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'sql')
-rw-r--r--sql/modules/Company.sql8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/modules/Company.sql b/sql/modules/Company.sql
index 04056164..4cd0e2cd 100644
--- a/sql/modules/Company.sql
+++ b/sql/modules/Company.sql
@@ -713,11 +713,17 @@ END;
$$ language plpgsql;
CREATE OR REPLACE FUNCTION eca__save_contact
-(in_credit_id int, in_contact_class int, in_description text, in_contact text)
+(in_credit_id int, in_contact_class int, in_description text, in_contact text,
+in_old_contact text, in_old_contact_class int)
RETURNS INT AS
$$
DECLARE out_id int;
BEGIN
+ DELETE FROM eca_to_contact
+ WHERE credit_id = in_credit_id
+ AND contact = in_old_contact
+ AND contact_class_id = in_old_contact_class;
+
INSERT INTO eca_to_contact(credit_id, contact_class_id,
description, contact)
VALUES (in_credit_id, in_contact_class, in_description, in_contact);