Ticket #497: patch-497.diff

File patch-497.diff, 2.4 kB (added by bastnic, 9 months ago)

pas taper

  • lib/jelix/forms/jFormsBase.class.php

    old new  
    44* @subpackage  forms 
    55* @author      Laurent Jouanneau 
    66* @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 
    89* @link        http://www.jelix.org 
    910* @licence     http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file 
    1011*/ 
     
    206207    } 
    207208 
    208209    /** 
    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 
    211211     * @param string $daoSelector the selector of a dao file 
    212212     * @param string $key the primary key for the dao. if null, takes the form ID as primary key 
    213213     * @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 inserting 
     214     * @return mixed return three var : $daorec, $dao, $toInsert which have to be extracted 
    215215     * @see jDao 
    216216     */ 
    217     public function saveToDao($daoSelector, $key = null, $dbProfil=''){ 
     217    public function prepareDaoFromControls($daoSelector, $key = null, $dbProfil=''){ 
    218218        $dao = jDao::create($daoSelector, $dbProfil); 
    219219 
    220220        if($key === null) 
     
    269269                $daorec->$name = $dt->toString(jDateTime::DB_DFORMAT); 
    270270            } 
    271271        } 
     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)); 
    272287        if($toInsert){ 
    273288            // todo : what about updating the formId with the Pk ? 
    274289            $dao->insert($daorec); 
Download in other formats: Original Format