summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UI/Contact/contact.html10
-rw-r--r--sql/modules/Company.sql8
2 files changed, 17 insertions, 1 deletions
diff --git a/UI/Contact/contact.html b/UI/Contact/contact.html
index 3bf7f1a3..7c22bfe1 100644
--- a/UI/Contact/contact.html
+++ b/UI/Contact/contact.html
@@ -619,6 +619,16 @@ problems with multi-word single-quoted constructs in PI tags. -CT -->
} ?>
<?lsmb PROCESS input element_data = {
type="hidden"
+ name="old_contact_class"
+ value=contact_class
+ } ?>
+ <?lsmb PROCESS input element_data = {
+ type="hidden"
+ name="old_contact"
+ value=contact
+ } ?>
+ <?lsmb PROCESS input element_data = {
+ type="hidden"
name="contact_id"
value=contact_id
} ?>
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);