Index: openacs-4/packages/acs-subsite/tcl/relation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/relation-procs.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/acs-subsite/tcl/relation-procs.tcl 26 Jan 2004 15:39:46 -0000 1.10 +++ openacs-4/packages/acs-subsite/tcl/relation-procs.tcl 2 Mar 2004 16:58:31 -0000 1.11 @@ -64,6 +64,19 @@ @return The rel_id of the new relation } { + # First check if the relation already exists, and if so, just return that + set existing_rel_id [db_string rel_exists { + select rel_id + from acs_rels + where rel_type = :rel_type + and object_id_one = :object_id_one + and object_id_two = :object_id_two + } -default {}] + + if { ![empty_string_p $existing_rel_id] } { + return $existing_rel_id + } + set var_list [list \ [list object_id_one $object_id_one] \ [list object_id_two $object_id_two]]