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-27 19:33 UTC Modified: 2006-12-16 02:29 UTC
From: mw21st at php dot net Assigned: justinpatrin
Status: Closed Package: DB_DataObject_FormBuilder
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2004-11-27 19: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: http://opensource.21st.de/projects/formbuilder/patches/FormBuilder_SRuempler.phps

Comments

 [2004-11-28 00: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: http://www.reversefold.com/PEAR/FB_bug2841.patch
 [2004-11-29 12:15 UTC] justinpatrin
Ugh...the new bug link thing killed my link! http://www.reversefold.com/PEAR/FB_b2841.patch
 [2004-12-06 16: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 pear.php.net. In case this was a pear.php.net 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-14 19:00 UTC] justinpatrin
Anyone following this bug may want to check out bug #2966.
 [2004-12-17 03: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 10: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 11: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 12: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(); }