Fichiers dplacs
This commit is contained in:
parent
8f66eb3773
commit
abaf05a074
@ -1,191 +0,0 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* 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$
|
||||
*
|
||||
*/
|
||||
require("./pre.inc.php3");
|
||||
require("./project.class.php3");
|
||||
require("../../propal.class.php3");
|
||||
|
||||
if ($HTTP_POST_VARS["action"] == 'update')
|
||||
{
|
||||
$projet = new Project($db);
|
||||
$projet->id = $id;
|
||||
$projet->ref = $HTTP_POST_VARS["ref"];
|
||||
$projet->title = $HTTP_POST_VARS["title"];
|
||||
$projet->update();
|
||||
}
|
||||
|
||||
if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] == yes)
|
||||
{
|
||||
$projet = new Project($db);
|
||||
$projet->id = $id;
|
||||
$projet->delete();
|
||||
Header("Location: index.php");
|
||||
}
|
||||
|
||||
llxHeader("","../");
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
|
||||
print '<form method="post" action="'.$PHP_SELF.'?id='.$id.'">';
|
||||
print '<input type="hidden" name="action" value="confirm_delete">';
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
|
||||
print '<tr><td colspan="3">Supprimer le projet</td></tr>';
|
||||
|
||||
print '<tr><td class="delete">Etes-vous sur de vouloir supprimer ce projet ?</td><td class="delete">';
|
||||
$htmls = new Form($db);
|
||||
|
||||
$htmls->selectyesno("confirm","no");
|
||||
|
||||
print "</td>\n";
|
||||
print '<td class="delete" align="center"><input type="submit" value="Confirmer"</td></tr>';
|
||||
print '</table>';
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print_titre("Nouveau projet");
|
||||
|
||||
print '<form action="index.php?socidp='.$socidp.'" method="post">';
|
||||
?>
|
||||
<table border="1" cellpadding="4" cellspacing="0">
|
||||
<input type="hidden" name="action" value="create">
|
||||
<tr><td>Société</td><td>
|
||||
<?PHP
|
||||
$societe = new Societe($db);
|
||||
$societe->get_nom($socidp);
|
||||
print '<a href="../fiche.php3?socid='.$socidp.'">'.$societe->nom.'</a>';
|
||||
|
||||
?>
|
||||
</td></tr>
|
||||
<?PHP
|
||||
print '<tr><td>Créateur</td><td>'.$user->fullname.'</td></tr>';
|
||||
?>
|
||||
<tr><td>Référence</td><td><input size="10" type="text" name="ref"></td></tr>
|
||||
<tr><td>Titre</td><td><input size="30" type="text" name="title"></td></tr>
|
||||
<tr><td colspan="2"><input type="submit" value="Enregistrer"></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<?PHP
|
||||
|
||||
} else {
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
print_titre("Fiche projet");
|
||||
|
||||
$propales = array();
|
||||
$projet = new Project($db);
|
||||
$projet->fetch($id);
|
||||
|
||||
$projet->societe->fetch($projet->societe->id);
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<form method="post" action="fiche.php3?id='.$id.'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<table border="1" cellpadding="4" cellspacing="0">';
|
||||
print '<tr><td>Société</td><td>'.$projet->societe->nom.'</td></tr>';
|
||||
print '<tr><td>Ref</td><td><input name="ref" value="'.$projet->ref.'"></td></tr>';
|
||||
print '<tr><td>Titre</td><td><input name="title" value="'.$projet->title.'"></td></tr>';
|
||||
print '</table><input type="submit" Value="Enregistrer"></form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<table border="1" cellpadding="4" cellspacing="0" width="100%">';
|
||||
print '<tr><td>Société</td><td><a href="../fiche.php3?socid='.$projet->societe->id.'">'.$projet->societe->nom.'</a></td></tr>';
|
||||
|
||||
print '<tr><td width="20%">Réf</td><td>'.$projet->ref.'</td></tr>';
|
||||
print '<tr><td width="20%">Titre</td><td>'.$projet->title.'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
$propales = $projet->get_propal_list();
|
||||
|
||||
if (sizeof($propales)>0 && is_array($propales))
|
||||
{
|
||||
|
||||
print_titre('Listes des propales associées au projet');
|
||||
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
|
||||
|
||||
print '<TR class="liste_titre">';
|
||||
print "<TD>Réf</TD>";
|
||||
print '<TD>Date</TD>';
|
||||
print '<TD align="right">Prix</TD>';
|
||||
print '<TD align="center">Statut</TD>';
|
||||
print '</TR>';
|
||||
|
||||
for ($i = 0; $i<sizeof($propales);$i++){
|
||||
$propale = new Propal($db);
|
||||
$propale->fetch($propales[$i]);
|
||||
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD><a href=\"../propal.php3?propalid=$propale->id\">$propale->ref</a></TD>\n";
|
||||
|
||||
print '<TD>'.strftime("%d %B %Y",$propale->datep).'</a></TD>';
|
||||
|
||||
print '<TD align="right">'.price($propale->price).'</TD>';
|
||||
print '<TD align="center">'.$propale->statut.'</TD>';
|
||||
print '</TR>';
|
||||
|
||||
$total = $total + $propale->price;
|
||||
}
|
||||
|
||||
print '<tr><td>'.$i.' propales</td>';
|
||||
print '<td colspan="2" align="right"><b>Total : '.price($total).'</b></td>';
|
||||
print '<td align="left"><b>Euros HT</b></td></tr>';
|
||||
print "</TABLE>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>";
|
||||
|
||||
if ($action == "edit")
|
||||
{
|
||||
print "<td align=\"center\" width=\"20%\"><a href=\"fiche.php3?id=$id\">Annuler</a></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\" width=\"20%\"><a href=\"fiche.php3?id=$id&action=edit\">Editer</a></td>";
|
||||
}
|
||||
|
||||
print '<td align="center" width="20%">-</td>';
|
||||
print '<td align="center" width="20%">-</td>';
|
||||
print '<td align="center" width="20%">-</td>';
|
||||
|
||||
print "<td align=\"center\" width=\"20%\"><a href=\"fiche.php3?id=$id&action=delete\">Supprimer</a></td>";
|
||||
|
||||
print "</tr></table>";
|
||||
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
@ -1,135 +0,0 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* 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$
|
||||
*
|
||||
*/
|
||||
require("./pre.inc.php3");
|
||||
require("./project.class.php3");
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
|
||||
llxHeader("","../");
|
||||
print_titre("Projets");
|
||||
print '<table width="100%">';
|
||||
print '<tr>';
|
||||
|
||||
print '</tr></table>';
|
||||
|
||||
/*
|
||||
* Traitements des actions
|
||||
*
|
||||
*/
|
||||
if ($HTTP_POST_VARS["action"] == 'create') {
|
||||
|
||||
$pro = new Project($db);
|
||||
$pro->socidp = $socidp;
|
||||
$pro->ref = $ref;
|
||||
$pro->title = $title;
|
||||
|
||||
$pro->create( $user->id);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Affichage
|
||||
*
|
||||
*/
|
||||
if ($sortfield == "")
|
||||
{
|
||||
$sortfield="lower(s.nom)";
|
||||
}
|
||||
if ($sortorder == "")
|
||||
{
|
||||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = 26;
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* Liste des projets
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
print '<p><TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
|
||||
|
||||
print '<TR class="liste_titre">';
|
||||
print "<TD>";
|
||||
print_liste_field_titre("Titre",$PHP_SELF,"p.title");
|
||||
print "</td>";
|
||||
print "<TD>Réf</TD><td>";
|
||||
print_liste_field_titre("Société",$PHP_SELF,"s.nom");
|
||||
print "</td></TR>\n";
|
||||
|
||||
$sql = "SELECT s.nom, s.idp, p.rowid as projectid, p.ref, p.title,".$db->pdate("p.dateo")." as do";
|
||||
$sql .= " FROM llx_societe as s, llx_projet as p";
|
||||
$sql .= " WHERE p.fk_soc = s.idp";
|
||||
|
||||
if ($socidp)
|
||||
{
|
||||
$sql .= " AND s.idp = $socidp";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object( $i);
|
||||
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD><a href=\"fiche.php3?id=$objp->projectid\">$objp->title</a></TD>\n";
|
||||
print "<TD><a href=\"fiche.php3?id=$objp->projectid\">$objp->ref</a></TD>\n";
|
||||
print "<TD><a href=\"../fiche.php3?socid=$objp->idp\">$objp->nom</a></TD>\n";
|
||||
print "</TR>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
$db->close();
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
@ -1,39 +0,0 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* 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$
|
||||
*
|
||||
*/
|
||||
|
||||
require ("../../main.inc.php3");
|
||||
|
||||
function llxHeader($head = "", $urlp = "") {
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/comm/projet/", "Projets");
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,156 +0,0 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* 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 Project {
|
||||
var $id;
|
||||
var $db;
|
||||
var $ref;
|
||||
var $title;
|
||||
var $socidp;
|
||||
var $societe;
|
||||
|
||||
Function Project($DB)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->societe = new Societe($DB);
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
Function create($creatorid)
|
||||
{
|
||||
$sql = "INSERT INTO llx_projet (ref, title, fk_soc, fk_user_creat, dateo) ";
|
||||
$sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, $creatorid, now()) ;";
|
||||
|
||||
if (!$this->db->query($sql) )
|
||||
{
|
||||
print '<b>'.$sql.'</b><br>'.$this->db->error();
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function update()
|
||||
{
|
||||
$sql = "UPDATE llx_projet ";
|
||||
$sql .= " SET ref = '$this->ref', title = '$this->title'";
|
||||
$sql .= " WHERE rowid = $this->id";
|
||||
|
||||
if (!$this->db->query($sql) )
|
||||
{
|
||||
print '<b>'.$sql.'</b><br>'.$this->db->error();
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function delete()
|
||||
{
|
||||
$sql = "DELETE FROM llx_projet WHERE rowid = $this->id";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$sql = "UPDATE llx_propal SET fk_projet = 0 ";
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$sql = "UPDATE llx_facture SET fk_projet = 0 ";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function fetch($rowid)
|
||||
{
|
||||
|
||||
$sql = "SELECT fk_soc, title, ref FROM llx_projet WHERE rowid=$rowid;";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$obj = $this->db->fetch_object(0);
|
||||
|
||||
$this->id = $rowid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->title = $obj->title;
|
||||
$this->societe->id = $obj->fk_soc;
|
||||
$this->db->free();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function get_propal_list()
|
||||
{
|
||||
$propales = array();
|
||||
$sql = "SELECT rowid FROM llx_propal WHERE fk_projet=$this->id;";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$nump = $this->db->num_rows();
|
||||
if ($nump)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $nump)
|
||||
{
|
||||
$obj = $this->db->fetch_object($i);
|
||||
|
||||
$propales[$i] = $obj->rowid;
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free();
|
||||
/*
|
||||
* Retourne un tableau contenant la liste des propales associees
|
||||
*/
|
||||
return $propales;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error() . '<br>' .$sql;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user