set du champs dateo lors de la création

indexation du code
This commit is contained in:
Rodolphe Quiedeville 2003-07-24 23:49:05 +00:00
parent 2eb7d547e7
commit 9ed35d62a5

View File

@ -1,8 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,6 +15,9 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$
* $Source$
*
*/ */
@ -29,10 +29,11 @@ class Project {
var $socidp; var $socidp;
var $societe; var $societe;
Function Project($DB) { Function Project($DB)
$this->db = $DB; {
$this->societe = new Societe($DB); $this->db = $DB;
} $this->societe = new Societe($DB);
}
/* /*
* *
* *
@ -42,8 +43,8 @@ class Project {
Function create($creatorid) Function create($creatorid)
{ {
$sql = "INSERT INTO llx_projet (ref, title, fk_soc, fk_user_creat) "; $sql = "INSERT INTO llx_projet (ref, title, fk_soc, fk_user_creat, dateo) ";
$sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, $creatorid) ;"; $sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, $creatorid, now()) ;";
if (!$this->db->query($sql) ) if (!$this->db->query($sql) )
{ {
@ -58,55 +59,64 @@ class Project {
* *
*/ */
Function fetch($rowid) { Function fetch($rowid)
{
$sql = "SELECT fk_soc, title, ref FROM llx_projet WHERE rowid=$rowid;"; $sql = "SELECT fk_soc, title, ref FROM llx_projet WHERE rowid=$rowid;";
if ($this->db->query($sql) ) { if ($this->db->query($sql) )
if ($this->db->num_rows()) { {
$obj = $this->db->fetch_object(0); if ($this->db->num_rows())
{
$obj = $this->db->fetch_object(0);
$this->id = $rowid; $this->id = $rowid;
$this->ref = $obj->ref; $this->ref = $obj->ref;
$this->title = $obj->title; $this->title = $obj->title;
$this->societe->id = $obj->fk_soc; $this->societe->id = $obj->fk_soc;
$this->db->free(); $this->db->free();
} }
} else { }
print $this->db->error(); else
{
print $this->db->error();
}
} }
}
/* /*
* *
* *
* *
*/ */
Function get_propal_list() { Function get_propal_list()
$propales = array(); {
$sql = "SELECT rowid FROM llx_propal WHERE fk_projet=$this->id;"; $propales = array();
$sql = "SELECT rowid FROM llx_propal WHERE fk_projet=$this->id;";
if ($this->db->query($sql) ) { if ($this->db->query($sql) )
$nump = $this->db->num_rows(); {
if ($nump) { $nump = $this->db->num_rows();
$i = 0; if ($nump)
while ($i < $nump) { {
$obj = $this->db->fetch_object($i); $i = 0;
while ($i < $nump)
{
$obj = $this->db->fetch_object($i);
$propales[$i] = $obj->rowid; $propales[$i] = $obj->rowid;
$i++; $i++;
}
$this->db->free();
/*
* Retourne un tableau contenant la liste des propales associees
*/
return $propales;
}
}
else
{
print $this->db->error() . '<br>' .$sql;
} }
$this->db->free();
/*
* Retourne un tableau contenant la liste des propales associees
*/
return $propales;
}
} else {
print $this->db->error() . '<br>' .$sql;
} }
}
} }
?> ?>