diff --git a/app/contacts/contact_relation_edit.php b/app/contacts/contact_relation_edit.php index d7010dbb48..6f6f4f1706 100644 --- a/app/contacts/contact_relation_edit.php +++ b/app/contacts/contact_relation_edit.php @@ -187,6 +187,30 @@ unset($sql, $parameters, $row); } +//get contact details and contact_name + $sql = "select contact_uuid, contact_organization, contact_name_given, contact_name_family, contact_nickname "; + $sql .= "from v_contacts "; + $sql .= "where domain_uuid = :domain_uuid "; + $sql .= "and contact_uuid <> :contact_uuid "; + $sql .= "order by contact_organization desc, contact_name_given asc, contact_name_family asc "; + $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + $parameters['contact_uuid'] = $contact_relation_uuid; + $database = new database; + $contacts = $database->select($sql, $parameters, 'all'); + if (is_array($contacts) && is_uuid($row['relation_contact_uuid'])) { + foreach($contacts as $field) { + if ($field['contact_uuid'] == $row['relation_contact_uuid']) { + $name = array(); + if ($field['contact_organization'] != '') { $name[] = $field['contact_organization']; } + if ($field['contact_name_family'] != '') { $name[] = $field['contact_name_family']; } + if ($field['contact_name_given'] != '') { $name[] = $field['contact_name_given']; } + if ($field['contact_name_family'] == '' && $field['contact_name_given'] == '' && $field['contact_nickname'] != '') { $name[] = $field['contact_nickname']; } + $contact_name = implode(', ', $name); + break; + } + } + } + //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -195,6 +219,43 @@ $document['title'] = $text['title-contact_relation']; require_once "resources/header.php"; +?> + + + +"; echo " function toggle_custom(field) {"; @@ -261,32 +322,10 @@ echo " ".$text['label-contact_relation_contact']."\n"; echo "\n"; echo "