Fix on energy module
This commit is contained in:
parent
4ac98658c3
commit
f403449d9a
@ -21,209 +21,211 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/energie/EnergieCompteur.class.php
|
\file htdocs/energie/EnergieCompteur.class.php
|
||||||
\ingroup energie
|
\ingroup energie
|
||||||
\brief Fichier des classes de compteur
|
\brief Fichier des classes de compteur
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\class Compteur
|
\class Compteur
|
||||||
\brief Classe de gestion des compteurs
|
\brief Classe de gestion des compteurs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class EnergieCompteur
|
class EnergieCompteur
|
||||||
{
|
{
|
||||||
var $db ;
|
var $db ;
|
||||||
var $id ;
|
var $id ;
|
||||||
var $user;
|
var $user;
|
||||||
|
|
||||||
/** \brief Constructeur
|
/** \brief Constructeur
|
||||||
*/
|
*/
|
||||||
function EnergieCompteur($DB, $user)
|
function EnergieCompteur($DB, $user)
|
||||||
{
|
{
|
||||||
$this->db = $DB;
|
global $langs;
|
||||||
$this->user = $user;
|
|
||||||
|
|
||||||
$this->energies[1] = "Electricité";
|
$this->db = $DB;
|
||||||
$this->energies[2] = "Eau";
|
$this->user = $user;
|
||||||
$this->energies[3] = "Gaz naturel";
|
|
||||||
|
|
||||||
$this->couleurs[1] = "gray";
|
$this->energies[1] = $langs->trans("Electricity");
|
||||||
$this->couleurs[2] = "blue";
|
$this->energies[2] = $langs->trans("Water");
|
||||||
$this->couleurs[3] = "yellow";
|
$this->energies[3] = $langs->trans("NaturalGaz");
|
||||||
}
|
|
||||||
|
$this->couleurs[1] = "gray";
|
||||||
|
$this->couleurs[2] = "blue";
|
||||||
|
$this->couleurs[3] = "yellow";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lecture
|
* Lecture
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function fetch ($id)
|
function fetch ($id)
|
||||||
{
|
{
|
||||||
$sql = "SELECT c.rowid, c.libelle, fk_energie";
|
$sql = "SELECT c.rowid, c.libelle, fk_energie";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur as c";
|
$sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur as c";
|
||||||
$sql .= " WHERE c.rowid = ".$id;
|
$sql .= " WHERE c.rowid = ".$id;
|
||||||
|
|
||||||
$resql = $this->db->query($sql) ;
|
$resql = $this->db->query($sql) ;
|
||||||
|
|
||||||
if ( $resql )
|
if ( $resql )
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->libelle = $obj->libelle;
|
$this->libelle = $obj->libelle;
|
||||||
$this->energie = $obj->fk_energie;
|
$this->energie = $obj->fk_energie;
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("");
|
dol_syslog("");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lecture
|
* Lecture
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function Create ($libelle, $energie)
|
function Create ($libelle, $energie)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."energie_compteur";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."energie_compteur";
|
||||||
$sql .= " (libelle, datec, fk_user_author, fk_energie, note)";
|
$sql .= " (libelle, datec, fk_user_author, fk_energie, note)";
|
||||||
$sql .= " VALUES (";
|
$sql .= " VALUES (";
|
||||||
$sql .= "'".trim($libelle)."'";
|
$sql .= "'".trim($libelle)."'";
|
||||||
$sql .= ",now()";
|
$sql .= ",now()";
|
||||||
$sql .= ",'".$this->user->id."'";
|
$sql .= ",'".$this->user->id."'";
|
||||||
$sql .= ",'".$energie."'";
|
$sql .= ",'".$energie."'";
|
||||||
$sql .= ",'');";
|
$sql .= ",'');";
|
||||||
|
|
||||||
$resql = $this->db->query($sql) ;
|
$resql = $this->db->query($sql) ;
|
||||||
|
|
||||||
if ( $resql )
|
if ( $resql )
|
||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."energie_compteur");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."energie_compteur");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("EnergieCompteur::Create Erreur 1");
|
dol_syslog("EnergieCompteur::Create Erreur 1");
|
||||||
dol_syslog($this->db->error());
|
dol_syslog($this->db->error());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajout d'une valeur relevée
|
* Ajout d'une valeur relev<EFBFBD>e
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function AjoutReleve ($date_releve, $valeur)
|
function AjoutReleve ($date_releve, $valeur)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."energie_compteur_releve";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."energie_compteur_releve";
|
||||||
$sql .= " (fk_compteur, date_releve, valeur, datec, fk_user_author)";
|
$sql .= " (fk_compteur, date_releve, valeur, datec, fk_user_author)";
|
||||||
$sql .= " VALUES (";
|
$sql .= " VALUES (";
|
||||||
$sql .= "'".$this->id."'";
|
$sql .= "'".$this->id."'";
|
||||||
$sql .= ",'".$this->db->idate($date_releve)."'";
|
$sql .= ",'".$this->db->idate($date_releve)."'";
|
||||||
$sql .= ",'".$valeur."'";
|
$sql .= ",'".$valeur."'";
|
||||||
$sql .= ",now()";
|
$sql .= ",now()";
|
||||||
$sql .= ",'".$this->user->id."');";
|
$sql .= ",'".$this->user->id."');";
|
||||||
|
|
||||||
$resql = $this->db->query($sql) ;
|
$resql = $this->db->query($sql) ;
|
||||||
|
|
||||||
if ( $resql )
|
if ( $resql )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("EnergieCompteur::AjoutReleve Erreur 1");
|
dol_syslog("EnergieCompteur::AjoutReleve Erreur 1");
|
||||||
dol_syslog($this->db->error());
|
dol_syslog($this->db->error());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Suppression d'une valeur relevée
|
* Suppression d'une valeur relev<EFBFBD>e
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function DeleteReleve ($rowid)
|
function DeleteReleve ($rowid)
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."energie_compteur_releve";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."energie_compteur_releve";
|
||||||
$sql .= " WHERE rowid = '".$rowid."';";
|
$sql .= " WHERE rowid = '".$rowid."';";
|
||||||
|
|
||||||
$resql = $this->db->query($sql) ;
|
$resql = $this->db->query($sql) ;
|
||||||
|
|
||||||
if ( $resql )
|
if ( $resql )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("EnergieCompteur::AjoutReleve Erreur 1");
|
dol_syslog("EnergieCompteur::AjoutReleve Erreur 1");
|
||||||
dol_syslog($this->db->error());
|
dol_syslog($this->db->error());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Ajout d'une valeur relevée
|
* Ajout d'une valeur relev<EFBFBD>e
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function AddGroup ($groupe)
|
function AddGroup ($groupe)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."energie_compteur_groupe";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."energie_compteur_groupe";
|
||||||
$sql .= " (fk_energie_compteur, fk_energie_groupe)";
|
$sql .= " (fk_energie_compteur, fk_energie_groupe)";
|
||||||
$sql .= " VALUES ('".$this->id."','".$groupe."');";
|
$sql .= " VALUES ('".$this->id."','".$groupe."');";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if ( $resql )
|
if ( $resql )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("EnergieCompteur::AddGroup Erreur 1");
|
dol_syslog("EnergieCompteur::AddGroup Erreur 1");
|
||||||
dol_syslog($this->db->error());
|
dol_syslog($this->db->error());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function GroupsAvailable ()
|
function GroupsAvailable ()
|
||||||
{
|
{
|
||||||
$this->groups_available = array();
|
$this->groups_available = array();
|
||||||
|
|
||||||
$sql = "SELECT g.rowid, g.libelle";
|
$sql = "SELECT g.rowid, g.libelle";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."energie_groupe as g";
|
$sql .= " FROM ".MAIN_DB_PREFIX."energie_groupe as g";
|
||||||
|
|
||||||
$resql = $this->db->query($sql) ;
|
$resql = $this->db->query($sql) ;
|
||||||
|
|
||||||
if ( $resql )
|
if ( $resql )
|
||||||
{
|
{
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$this->groups_available[$obj->rowid] = $obj->libelle;
|
$this->groups_available[$obj->rowid] = $obj->libelle;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("");
|
dol_syslog("");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -21,16 +21,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/energie/compteur.php
|
* \file htdocs/energie/compteur.php
|
||||||
\ingroup energie
|
* \ingroup energie
|
||||||
\brief Fiche compteur
|
* \brief Fiche compteur
|
||||||
\version $Revision$
|
* \version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_POST["action"] == 'add')
|
if ($_POST["action"] == 'add')
|
||||||
@ -67,8 +67,11 @@ if ($_POST["action"] == 'addvalue')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* Views
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader($langs, '',$langs->trans("Compteur"),"Compteur");
|
llxHeader($langs, '',$langs->trans("Compteur"),"Compteur");
|
||||||
@ -77,7 +80,6 @@ llxHeader($langs, '',$langs->trans("Compteur"),"Compteur");
|
|||||||
*
|
*
|
||||||
* Mode creation
|
* Mode creation
|
||||||
*
|
*
|
||||||
*
|
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
if ($_GET["action"] == 'create')
|
if ($_GET["action"] == 'create')
|
||||||
{
|
{
|
||||||
@ -99,7 +101,7 @@ if ($_GET["action"] == 'create')
|
|||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
print '<td>Libellé</td>';
|
print '<td>'.$langs->trans("Label").'</td>';
|
||||||
|
|
||||||
print '<td><input type="text" size="40" maxlength="255" name="libelle"></td></tr>';
|
print '<td><input type="text" size="40" maxlength="255" name="libelle"></td></tr>';
|
||||||
|
|
||||||
@ -128,20 +130,20 @@ else
|
|||||||
{
|
{
|
||||||
|
|
||||||
$head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id;
|
$head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id;
|
||||||
$head[0][1] = "Compteur";
|
$head[0][1] = $langs->trans("Compteur");
|
||||||
$h++;
|
$h++;
|
||||||
$a = 0;
|
$a = 0;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id;
|
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id;
|
||||||
$head[$h][1] = "Graph";
|
$head[$h][1] = $langs->trans("Graph");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id;
|
$head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id;
|
||||||
$head[$h][1] = "Relevés";
|
$head[$h][1] = $langs->trans("Releves");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id;
|
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id;
|
||||||
$head[$h][1] = "Groupe";
|
$head[$h][1] = $langs->trans("Groups");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
dol_fiche_head($head, $a, $soc->nom);
|
dol_fiche_head($head, $a, $soc->nom);
|
||||||
@ -166,7 +168,7 @@ else
|
|||||||
|
|
||||||
print '<td>Date</td><td>';
|
print '<td>Date</td><td>';
|
||||||
print $html->select_date('','','','','',"addvalue");
|
print $html->select_date('','','','','',"addvalue");
|
||||||
print '</td><td>Valeur relevée</td>';
|
print '</td><td>Valeur relevee</td>';
|
||||||
|
|
||||||
print '<td align="center"><input type="text" size="11" maxlength="10" name="releve"></td>';
|
print '<td align="center"><input type="text" size="11" maxlength="10" name="releve"></td>';
|
||||||
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>';
|
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>';
|
||||||
@ -182,7 +184,7 @@ else
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Date").'</td>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Date").'</td>';
|
||||||
print '<td>'.$langs->trans("Relevé").'</td></tr>';
|
print '<td>'.$langs->trans("Releve").'</td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT ".$db->pdate("date_releve")." as date_releve, valeur";
|
$sql = "SELECT ".$db->pdate("date_releve")." as date_releve, valeur";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur_releve as ecr";
|
$sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur_releve as ecr";
|
||||||
@ -210,7 +212,7 @@ else
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Commande non trouvée */
|
/* Commande non trouv<EFBFBD>e */
|
||||||
print "Compteur inexistant";
|
print "Compteur inexistant";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,5 +224,5 @@ else
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
llxFooter('$Date$ - $Revision$');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -14,13 +14,22 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* 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$
|
/**
|
||||||
*
|
* \file htdocs/energie/compteur_graph.php
|
||||||
|
* \ingroup energie
|
||||||
|
* \brief Fiche de gestion des graphs des compteurs
|
||||||
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
llxHeader($langs, '',$langs->trans("Compteur"),"Compteur");
|
llxHeader($langs, '',$langs->trans("Compteur"),"Compteur");
|
||||||
|
|
||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
@ -35,20 +44,20 @@ if ($_GET["id"] > 0)
|
|||||||
if ( $compteur->fetch($_GET["id"]) == 0)
|
if ( $compteur->fetch($_GET["id"]) == 0)
|
||||||
{
|
{
|
||||||
$head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id;
|
$head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id;
|
||||||
$head[0][1] = "Compteur";
|
$head[0][1] = $langs->trans("Compteur");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id;
|
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id;
|
||||||
$head[$h][1] = "Graph";
|
$head[$h][1] = $langs->trans("Graph");
|
||||||
$a = $h;
|
$a = $h;
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id;
|
$head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id;
|
||||||
$head[$h][1] = "Relevés";
|
$head[$h][1] = $langs->trans("Releves");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id;
|
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id;
|
||||||
$head[$h][1] = "Groupe";
|
$head[$h][1] = $langs->trans("Groups");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
dol_fiche_head($head, $a, $soc->nom);
|
dol_fiche_head($head, $a, $soc->nom);
|
||||||
@ -83,7 +92,7 @@ if ($_GET["id"] > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Compteur non trouvée */
|
/* Compteur non trouv<EFBFBD>e */
|
||||||
print "Compteur inexistant";
|
print "Compteur inexistant";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,102 +14,105 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* 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$
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/energie/compteur_groupe.php
|
* \file htdocs/energie/compteur_groupe.php
|
||||||
\ingroup energie
|
* \ingroup energie
|
||||||
\brief Fiche de gestion des groupes des compteurs
|
* \brief Fiche de gestion des groupes des compteurs
|
||||||
\version $Revision$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
if ($_POST["action"] == 'addvalue')
|
if ($_POST["action"] == 'addvalue')
|
||||||
{
|
{
|
||||||
$compteur = new EnergieCompteur($db, $user);
|
$compteur = new EnergieCompteur($db, $user);
|
||||||
if ( $compteur->fetch($_GET["id"]) == 0)
|
if ( $compteur->fetch($_GET["id"]) == 0)
|
||||||
{
|
|
||||||
if ( $compteur->AddGroup($_POST["groupe"]) == 0)
|
|
||||||
{
|
{
|
||||||
|
if ( $compteur->AddGroup($_POST["groupe"]) == 0)
|
||||||
|
{
|
||||||
Header("Location: compteur.php?id=".$_GET["id"]);
|
Header("Location: compteur.php?id=".$_GET["id"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader($langs, '',$langs->trans("Compteur"),"Compteur");
|
llxHeader($langs, '',$langs->trans("Compteur"),"Compteur");
|
||||||
|
|
||||||
if ($_GET["id"] > 0)
|
if ($_GET["id"] > 0)
|
||||||
{
|
{
|
||||||
$compteur = new EnergieCompteur($db, $user);
|
$compteur = new EnergieCompteur($db, $user);
|
||||||
if ( $compteur->fetch($_GET["id"]) == 0)
|
if ( $compteur->fetch($_GET["id"]) == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id;
|
$head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id;
|
||||||
$head[0][1] = "Compteur";
|
$head[0][1] = $langs->trans("Compteur");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id;
|
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id;
|
||||||
$head[$h][1] = "Graph";
|
$head[$h][1] = $langs->trans("Graph");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id;
|
$head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id;
|
||||||
$head[$h][1] = "Relevés";
|
$head[$h][1] = $langs->trans("Releves");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id;
|
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id;
|
||||||
$head[$h][1] = "Groupe";
|
$head[$h][1] = $langs->trans("Groups");
|
||||||
$a = $h;
|
$a = $h;
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
dol_fiche_head($head, $a, $soc->nom);
|
dol_fiche_head($head, $a, $soc->nom);
|
||||||
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print "<tr><td>".$langs->trans("Compteur")."</td>";
|
print "<tr><td>".$langs->trans("Compteur")."</td>";
|
||||||
print '<td width="50%">';
|
print '<td width="50%">';
|
||||||
print $compteur->libelle;
|
print $compteur->libelle;
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
print '<form action="compteur_groupe.php?id='.$compteur->id.'" method="post">';
|
print '<form action="compteur_groupe.php?id='.$compteur->id.'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="addvalue">';
|
print '<input type="hidden" name="action" value="addvalue">';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
$compteur->GroupsAvailable();
|
$compteur->GroupsAvailable();
|
||||||
|
|
||||||
print '<td>Groupe</td><td>';
|
print '<td>Groupe</td><td>';
|
||||||
print $html->select_array("groupe", $compteur->groups_available);
|
print $html->select_array("groupe", $compteur->groups_available);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="center"><input type="submit" value="'.$langs->trans("Add").'"></td></tr>';
|
print '<td align="center"><input type="submit" value="'.$langs->trans("Add").'"></td></tr>';
|
||||||
|
|
||||||
print "</table></form><br>";
|
print "</table></form><br>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Commande non trouvée */
|
/* Commande non trouv<75>e */
|
||||||
print "Compteur inexistant";
|
print "Compteur inexistant";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "Compteur inexistant";
|
print "Compteur inexistant";
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -21,16 +21,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/energie/groupe.php
|
* \file htdocs/energie/groupe.php
|
||||||
\ingroup energie
|
* \ingroup energie
|
||||||
\brief Fiche groupe
|
* \brief Fiche groupe
|
||||||
\version $Revision$
|
* \version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_POST["action"] == 'add')
|
if ($_POST["action"] == 'add')
|
||||||
@ -47,11 +47,12 @@ if ($_POST["action"] == 'add')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader($langs, '',$langs->trans("Groupe"),"Groupe");
|
llxHeader($langs, '',$langs->trans("Group"), "Group");
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
@ -62,7 +63,7 @@ llxHeader($langs, '',$langs->trans("Groupe"),"Groupe");
|
|||||||
if ($_GET["action"] == 'create')
|
if ($_GET["action"] == 'create')
|
||||||
{
|
{
|
||||||
$head[0][0] = DOL_URL_ROOT.'/energie/groupe.php?action=create';
|
$head[0][0] = DOL_URL_ROOT.'/energie/groupe.php?action=create';
|
||||||
$head[0][1] = "Nouveau groupe";
|
$head[0][1] = $langs->trans("NewGroup");
|
||||||
$h++;
|
$h++;
|
||||||
$a = 0;
|
$a = 0;
|
||||||
|
|
||||||
@ -76,7 +77,7 @@ if ($_GET["action"] == 'create')
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td>Libellé</td>';
|
print '<td>'.$langs->trans("Label").'</td>';
|
||||||
|
|
||||||
print '<td><input type="text" size="40" maxlength="255" name="libelle"></td></tr>';
|
print '<td><input type="text" size="40" maxlength="255" name="libelle"></td></tr>';
|
||||||
|
|
||||||
@ -101,14 +102,14 @@ else
|
|||||||
{
|
{
|
||||||
|
|
||||||
$head[0][0] = DOL_URL_ROOT.'/energie/groupe.php?id='.$commande->id;
|
$head[0][0] = DOL_URL_ROOT.'/energie/groupe.php?id='.$commande->id;
|
||||||
$head[0][1] = "Groupe";
|
$head[0][1] = $langs->trans("Group");
|
||||||
$h++;
|
$h++;
|
||||||
$a = 0;
|
$a = 0;
|
||||||
|
|
||||||
dol_fiche_head($head, $a, $soc->nom);
|
dol_fiche_head($head, $a, $soc->nom);
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print "<tr><td>".$langs->trans("Groupe")."</td>";
|
print "<tr><td>".$langs->trans("Group")."</td>";
|
||||||
print '<td width="50%">';
|
print '<td width="50%">';
|
||||||
print $groupe->libelle;
|
print $groupe->libelle;
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
@ -142,7 +143,7 @@ else
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Commande non trouvée */
|
/* Commande non trouv<EFBFBD>e */
|
||||||
print "Groupe inexistant";
|
print "Groupe inexistant";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,16 +21,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/energie/compteur.php
|
* \file htdocs/energie/compteur.php
|
||||||
\ingroup energie
|
* \ingroup energie
|
||||||
\brief Fiche compteur
|
* \brief Fiche compteur
|
||||||
\version $Revision$
|
* \version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_GET["action"] == 'delete')
|
if ($_GET["action"] == 'delete')
|
||||||
@ -44,8 +45,10 @@ if ($_GET["action"] == 'delete')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader($langs, '',$langs->trans("Compteur"),"Compteur");
|
llxHeader($langs, '',$langs->trans("Compteur"),"Compteur");
|
||||||
@ -58,20 +61,20 @@ if ($_GET["id"] > 0)
|
|||||||
{
|
{
|
||||||
|
|
||||||
$head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id;
|
$head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id;
|
||||||
$head[0][1] = "Compteur";
|
$head[0][1] = $langs->trans("Compteur");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id;
|
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id;
|
||||||
$head[$h][1] = "Graph";
|
$head[$h][1] = $langs->trans("Graph");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id;
|
$head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id;
|
||||||
$head[$h][1] = "Relevés";
|
$head[$h][1] = $langs->trans("Releves");
|
||||||
$h++;
|
$h++;
|
||||||
$a = 2;
|
$a = 2;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id;
|
$head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id;
|
||||||
$head[$h][1] = "Groupe";
|
$head[$h][1] = $langs->trans("Groups");
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
dol_fiche_head($head, $a, $soc->nom);
|
dol_fiche_head($head, $a, $soc->nom);
|
||||||
@ -102,11 +105,11 @@ if ($_GET["id"] > 0)
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
$var=True;
|
$var=True;
|
||||||
|
|
||||||
print_barre_liste("Relevés", $page, "", "&id=".$compteur->id, $sortfield, $sortorder,'',$num);
|
print_barre_liste("Releves", $page, "", "&id=".$compteur->id, $sortfield, $sortorder,'',$num, 0, '');
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Date").'</td>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Date").'</td>';
|
||||||
print '<td colspan="2">'.$langs->trans("Relevé").'</td></tr>';
|
print '<td colspan="2">'.$langs->trans("Releve").'</td></tr>';
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
@ -125,7 +128,7 @@ if ($_GET["id"] > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Commande non trouvée */
|
/* Commande non trouv<EFBFBD>e */
|
||||||
print "Compteur inexistant";
|
print "Compteur inexistant";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user