mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-16 14:31:29 +01:00
best fichinter method
This commit is contained in:
@@ -70,7 +70,10 @@ class Don
|
||||
print "<li>" . $this->errorstr[$i];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function check($minimum=0)
|
||||
{
|
||||
$err = 0;
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
* 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
|
||||
@@ -18,6 +15,9 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
class Fichinter {
|
||||
@@ -29,16 +29,19 @@ class Fichinter {
|
||||
var $date;
|
||||
var $duree;
|
||||
var $note;
|
||||
var $projet_id;
|
||||
|
||||
|
||||
Function Fichinter($DB, $soc_idp="") {
|
||||
Function Fichinter($DB, $soc_idp="")
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->socidp = $soc_idp;
|
||||
$this->products = array();
|
||||
}
|
||||
|
||||
Function add_product($idproduct) {
|
||||
if ($idproduct > 0) {
|
||||
Function add_product($idproduct)
|
||||
{
|
||||
if ($idproduct > 0)
|
||||
{
|
||||
$i = sizeof($this->products);
|
||||
$this->products[$i] = $idproduct;
|
||||
}
|
||||
@@ -48,17 +51,19 @@ class Fichinter {
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function create() {
|
||||
Function create()
|
||||
{
|
||||
/*
|
||||
* Insertion dans la base
|
||||
*/
|
||||
if (!strlen($this->duree)) { $this->duree = 0; }
|
||||
|
||||
$sql = "INSERT INTO llx_fichinter (fk_soc, datei, datec, ref, fk_user_author, note, duree) ";
|
||||
$sql .= " VALUES ($this->socidp, $this->date, now(), '$this->ref', $this->author, '$this->note', $this->duree)";
|
||||
$sql = "INSERT INTO llx_fichinter (fk_soc, datei, datec, ref, fk_user_author, note, duree, fk_projet) ";
|
||||
$sql .= " VALUES ($this->socidp, $this->date, now(), '$this->ref', $this->author, '$this->note', $this->duree, $this->projet_id)";
|
||||
$sqlok = 0;
|
||||
|
||||
if (! $this->db->query($sql) ) {
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
print $this->db->error() . '<b><br>'.$sql;
|
||||
}
|
||||
return $this->db->last_insert_id();
|
||||
@@ -68,7 +73,8 @@ class Fichinter {
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function update($id) {
|
||||
Function update($id)
|
||||
{
|
||||
/*
|
||||
* Insertion dans la base
|
||||
*/
|
||||
@@ -76,9 +82,11 @@ class Fichinter {
|
||||
$sql .= " datei = $this->date,";
|
||||
$sql .= " note = '$this->note',";
|
||||
$sql .= " duree = $this->duree";
|
||||
$sql .= ", fk_projet = $this->projet_id";
|
||||
$sql .= " WHERE rowid = $id";
|
||||
|
||||
if (! $this->db->query($sql) ) {
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
|
||||
print $this->db->error() . '<b><br>'.$sql;
|
||||
}
|
||||
@@ -89,12 +97,15 @@ class Fichinter {
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function fetch($rowid) {
|
||||
Function fetch($rowid)
|
||||
{
|
||||
|
||||
$sql = "SELECT ref,note,fk_statut,duree,".$this->db->pdate(datei)."as di FROM llx_fichinter WHERE rowid=$rowid;";
|
||||
$sql = "SELECT ref,note,fk_soc,fk_statut,duree,".$this->db->pdate(datei)."as di, fk_projet FROM llx_fichinter WHERE rowid=$rowid;";
|
||||
|
||||
if ($this->db->query($sql) ) {
|
||||
if ($this->db->num_rows()) {
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$obj = $this->db->fetch_object(0);
|
||||
|
||||
$this->id = $rowid;
|
||||
@@ -102,11 +113,15 @@ class Fichinter {
|
||||
$this->duree = $obj->duree;
|
||||
$this->ref = $obj->ref;
|
||||
$this->note = $obj->note;
|
||||
$this->societe_id = $obj->fk_soc;
|
||||
$this->projet_id = $obj->fk_projet;
|
||||
$this->statut = $obj->fk_statut;
|
||||
|
||||
$this->db->free();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,42 @@ class Form {
|
||||
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function select_array($name, $array, $id='')
|
||||
{
|
||||
print '<select name="'.$name.'">';
|
||||
|
||||
$i = 0;
|
||||
|
||||
if (strlen($id))
|
||||
{
|
||||
reset ($array);
|
||||
while (list($key, $value) = each ($array))
|
||||
{
|
||||
print "<option value=\"$key\" ";
|
||||
if ($id == $key)
|
||||
{
|
||||
print "SELECTED";
|
||||
}
|
||||
print ">$value</option>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (list($key, $value) = each ($array) )
|
||||
{
|
||||
print "<option value=\"$key\" ";
|
||||
print ">$value</option>\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print "</select>";
|
||||
|
||||
}
|
||||
/*
|
||||
* Renvoie la cha<68>ne de caract<63>re d<>crivant l'erreur
|
||||
*
|
||||
*
|
||||
|
||||
@@ -284,8 +284,13 @@ function print_oui_non($value)
|
||||
*
|
||||
*
|
||||
*/
|
||||
function print_date_select()
|
||||
function print_date_select($set_time='')
|
||||
{
|
||||
if (! isset($set_time))
|
||||
{
|
||||
$set_time = time();
|
||||
}
|
||||
|
||||
$strmonth[1] = "Janvier";
|
||||
$strmonth[2] = "Février";
|
||||
$strmonth[3] = "Mars";
|
||||
@@ -300,8 +305,8 @@ function print_date_select()
|
||||
$strmonth[12] = "Décembre";
|
||||
|
||||
$smonth = 1;
|
||||
$syear = date("Y", time());
|
||||
$cday = date("d", time());
|
||||
$syear = date("Y", $set_time);
|
||||
$cday = date("d", $set_time);
|
||||
|
||||
print "<select name=\"reday\">";
|
||||
|
||||
@@ -317,9 +322,9 @@ function print_date_select()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "</select>";
|
||||
$cmonth = date("n", time());
|
||||
|
||||
$cmonth = date("n", $set_time);
|
||||
print "<select name=\"remonth\">";
|
||||
for ($month = $smonth ; $month < $smonth + 12 ; $month++)
|
||||
{
|
||||
@@ -425,7 +430,8 @@ function gljftime($format,$timestamp) {
|
||||
}
|
||||
|
||||
|
||||
function gljPrintTitle($title, $ispage, $page=0, $parm=0) {
|
||||
function gljPrintTitle($title, $ispage, $page=0, $parm=0)
|
||||
{
|
||||
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@@ -435,11 +441,13 @@ function gljPrintTitle($title, $ispage, $page=0, $parm=0) {
|
||||
print "<b>$title</b></td><td align=\"right\">$basec <b>Page $pagenext</b>";
|
||||
print "</td>";
|
||||
|
||||
if ($ispage) {
|
||||
if ($ispage)
|
||||
{
|
||||
|
||||
print "</tr>";
|
||||
print "<tr><td>";
|
||||
if ($page > 0) {
|
||||
if ($page > 0)
|
||||
{
|
||||
print "<A href=\"".$GLOBALS["PHP_SELF"]."?page=$pageprev&$parm\"><- ".$GLOBALS["_PAGE_PREV"]."</A>";
|
||||
}
|
||||
print "</td>\n";
|
||||
@@ -448,18 +456,28 @@ function gljPrintTitle($title, $ispage, $page=0, $parm=0) {
|
||||
|
||||
print "</tr></table>";
|
||||
};
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function gljActiveSoc($db, $socidp)
|
||||
{
|
||||
|
||||
function gljActiveSoc($db, $socidp) {
|
||||
|
||||
if ($db) {
|
||||
if ($db)
|
||||
{
|
||||
$sql = "UPDATE societe set datea = " . time() . " WHERE idp= " . $socidp ;
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
if (!$result)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function gljChangeSocAlias($db, $socidp, $alias) {
|
||||
|
||||
if ($db) {
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
* 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
|
||||
@@ -18,6 +15,9 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -78,15 +78,19 @@ class Project {
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function get_propal_list() {
|
||||
Function get_propal_list()
|
||||
{
|
||||
$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) {
|
||||
if ($nump)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $nump) {
|
||||
while ($i < $nump)
|
||||
{
|
||||
$obj = $this->db->fetch_object($i);
|
||||
|
||||
$propales[$i] = $obj->rowid;
|
||||
@@ -99,11 +103,51 @@ class Project {
|
||||
*/
|
||||
return $propales;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error() . '<br>' .$sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function liste_array($id_societe='')
|
||||
{
|
||||
$projets = array();
|
||||
|
||||
$sql = "SELECT rowid, title FROM llx_projet";
|
||||
|
||||
if (isset($id_societe))
|
||||
{
|
||||
$sql .= " WHERE fk_soc = $id_societe";
|
||||
}
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$nump = $this->db->num_rows();
|
||||
|
||||
if ($nump)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $nump)
|
||||
{
|
||||
$obj = $this->db->fetch_object($i);
|
||||
|
||||
$projets[$obj->rowid] = $obj->title;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $projets;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user