Bascule vers la propal lors de l'ajout d'un produit

This commit is contained in:
Rodolphe Quiedeville 2004-07-27 10:26:18 +00:00
parent 4a8d7fc4cc
commit 3656358ceb

View File

@ -74,23 +74,23 @@ if ($_POST["action"] == 'update' &&
$product->duration_unit = $_POST["duration_unit"]; $product->duration_unit = $_POST["duration_unit"];
if ($product->check()) if ($product->check())
{ {
if ($product->update($product->id, $user)) if ($product->update($product->id, $user))
{ {
$_GET["action"] = ''; $_GET["action"] = '';
$mesg = 'Fiche mise à jour'; $mesg = 'Fiche mise à jour';
} }
else else
{ {
$_GET["action"] = 're-edit'; $_GET["action"] = 're-edit';
$mesg = 'Fiche non mise à jour !' . "<br>" . $product->mesg_error; $mesg = 'Fiche non mise à jour !' . "<br>" . $product->mesg_error;
} }
} }
else else
{ {
$_GET["action"] = 're-edit'; $_GET["action"] = 're-edit';
$mesg = 'Fiche non mise à jour !' . "<br>" . $product->mesg_error; $mesg = 'Fiche non mise à jour !' . "<br>" . $product->mesg_error;
} }
} }
Header("Location: fiche.php?id=".$product->id); Header("Location: fiche.php?id=".$product->id);
} }
@ -99,19 +99,15 @@ if ($_POST["action"] == 'update' &&
if ($_POST["action"] == 'addinpropal') if ($_POST["action"] == 'addinpropal')
{ {
$propal = New Propal($db); $propal = New Propal($db);
$propal->fetch($_POST["propalid"]); $propal->fetch($_POST["propalid"]);
$result = $propal->insert_product($_GET["id"], $_POST["qty"], $_POST["remise_percent"]); $result = $propal->insert_product($_GET["id"], $_POST["qty"], $_POST["remise_percent"]);
if ( $result < 0) if ( $result < 0)
{ {
$mesg = "erreur $result"; $mesg = "erreur $result";
} }
else
{ Header("Location: ../comm/propal.php?propalid=".$propal->id);
$mesg = ucfirst($types[$type]) . ' ajouté à la proposition ';
$mesg .= '<a href="../comm/propal.php?propalid='.$propal->id.'">'.$propal->ref.'</a>';
}
$_GET["action"] = '';
} }
if ($_POST["action"] == 'addinfacture' && if ($_POST["action"] == 'addinfacture' &&
@ -267,10 +263,10 @@ else
if ($_GET["id"]) if ($_GET["id"])
{ {
if ($_GET["action"] <> 're-edit') if ($_GET["action"] <> 're-edit')
{ {
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($_GET["id"]); $result = $product->fetch($_GET["id"]);
} }
if ( $result ) if ( $result )
{ {
@ -310,6 +306,7 @@ else
$head[$h][1] = 'Statistiques'; $head[$h][1] = 'Statistiques';
dolibarr_fiche_head($head, 0, 'Fiche '.$types[$product->type].' : '.$product->ref); dolibarr_fiche_head($head, 0, 'Fiche '.$types[$product->type].' : '.$product->ref);
print($mesg); print($mesg);
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>"; print "<tr>";
@ -602,7 +599,6 @@ print "</div>";
if ($_GET["id"] && $_GET["action"] == '' && $product->envente) if ($_GET["id"] && $_GET["action"] == '' && $product->envente)
{ {
$htmls = new Form($db); $htmls = new Form($db);
$propal = New Propal($db); $propal = New Propal($db);
@ -636,9 +632,8 @@ if ($_GET["id"] && $_GET["action"] == '' && $product->envente)
print "<td><a href=\"../comm/propal.php?propalid=$objp->propalid\">$objp->ref</a></TD>\n"; print "<td><a href=\"../comm/propal.php?propalid=$objp->propalid\">$objp->ref</a></TD>\n";
print "<td><a href=\"../comm/fiche.php?socid=$objp->idp\">$objp->nom</a></TD>\n"; print "<td><a href=\"../comm/fiche.php?socid=$objp->idp\">$objp->nom</a></TD>\n";
print "<td>". strftime("%d %B %Y",$objp->dp)."</td>\n"; print "<td>". strftime("%d %B %Y",$objp->dp)."</td>\n";
print '<form method="POST" action="fiche.php">'; print '<form method="POST" action="fiche.php?id='.$product->id.'">';
print '<input type="hidden" name="action" value="addinpropal">'; print '<input type="hidden" name="action" value="addinpropal">';
print '<input type="hidden" name="id" value="'.$product->id.'">';
print '<td><input type="hidden" name="propalid" value="'.$objp->propalid.'">'; print '<td><input type="hidden" name="propalid" value="'.$objp->propalid.'">';
print '<input type="text" name="qty" size="3" value="1">&nbsp;Rem.'; print '<input type="text" name="qty" size="3" value="1">&nbsp;Rem.';
print '<input type="text" name="remise_percent" size="3" value="0"> %'; print '<input type="text" name="remise_percent" size="3" value="0"> %';