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

Request #2841 Prevent updates on crosslinks to delete prior entries
Submitted: 2004-11-28 00:33 UTC
From: mw21st at php dot net Assigned: justinpatrin
Status: Closed Package: DB_DataObject_FormBuilder
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    

 [2004-11-28 00:33 UTC] mw21st at php dot net
Description: ------------ When you use crosslinks with FormBuilder and make updates to the crosslinked entries, FB will delete all previous entries in the crosslink table and re-insert the checked entries anew. This behaviour is okay as long as you store only the linked fields in the crosslink table. When you put in additional information, however, this information is being lost whenever you add or remove an option from the crosslink table, which is not desirable. Sönke Ruempler has provided a patch to fix this, which can be found here:


 [2004-11-28 05:13 UTC] justinpatrin
I've made a patch vs. the current CVS version. Seems to work just fine. It's more overhead, but it should work ok. Patch here:
 [2004-11-29 17:15 UTC] justinpatrin
Ugh...the new bug link thing killed my link!
 [2004-12-06 21:57 UTC] justinpatrin
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on In case this was a website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. I've made some changes to the original patch. It's a bit more efficient and also syncs the triplelinks.
 [2004-12-15 00:00 UTC] justinpatrin
Anyone following this bug may want to check out bug #2966.
 [2004-12-17 08:11 UTC] ruempler at topconcepts dot com
Justin, there is a bug that I did not notice in the patch: if no checkbox is checked, there is not var/array from the outside and foreach throws warnings, should be fixed with som,ething like this: $fieldvalues = &$values['__crossLink_'.$crossLink['table']]; if (!is_array($fieldvalues)) { $fieldvalues = array(); } soenke
 [2004-12-17 15:41 UTC] justinpatrin
Thanks for the update. That solution, however, will cause a notice if the $values entry isn't set. This should be fixed in CVS.
 [2004-12-23 16:40 UTC] ruempler at topconcepts dot de
Thx for the fix Justin, but there should be no E_NOTICE, because I assigned the value per reference ;-) Happy X-Mas ;-)
 [2004-12-23 17:37 UTC] justinpatrin
I had no idea that assigning by ref got around the "variable not set" or "index not set" notices. Still, I'd see that as a hack. This feels cleaner (and makes more sense) to me: if (isset($values['__crossLink_'.$crossLink['table']])) { $fieldvalues = $values['__crossLink_'.$crossLink['table']]; } else { $fieldvalues = array(); }