18 |
* |
* |
19 |
* $Id$ |
* $Id$ |
20 |
* $Source$ |
* $Source$ |
|
* |
|
21 |
*/ |
*/ |
22 |
|
|
23 |
/** |
/** |
59 |
// Action ajout d'un produit ou service |
// Action ajout d'un produit ou service |
60 |
if ($_POST["action"] == 'add' && $user->rights->produit->creer) |
if ($_POST["action"] == 'add' && $user->rights->produit->creer) |
61 |
{ |
{ |
62 |
$product = new Product($db); |
$product = new Product($db); |
|
|
|
|
$product->ref = $_POST["ref"]; |
|
|
$product->libelle = $_POST["libelle"]; |
|
|
$product->price = $_POST["price"]; |
|
|
$product->catid = $_POST["catid"]; |
|
|
$product->tva_tx = $_POST["tva_tx"]; |
|
|
$product->type = $_POST["type"]; |
|
|
$product->envente = $_POST["statut"]; |
|
|
$product->description = $_POST["desc"]; |
|
|
$product->duration_value = $_POST["duration_value"]; |
|
|
$product->duration_unit = $_POST["duration_unit"]; |
|
|
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; |
|
|
|
|
|
$e_product = $product; |
|
63 |
|
|
64 |
$id = $product->create($user); |
$product->ref = $_POST["ref"]; |
65 |
|
$product->libelle = $_POST["libelle"]; |
66 |
if ($id > 0) |
$product->price = $_POST["price"]; |
67 |
{ |
$product->catid = $_POST["catid"]; |
68 |
Header("Location: fiche.php?id=$id"); |
$product->tva_tx = $_POST["tva_tx"]; |
69 |
} |
$product->type = $_POST["type"]; |
70 |
else |
$product->envente = $_POST["statut"]; |
71 |
{ |
$product->description = $_POST["desc"]; |
72 |
if ($id == -3) |
$product->duration_value = $_POST["duration_value"]; |
73 |
{ |
$product->duration_unit = $_POST["duration_unit"]; |
74 |
$_error = 1; |
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; |
75 |
$_GET["action"] = "create"; |
|
76 |
$_GET["type"] = $_POST["type"]; |
$e_product = $product; |
77 |
} |
|
78 |
|
$id = $product->create($user); |
79 |
|
if ($id > 0) |
80 |
|
{ |
81 |
|
Header("Location: fiche.php?id=$id"); |
82 |
|
} |
83 |
|
else |
84 |
|
{ |
85 |
|
if ($id == -3) |
86 |
|
{ |
87 |
|
$mesg='<div class="error">'.$product->error.'</div>'; |
88 |
|
$_error = 1; |
89 |
|
$_GET["action"] = "create"; |
90 |
|
$_GET["type"] = $_POST["type"]; |
91 |
|
} |
92 |
} |
} |
93 |
} |
} |
94 |
|
|
198 |
Header("Location: fiche.php?id=".$_POST["id"]); |
Header("Location: fiche.php?id=".$_POST["id"]); |
199 |
} |
} |
200 |
|
|
201 |
|
|
202 |
// Le produit n'est pas encore chargé a ce stade |
// Le produit n'est pas encore chargé a ce stade |
203 |
llxHeader("","",$langs->trans("CardProduct0")); |
llxHeader("","",$langs->trans("CardProduct0")); |
204 |
|
|
227 |
|
|
228 |
print '<table class="border" width="100%">'; |
print '<table class="border" width="100%">'; |
229 |
|
|
230 |
|
if ($mesg) print $mesg; |
231 |
|
|
232 |
if ($conf->categorie->enabled) |
if ($conf->categorie->enabled) |
233 |
{ |
{ |
234 |
print '<tr><td>'.$langs->trans("Categorie"); |
print '<tr><td>'.$langs->trans("Categorie"); |
274 |
print '</td></tr>'; |
print '</td></tr>'; |
275 |
} |
} |
276 |
|
|
277 |
print '<tr><td> </td><td><input type="submit" value="'.$langs->trans("Create").'"></td></tr>'; |
print '<tr><td> </td><td><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>'; |
278 |
print '</table>'; |
print '</table>'; |
279 |
print '</form>'; |
print '</form>'; |
280 |
} |
} |
336 |
|
|
337 |
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); |
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); |
338 |
|
|
339 |
|
if ($mesg) print($mesg); |
340 |
print($mesg); |
|
341 |
print '<table class="border" width="100%">'; |
print '<table class="border" width="100%">'; |
342 |
|
|
343 |
if ($conf->categorie->enabled) |
if ($conf->categorie->enabled) |