22 |
*/ |
*/ |
23 |
|
|
24 |
/** |
/** |
25 |
\file htdocs/projet/fiche.php |
\file htdocs/projet/fiche.php |
26 |
\ingroup projet |
\ingroup projet |
27 |
\brief Fiche projet |
\brief Fiche projet |
28 |
\version $Revision$ |
\version $Revision$ |
29 |
*/ |
*/ |
30 |
|
|
31 |
require("./pre.inc.php"); |
require("./pre.inc.php"); |
32 |
require_once("../propal.class.php"); |
require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); |
33 |
require_once("../facture.class.php"); |
require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); |
34 |
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); |
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); |
35 |
|
|
36 |
if (!$user->rights->projet->lire) accessforbidden(); |
if (!$user->rights->projet->lire) accessforbidden(); |
37 |
|
|
|
|
|
38 |
if ($_POST["action"] == 'add' && $user->rights->projet->creer) |
if ($_POST["action"] == 'add' && $user->rights->projet->creer) |
39 |
{ |
{ |
40 |
$pro = new Project($db); |
$pro = new Project($db); |
41 |
$pro->socidp = $_GET["socidp"]; |
$pro->socidp = $_GET["socidp"]; |
42 |
$pro->ref = $_POST["ref"]; |
$pro->ref = $_POST["ref"]; |
43 |
$pro->title = $_POST["title"]; |
$pro->title = $_POST["title"]; |
44 |
$result = $pro->create($user); |
$result = $pro->create($user); |
45 |
|
|
46 |
if ($result > 0) |
if ($result > 0) |
47 |
{ |
{ |
48 |
Header("Location:fiche.php?id=".$pro->id); |
Header("Location:fiche.php?id=".$pro->id); |
49 |
exit; |
exit; |
50 |
} |
} |
51 |
else |
else |
52 |
{ |
{ |
53 |
$mesg='<div class="error">'.$pro->error.'</div>'; |
$mesg='<div class="error">'.$pro->error.'</div>'; |
54 |
$_GET["action"] = 'create'; |
$_GET["action"] = 'create'; |
55 |
} |
} |
56 |
} |
} |
57 |
|
|
58 |
if ($_POST["action"] == 'update' && $user->rights->projet->creer) |
if ($_POST["action"] == 'update' && $user->rights->projet->creer) |
59 |
{ |
{ |
60 |
if (! $_POST["cancel"]) { |
if (! $_POST["cancel"]) |
|
if (!(empty($_POST["id"]) || empty($_POST["ref"]) || empty($_POST["title"]))) |
|
61 |
{ |
{ |
62 |
$projet = new Project($db); |
if (!(empty($_POST["id"]) || empty($_POST["ref"]) || empty($_POST["title"]))) |
63 |
$projet->id = $_POST["id"]; |
{ |
64 |
$projet->ref = $_POST["ref"]; |
$projet = new Project($db); |
65 |
$projet->title = $_POST["title"]; |
$projet->id = $_POST["id"]; |
66 |
$projet->update(); |
$projet->ref = $_POST["ref"]; |
67 |
|
$projet->title = $_POST["title"]; |
68 |
$_GET["id"]=$projet->id; // On retourne sur la fiche projet |
$projet->update(); |
69 |
|
|
70 |
|
$_GET["id"]=$projet->id; // On retourne sur la fiche projet |
71 |
|
} |
72 |
|
else |
73 |
|
{ |
74 |
|
$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet |
75 |
|
} |
76 |
} |
} |
77 |
else |
else |
78 |
{ |
{ |
79 |
$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet |
$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet |
80 |
} |
} |
|
} else { |
|
|
$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet |
|
|
} |
|
81 |
} |
} |
82 |
|
|
83 |
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->projet->supprimer) |
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->projet->supprimer) |
141 |
$hselected=$h; |
$hselected=$h; |
142 |
$h++; |
$h++; |
143 |
|
|
144 |
|
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$projet->id; |
145 |
|
$head[$h][1] = $langs->trans("Tasks"); |
146 |
|
$h++; |
147 |
|
|
148 |
if ($conf->propal->enabled) |
if ($conf->propal->enabled) |
149 |
{ |
{ |
150 |
$langs->load("propal"); |
$langs->load("propal"); |