Mise en conformité du code

This commit is contained in:
Rodolphe Quiedeville 2005-04-05 11:52:30 +00:00
parent 695d6f27ab
commit b69469e6de

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -21,16 +21,16 @@
* *
*/ */
/** /*!
\file htdocs/project.class.php \file htdocs/project.class.php
\ingroup projet \ingroup projet
\brief Fichier de la classe de gestion des projets \brief Fichier de la classe de gestion des projets
\version $Revision$ \version $Revision$
*/ */
/*!
/** \class Project \class Project
\brief Classe permettant la gestion des projets \brief Classe permettant la gestion des projets
*/ */
class Project { class Project {
@ -44,26 +44,26 @@ class Project {
* \brief Constructeur de la classe * \brief Constructeur de la classe
* \param DB handler accès base de données * \param DB handler accès base de données
*/ */
function Project($DB) { function Project($DB)
{
$this->db = $DB; $this->db = $DB;
} }
/* /*
* \brief Crée un projet en base * \brief Crée un projet en base
* \param creatorid id utilisateur qui crée * \param user id utilisateur qui crée
*/ */
function create($creatorid) { function create($user)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet (ref, title, fk_soc, fk_user_creat) "; $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet (ref, title, fk_soc, fk_user_creat) ";
$sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, $creatorid) ;"; $sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, ".$user->id.") ;";
if (!$this->db->query($sql) ) if (!$this->db->query($sql) )
{ {
print '<b>'.$sql.'</b><br>'.$this->db->error(); print '<b>'.$sql.'</b><br>'.$this->db->error();
}
}
} }
/* /*
@ -71,26 +71,32 @@ class Project {
* \param rowid id du projet à charger * \param rowid id du projet à charger
*/ */
function fetch($rowid) { function fetch($rowid)
{
$sql = "SELECT title, ref FROM ".MAIN_DB_PREFIX."projet";
$sql .= " WHERE rowid=".$rowid;
$sql = "SELECT title, ref FROM ".MAIN_DB_PREFIX."projet WHERE rowid=$rowid;"; $resql = $this->db->query($sql);
if ($resql)
if ($this->db->query($sql) ) { {
if ($this->db->num_rows()) { if ($this->db->num_rows($resql))
$obj = $this->db->fetch_object(); {
$obj = $this->db->fetch_object($resql);
$this->id = $rowid;
$this->ref = $obj->ref; $this->id = $rowid;
$this->title = $obj->title; $this->ref = $obj->ref;
$this->title = $obj->title;
$this->db->free();
$this->db->free($resql);
}
}
else
{
print $this->db->error();
} }
} else {
print $this->db->error();
}
} }
/* /*
* *
* *
@ -135,7 +141,6 @@ class Project {
* *
* *
*/ */
function liste_array($id_societe='') function liste_array($id_societe='')
{ {
$projets = array(); $projets = array();
@ -170,6 +175,5 @@ class Project {
} }
} }
} }
?> ?>