DBDO FormBuilder crosslinks/triplelinks/reverselinks fix

From: Date: Wed, 20 Apr 2005 19:16:49 +0000
Subject: DBDO FormBuilder crosslinks/triplelinks/reverselinks fix
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-18833@lists.php.net to get a copy of this message
Attached is a diff of FormBuilder.php with a couple of small fixes. 1. when an insert fails and didn't return an $id, FormBuilder was continuing to insert crosslinks, triplelinks and reverselinks with an empty $id. 2. A tiny notice fix I was getting when FormBuilder tested for $crossLink['type'] If these are incorrect fixes or there is a better way, please let me know so I can rollback and change appropriately. tia, tim -- tim glen senior developer nonfiction studios inc. http://nonfiction.ca/ p 403 686 8887

--- FormBuilder_old.php Mon Apr 11 16:50:05 2005 +++ FormBuilder.php Wed Apr 20 13:10:41 2005 @@ -2345,6 +2345,10 @@ switch ($action) { case DB_DATAOBJECT_FORMBUILDER_QUERY_FORCEINSERT: $id = $this->_do->insert(); + if (!$id) { + $this->debug('Insert failed.'); + return false; + } $this->debug('ID ('.$pk.') of the new object: '.$id.'<br/>'); break; case DB_DATAOBJECT_FORMBUILDER_QUERY_FORCEUPDATE: @@ -2421,7 +2425,7 @@ $toField = $crossLink['toField']; if (isset($values['__crossLink_'.$crossLink['table']])) { - if ($crossLink['type'] == 'select') { + if (isset($crossLink['type']) && $crossLink['type'] == 'select') { $fieldvalues = array(); foreach ($values['__crossLink_'.$crossLink['table']] as $value) { $fieldvalues[$value] = $value;
« previous php.pear.general (#18833) next »