Gestion d'un nouveau produit avec une référence déjà existante
This commit is contained in:
parent
45da0994cf
commit
b587cb7fc2
@ -53,9 +53,23 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
|
|||||||
$product->duration_unit = $_POST["duration_unit"];
|
$product->duration_unit = $_POST["duration_unit"];
|
||||||
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
|
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
|
||||||
|
|
||||||
|
$e_product = $product;
|
||||||
|
|
||||||
$id = $product->create($user);
|
$id = $product->create($user);
|
||||||
|
|
||||||
Header("Location: fiche.php?id=$id");
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
Header("Location: fiche.php?id=$id");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($id == -3)
|
||||||
|
{
|
||||||
|
$_error = 1;
|
||||||
|
$_GET["action"] = "create";
|
||||||
|
$_GET["type"] = $_POST["type"];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == 'update' &&
|
if ($_POST["action"] == 'update' &&
|
||||||
@ -206,21 +220,32 @@ llxHeader("","","Fiche produit");
|
|||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'create')
|
if ($_GET["action"] == 'create')
|
||||||
{
|
{
|
||||||
|
$html = new Form($db);
|
||||||
$nbligne=0;
|
$nbligne=0;
|
||||||
|
$product = new Product($db);
|
||||||
|
if ($_error == 1)
|
||||||
|
{
|
||||||
|
$product = $e_product;
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<form action="fiche.php" method="post">';
|
||||||
print "<form action=\"fiche.php\" method=\"post\">\n";
|
print '<input type="hidden" name="action" value="add">';
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"add\">\n";
|
|
||||||
print '<input type="hidden" name="type" value="'.$_GET["type"].'">'."\n";
|
print '<input type="hidden" name="type" value="'.$_GET["type"].'">'."\n";
|
||||||
print '<div class="titre">Nouveau '.$types[$_GET["type"]].'</div><br>'."\n";
|
print '<div class="titre">Nouveau '.$types[$_GET["type"]].'</div><br>'."\n";
|
||||||
|
|
||||||
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
|
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>Référence</td><td><input name="ref" size="20" value=""></td></tr>';
|
print '<td>Référence</td><td><input name="ref" size="20" value="'.$product->ref.'">';
|
||||||
print "<tr>".'<td>Libellé</td><td><input name="libelle" size="40" value=""></td></tr>';
|
if ($_error == 1)
|
||||||
print "<tr>".'<td>Prix de vente</td><TD><input name="price" size="10" value=""></td></tr>';
|
{
|
||||||
print "<tr>".'<td>Taux TVA</td><TD>';
|
print "Cette référence existe déjà";
|
||||||
$html = new Form($db);
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
print '<tr><td>Libellé</td><td><input name="libelle" size="40" value="'.$product->libelle.'"></td></tr>';
|
||||||
|
print '<tr><td>Prix de vente</td><TD><input name="price" size="10" value="'.$product->price.'"></td></tr>';
|
||||||
|
print '<tr><td>Taux TVA</td><TD>';
|
||||||
|
|
||||||
|
|
||||||
print $html->select_tva("tva_tx");
|
print $html->select_tva("tva_tx");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td>Statut</td><td>';
|
print '<tr><td>Statut</td><td>';
|
||||||
@ -279,7 +304,7 @@ else
|
|||||||
print '<table border="0" width="100%" cellspacing="0" cellpadding="4">';
|
print '<table border="0" width="100%" cellspacing="0" cellpadding="4">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<form action="liste.php" method="post"><td>';
|
print '<form action="liste.php" method="post"><td>';
|
||||||
print '<input type="hidden" name="type" value="'.$product->type.'">';
|
print '<input type="hidden" name="type" value="'.$product->type.'">';
|
||||||
print $langs->trans("Ref").': <input class="flat" type="text" size="10" name="sref"> <input class="flat" type="submit" value="go">';
|
print $langs->trans("Ref").': <input class="flat" type="text" size="10" name="sref"> <input class="flat" type="submit" value="go">';
|
||||||
print '</td></form><form action="liste.php" method="post"><td>';
|
print '</td></form><form action="liste.php" method="post"><td>';
|
||||||
print 'Libellé : <input class="flat" type="text" size="20" name="snom"> <input class="flat" type="submit" value="go">';
|
print 'Libellé : <input class="flat" type="text" size="20" name="snom"> <input class="flat" type="submit" value="go">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user