Ticket #497: patch-497.diff
| File patch-497.diff, 2.4 kB (added by bastnic, 9 months ago) |
|---|
-
lib/jelix/forms/jFormsBase.class.php
old new 4 4 * @subpackage forms 5 5 * @author Laurent Jouanneau 6 6 * @contributor Dominique Papin 7 * @copyright 2006-2007 Laurent Jouanneau, 2007 Dominique Papin 7 * @contributor Bastien Jaillot 8 * @copyright 2006-2007 Laurent Jouanneau, 2007 Dominique Papin, 2008 Bastien Jaillot 8 9 * @link http://www.jelix.org 9 10 * @licence http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file 10 11 */ … … 206 207 } 207 208 208 209 /** 209 * save datas using a dao. 210 * it call insert or update depending the value of the formId stored in the container 210 * prepare a dao whith all controls 211 211 * @param string $daoSelector the selector of a dao file 212 212 * @param string $key the primary key for the dao. if null, takes the form ID as primary key 213 213 * @param string $dbProfil the jDb profil to use with the dao 214 * @return mixed the primary key of the new record in a case of inserting214 * @return mixed return three var : $daorec, $dao, $toInsert which have to be extracted 215 215 * @see jDao 216 216 */ 217 public function saveToDao($daoSelector, $key = null, $dbProfil=''){217 public function prepareDaoFromControls($daoSelector, $key = null, $dbProfil=''){ 218 218 $dao = jDao::create($daoSelector, $dbProfil); 219 219 220 220 if($key === null) … … 269 269 $daorec->$name = $dt->toString(jDateTime::DB_DFORMAT); 270 270 } 271 271 } 272 return compact("daorec", "dao", "toInsert"); 273 } 274 275 276 /** 277 * save datas using a dao. 278 * it call insert or update depending the value of the formId stored in the container 279 * @param string $daoSelector the selector of a dao file 280 * @param string $key the primary key for the dao. if null, takes the form ID as primary key 281 * @param string $dbProfil the jDb profil to use with the dao 282 * @return mixed the primary key of the new record in a case of inserting 283 * @see jDao 284 */ 285 public function saveToDao($daoSelector, $key = null, $dbProfil=''){ 286 extract($this->prepareDaoFromControls($daoSelector,$key,$dbProfil)); 272 287 if($toInsert){ 273 288 // todo : what about updating the formId with the Pk ? 274 289 $dao->insert($daorec);
