Hello again Kupido
I have known see the image and now I understand you.
You can do it through logic hook 
Steps:
- Hide these two fields (email and phone) in order to don't be displayed in edit view: editing editviewdefs.php of the module contacts
- Add these two fields to detailviewdefs.php of your module contacts in order to be displayed in detail view of contacts
- Like the other thread, create a logic hook in /custom/modules/contacts. With this logic hook you will get the value of the employee you have chosen in edit view, and you can make a query to the table employees of database in order to get the values of phone and email of the employee selected.
Note: Your field called employee is of kind relate, and this kind of field is made up for two hidden fields: id_employee and employee. So with the logic hook you can get the value of this field by its id...the query to the database and the assignment of values will be something like:
PHP Code:
<?php
require_once('/modules/Contacts/Contact.php');
global $db;
class employee_Hook{
function employee(&$bean, $event, $arguments){
$focus = new Contact();
$res = $focus->db->query("SELECT phone,email FROM employees WHERE id ={$bean->id}");
$row=$focus->db->fetchByAssoc($res);
$bean->phone = $row['phone'];
$bean->email = $row['email'];
}
}
?>
This code will be in the file named employee_Hook.php or the name you want to.
In logic_hooks.php only will be:
PHP Code:
<?php
$hook_version = 1;
$hook_array['before_save'][] = Array(1,"employee","custom/modules/Contacts/employee_Hook.php","employee_Hook","employee");
?>
Good luck
Bookmarks