Gestion de l'édition
This commit is contained in:
parent
8b850e37e0
commit
34f687e04e
@ -19,14 +19,23 @@
|
|||||||
* $Source$
|
* $Source$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php3");
|
require("./pre.inc.php3");
|
||||||
require("./project.class.php3");
|
require("./project.class.php3");
|
||||||
require("../propal.class.php3");
|
require("../propal.class.php3");
|
||||||
|
|
||||||
|
$db = new Db();
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
llxHeader("","../");
|
llxHeader("","../");
|
||||||
|
|
||||||
$db = new Db();
|
|
||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
@ -69,20 +78,20 @@ if ($action == 'create')
|
|||||||
|
|
||||||
$projet->societe->fetch($projet->societe->id);
|
$projet->societe->fetch($projet->societe->id);
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'edit')
|
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 '<table border="1" cellpadding="4" cellspacing="0">';
|
||||||
print '<tr><td>Société</td><td>'.$projet->societe->nom.'</td></tr>';
|
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>Ref</td><td>'.$projet->ref.'</td></tr>';
|
print '<tr><td>Titre</td><td><input name="title" value="'.$projet->title.'"></td></tr>';
|
||||||
print '<tr><td>Titre</td><td>'.$projet->title.'</td></tr>';
|
print '</table><input type="submit" Value="Enregistrer"></form>';
|
||||||
print '</table>';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<table border="1" cellpadding="4" cellspacing="0">';
|
print '<table border="1" cellpadding="4" cellspacing="0">';
|
||||||
print '<tr><td>Société</td><td>'.$projet->societe->nom.'</td></tr>';
|
print '<tr><td>Société</td><td><a href="../fiche.php3?socid='.$projet->societe->id.'">'.$projet->societe->nom.'</a></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>Ref</td><td>'.$projet->ref.'</td></tr>';
|
print '<tr><td>Ref</td><td>'.$projet->ref.'</td></tr>';
|
||||||
print '<tr><td>Titre</td><td>'.$projet->title.'</td></tr>';
|
print '<tr><td>Titre</td><td>'.$projet->title.'</td></tr>';
|
||||||
@ -134,7 +143,14 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>";
|
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>";
|
||||||
|
|
||||||
print "<td align=\"center\" width=\"25%\"><a href=\"fiche.php3?id=$id&action=edit\">Editer</a></td>";
|
if ($action == "edit")
|
||||||
|
{
|
||||||
|
print "<td align=\"center\" width=\"25%\"><a href=\"fiche.php3?id=$id\">Annuler</a></td>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<td align=\"center\" width=\"25%\"><a href=\"fiche.php3?id=$id&action=edit\">Editer</a></td>";
|
||||||
|
}
|
||||||
|
|
||||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||||
|
|
||||||
|
|||||||
@ -42,16 +42,29 @@ class Project {
|
|||||||
|
|
||||||
Function create($creatorid)
|
Function create($creatorid)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "INSERT INTO llx_projet (ref, title, fk_soc, fk_user_creat, dateo) ";
|
$sql = "INSERT INTO llx_projet (ref, title, fk_soc, fk_user_creat, dateo) ";
|
||||||
$sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, $creatorid, now()) ;";
|
$sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, $creatorid, now()) ;";
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user