Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.2.2dev1

Request #10625 DataObjectSource and Formbuilder integration with links original values
Submitted: 2007-04-05 11:19 UTC
From: jw Assigned: olivierg
Status: Closed Package: Structures_DataGrid_DataSource_DataObject
PHP Version: Irrelevant OS: Irrelvant
Roadmaps: (Not assigned)    
Comments Add Comment Add patch

Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem : 44 - 23 = ?

 [2007-04-05 11:19 UTC] jw (Jan Wagner)
Description: ------------ I have a small problem here. I have a table with multiple primary keys and one of the keys is a link to another table, the formbuilder integration displays the link allright as linkDisplayName. But now I no longer have access to the original value of the field, which I need for edit link generation (remember the field is part of the primary key). Could it be possible to make the original value available in the record? I have written a small patch, that adds this information to the magic value __links__ in the record array. I don't know though if this is the right strategy. One could also set up the dataobject manually, add the link field with another name, add that to datagrid for display and still fetch the original field via the fields options. Test script: --------------- // Get Linked FormBuilder Fields if ($this->_options['formbuilder_integration']) { + $values = array(); foreach (array_keys($rec) as $field) { if (isset($links[$field]) && isset($this->_dataobject->$field) && $linkedDo =& $this->_dataobject->getLink($field) && !PEAR::isError($linkedDo)) { - $rec[$field] = DB_DataObject_FormBuilder::getDataObjectString($linkedDo); + $values[$field] = $rec[$field]; + $rec[$field] = DB_DataObject_FormBuilder::getDataObjectString($linkedDo); } } + if ($values) { + $rec['__links__'] = $values; + } }


 [2007-04-14 16:42 UTC] wiesemann (Mark Wiesemann)
(package selection corrected)
 [2007-06-13 16:26 UTC] olivierg (Olivier Guilyardi)
Hello Jan, For various reasons, the record array cannot contain sub arrays such as the __links__ you propose. However, I've added the link_keep_value option (in CVS). When set to true it will add "myfield__orig" keys to the record array. This way you can either display them on the table and/or use them in a column formatter. Thanks for your report
 [2007-06-14 17:43 UTC] olivierg (Olivier Guilyardi)
Correction: the new option is now link_keep_key, and the field name suffix "__key". This is available in the last 0.2.0 release.