/[dolibarr]/dolibarr/htdocs/project.class.php
ViewVC logotype

Diff of /dolibarr/htdocs/project.class.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by marc_ocebo, Mon Jun 27 21:47:45 2005 UTC revision 1.11 by rodolphe, Sat Jul 30 20:23:00 2005 UTC
# Line 57  class Project { Line 57  class Project {
57    
58    function create($user)    function create($user)
59    {    {
60      $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet (ref, title, fk_soc, fk_user_creat, dateo) ";      if (strlen(trim($this->ref)) > 0)
     $sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, ".$user->id.",now()) ;";  
       
     if ($this->db->query($sql) )  
61        {        {
62          return $this->db->last_insert_id(MAIN_DB_PREFIX."projet");          $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet (ref, title, fk_soc, fk_user_creat, dateo) ";
63            $sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, ".$user->id.",now()) ;";
64            
65            if ($this->db->query($sql) )
66              {
67                $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet");
68                $result = 0;
69              }
70            else
71              {
72                dolibarr_syslog($this->db->error());
73                $result = -2;
74              }    
75        }        }
76      else      else
77        {        {
78          print '<b>'.$sql.'</b><br>'.$this->db->error();            dolibarr_syslog("Project::Create ref null");
79            $result = -1;
80          }    
81      
82        return $result;
83      }  
84    
85      function update($user)
86      {
87        if (strlen(trim($this->ref)) > 0)
88          {
89            $sql = "UPDATE ".MAIN_DB_PREFIX."projet";
90            $sql .= " SET ref='$this->ref'";
91            $sql .= " , title = '$this->title'";
92            $sql .= " WHERE rowid = ".$this->id;
93            
94            if ($this->db->query($sql) )
95              {
96                $result = 0;
97              }
98            else
99              {
100                dolibarr_syslog($this->db->error());
101                $result = -2;
102              }    
103          }
104        else
105          {
106            dolibarr_syslog("Project::Update ref null");
107            $result = -1;
108        }            }    
   }  
109        
110        return $result;
111      }  
112    
113    
114    /*    /*
115     *    \brief      Charge objet projet depuis la base     *    \brief      Charge objet projet depuis la base
116     *    \param      rowid       id du projet à charger     *    \param      rowid       id du projet à charger
# Line 282  class Project { Line 323  class Project {
323          }          }
324      }      }
325    
326      /*
327       *    \brief    Supprime l'projet dans la base
328       *    \param    Utilisateur
329       */
330    
331      function delete($user)
332      {
333        
334        $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet";
335        $sql .= " WHERE rowid=".$this->id;
336    
337        $resql = $this->db->query($sql);
338        if ($resql)
339          {
340            return 0;
341          }
342        else
343          {
344            return -1;
345          }
346      }
347  }  }
348  ?>  ?>

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26