table related to itself [message #841] |
Wed, 23 May 2007 10:55 |
interop
Messages: 45 Registered: October 2006
|
Member |
|
|
I have a table (equipment) which is related to itself. In the detail view (read or update) the parent_equipment_id is always filled in with the current equipment's model. Even if the parent_equipment_id is null in the db and xml.
I've stepped through the code and parent_equipment_id is in fact null. I have other tables that are related to themselves which work fine as dropdowns. I just can't seem to get this one working as a popup.
I've read the following:
http://www.tonymarston.net/php-mysql/infrastructure-faq.html #faq27
http://www.tonymarston.net/php-mysql/infrastructure-faq.html #faq38c
Here are some of the settings in my files can you see something wrong?
#equipment.dict.inc
$fieldspec['parent_equipment_id'] = array('type' => 'integer',
'size' => 10,
'minvalue' => 0,
'maxvalue' => 4294967295,
'control' => 'popup',
'task_id' => 'iol_equipment_snr(popup1)',
'foreign_field' => 'model');
$this->child_relations[] = array('child' => 'equipment',
'alias' => 'equipment_jnr',
'type' => 'RES',
'fields' => array('equipment_id' => 'parent_equipment_id'));
$this->parent_relations[] = array('parent' => 'equipment',
'alias' => 'equipment_snr',
'parent_field' => 'parent_equipment_id AS parent_id',
'fields' => array('parent_equipment_id' => 'equipment_id'));
#equipment.detail.screen.inc
$structure['main']['fields'][] = array('parent_equipment_id' => 'Parent Equipment');
#equipment(upd1).php.xml
<parent_equipment_id size="10" control="popup" foreign_field="model" task_id="task#iol_equipment_snr(popup1)"></parent_equipment_id >
equipment_snr.class.inc just extends equipment without modifications.
thanks
|
|
|