Ajout onglet

This commit is contained in:
Rodolphe Quiedeville 2005-08-21 12:27:54 +00:00
parent 311ad98507
commit 52f328db8d

View File

@ -22,60 +22,62 @@
*/ */
/** /**
\file htdocs/projet/fiche.php \file htdocs/projet/fiche.php
\ingroup projet \ingroup projet
\brief Fiche projet \brief Fiche projet
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once("../propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
require_once("../facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
if (!$user->rights->projet->lire) accessforbidden(); if (!$user->rights->projet->lire) accessforbidden();
if ($_POST["action"] == 'add' && $user->rights->projet->creer) if ($_POST["action"] == 'add' && $user->rights->projet->creer)
{ {
$pro = new Project($db); $pro = new Project($db);
$pro->socidp = $_GET["socidp"]; $pro->socidp = $_GET["socidp"];
$pro->ref = $_POST["ref"]; $pro->ref = $_POST["ref"];
$pro->title = $_POST["title"]; $pro->title = $_POST["title"];
$result = $pro->create($user); $result = $pro->create($user);
if ($result > 0) if ($result > 0)
{ {
Header("Location:fiche.php?id=".$pro->id); Header("Location:fiche.php?id=".$pro->id);
exit; exit;
} }
else else
{ {
$mesg='<div class="error">'.$pro->error.'</div>'; $mesg='<div class="error">'.$pro->error.'</div>';
$_GET["action"] = 'create'; $_GET["action"] = 'create';
} }
} }
if ($_POST["action"] == 'update' && $user->rights->projet->creer) if ($_POST["action"] == 'update' && $user->rights->projet->creer)
{ {
if (! $_POST["cancel"]) { if (! $_POST["cancel"])
if (!(empty($_POST["id"]) || empty($_POST["ref"]) || empty($_POST["title"])))
{ {
$projet = new Project($db); if (!(empty($_POST["id"]) || empty($_POST["ref"]) || empty($_POST["title"])))
$projet->id = $_POST["id"]; {
$projet->ref = $_POST["ref"]; $projet = new Project($db);
$projet->title = $_POST["title"]; $projet->id = $_POST["id"];
$projet->update(); $projet->ref = $_POST["ref"];
$projet->title = $_POST["title"];
$_GET["id"]=$projet->id; // On retourne sur la fiche projet $projet->update();
$_GET["id"]=$projet->id; // On retourne sur la fiche projet
}
else
{
$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet
}
} }
else else
{ {
$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet $_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet
} }
} else {
$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet
}
} }
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->projet->supprimer) if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->projet->supprimer)
@ -139,6 +141,10 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
$hselected=$h; $hselected=$h;
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$projet->id;
$head[$h][1] = $langs->trans("Tasks");
$h++;
if ($conf->propal->enabled) if ($conf->propal->enabled)
{ {
$langs->load("propal"); $langs->load("propal");