Ajoute product->next_prev_filter définit dans certains canevas

$product->load_previous_next_ref($product->next_prev_filter);
This commit is contained in:
Rodolphe Quiedeville 2006-12-15 13:17:22 +00:00
parent 43371ebb2c
commit 6a47962c37

View File

@ -48,8 +48,8 @@ $types[0] = $langs->trans("Product");
$types[1] = $langs->trans("Service"); $types[1] = $langs->trans("Service");
/* /*
* *
*/ */
if ($_GET["action"] == 'fastappro') if ($_GET["action"] == 'fastappro')
{ {
$product = new Product($db); $product = new Product($db);
@ -184,50 +184,49 @@ if ($_POST["action"] == 'update' &&
// clone d'un produit // clone d'un produit
if ($_GET["action"] == 'clone' && $user->rights->produit->creer) if ($_GET["action"] == 'clone' && $user->rights->produit->creer)
{ {
$db->begin(); $db->begin();
$product = new Product($db); $product = new Product($db);
$originalId = $_GET["id"]; $originalId = $_GET["id"];
if ($product->fetch($_GET["id"]) > 0) if ($product->fetch($_GET["id"]) > 0)
{
$product->ref = "Clone ".$product->ref;
$product->status = 0;
$product->id = null;
if ($product->check())
{ {
$product->ref = "Clone ".$product->ref; $id = $product->create($user);
$product->status = 0; if ($id > 0)
$product->id = null; {
// $product->clone_fournisseurs($originalId, $id);
if ($product->check()) $db->commit();
{
$id = $product->create($user);
if ($id > 0)
{
// $product->clone_fournisseurs($originalId, $id);
$db->commit(); Header("Location: fiche.php?id=$id");
$db->close();
exit;
}
else if ($id == -3)
{
$db->rollback();
Header("Location: fiche.php?id=$id"); $_error = 1;
$db->close(); $_GET["action"] = "";
exit; dolibarr_print_error($product->db);
} }
else if ($id == -3) else
{ {
$db->rollback(); $db->rollback();
dolibarr_print_error($product->db);
$_error = 1; }
$_GET["action"] = "";
dolibarr_print_error($product->db);
}
else
{
$db->rollback();
dolibarr_print_error($product->db);
}
}
}
else
{
$db->rollback();
dolibarr_print_error($product->db);
} }
}
else
{
$db->rollback();
dolibarr_print_error($product->db);
}
} }
/* /*
@ -235,166 +234,166 @@ if ($_GET["action"] == 'clone' && $user->rights->produit->creer)
*/ */
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->produit->supprimer) if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->produit->supprimer)
{ {
$product = new Product($db); $product = new Product($db);
$product->fetch($_GET["id"]); $product->fetch($_GET["id"]);
$result = $product->delete($_GET["id"]); $result = $product->delete($_GET["id"]);
if ($result == 0) if ($result == 0)
{ {
llxHeader(); llxHeader();
print '<div class="ok">'.$langs->trans("ProductDeleted",$product->ref).'</div>'; print '<div class="ok">'.$langs->trans("ProductDeleted",$product->ref).'</div>';
llxFooter(); llxFooter();
exit ; exit ;
} }
else else
{ {
$reload = 0; $reload = 0;
$_GET["action"]=''; $_GET["action"]='';
} }
} }
/* /*
* Ajout du produit dans une propal * Ajout du produit dans une propal
*/ */
if ($_POST["action"] == 'addinpropal') if ($_POST["action"] == 'addinpropal')
{ {
$propal = New Propal($db); $propal = New Propal($db);
$result=$propal->fetch($_POST["propalid"]); $result=$propal->fetch($_POST["propalid"]);
if ($result <= 0) if ($result <= 0)
{ {
dolibarr_print_error($db,$propal->error); dolibarr_print_error($db,$propal->error);
exit; exit;
} }
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($propal->socid,$user); $soc->fetch($propal->socid,$user);
$prod = new Product($db, $_GET['id']); $prod = new Product($db, $_GET['id']);
$result=$prod->fetch($_GET['id']); $result=$prod->fetch($_GET['id']);
if ($result <= 0) if ($result <= 0)
{ {
dolibarr_print_error($db,$prod->error); dolibarr_print_error($db,$prod->error);
exit; exit;
} }
// multiprix // multiprix
if ($conf->global->PRODUIT_MULTIPRICES == 1) if ($conf->global->PRODUIT_MULTIPRICES == 1)
{ {
$pu = $prod->multiprices[$soc->price_level]; $pu = $prod->multiprices[$soc->price_level];
} }
else else
{ {
$pu=$prod->price; $pu=$prod->price;
} }
$desc = $prod->description; $desc = $prod->description;
$tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx); $tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx);
$result = $propal->addline($propal->id, $result = $propal->addline($propal->id,
$desc, $desc,
$pu, $pu,
$_POST["qty"], $_POST["qty"],
$tva_tx, $tva_tx,
$prod->id, $prod->id,
$_POST["remise_percent"]); $_POST["remise_percent"]);
if ($result > 0) if ($result > 0)
{ {
Header("Location: ../comm/propal.php?propalid=".$propal->id); Header("Location: ../comm/propal.php?propalid=".$propal->id);
return; return;
} }
$mesg = $langs->trans("ErrorUnknown").": $result"; $mesg = $langs->trans("ErrorUnknown").": $result";
} }
/* /*
* Ajout du produit dans une commande * Ajout du produit dans une commande
*/ */
if ($_POST["action"] == 'addincommande') if ($_POST["action"] == 'addincommande')
{ {
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($_GET["id"]); $result = $product->fetch($_GET["id"]);
$commande = New Commande($db); $commande = New Commande($db);
$commande->fetch($_POST["commandeid"]); $commande->fetch($_POST["commandeid"]);
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($commande->socid,$user); $soc->fetch($commande->socid,$user);
// multiprix // multiprix
if ($conf->global->PRODUIT_MULTIPRICES == 1) if ($conf->global->PRODUIT_MULTIPRICES == 1)
{ {
$pu = $product->multiprices[$soc->price_level]; $pu = $product->multiprices[$soc->price_level];
} }
else else
{ {
$pu=$product->price; $pu=$product->price;
} }
$tva_tx = get_default_tva($mysoc,$soc,$product->tva_tx); $tva_tx = get_default_tva($mysoc,$soc,$product->tva_tx);
$result = $commande->addline($commande->id, $result = $commande->addline($commande->id,
$product->description, $product->description,
$pu, $pu,
$_POST["qty"], $_POST["qty"],
$tva_tx, $tva_tx,
$product->id, $product->id,
$_POST["remise_percent"]); $_POST["remise_percent"]);
Header("Location: ../commande/fiche.php?id=".$commande->id); Header("Location: ../commande/fiche.php?id=".$commande->id);
exit; exit;
} }
/* /*
* Ajout du produit dans une facture * Ajout du produit dans une facture
*/ */
if ($_POST["action"] == 'addinfacture' && $user->rights->facture->creer) if ($_POST["action"] == 'addinfacture' && $user->rights->facture->creer)
{ {
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($_GET["id"]); $result = $product->fetch($_GET["id"]);
$facture = New Facture($db); $facture = New Facture($db);
$facture->fetch($_POST["factureid"]); $facture->fetch($_POST["factureid"]);
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($facture->socid,$user); $soc->fetch($facture->socid,$user);
// multiprix // multiprix
if ($conf->global->PRODUIT_MULTIPRICES == 1) if ($conf->global->PRODUIT_MULTIPRICES == 1)
{ {
$pu = $product->multiprices[$soc->price_level]; $pu = $product->multiprices[$soc->price_level];
} }
else else
{ {
$pu=$product->price; $pu=$product->price;
} }
$tva_tx = get_default_tva($mysoc,$soc,$product->tva_tx); $tva_tx = get_default_tva($mysoc,$soc,$product->tva_tx);
$facture->addline($facture->id, $facture->addline($facture->id,
$product->description, $product->description,
$pu, $pu,
$_POST["qty"], $_POST["qty"],
$tva_tx, $tva_tx,
$product->id, $product->id,
$_POST["remise_percent"]); $_POST["remise_percent"]);
Header("Location: ../compta/facture.php?facid=".$facture->id); Header("Location: ../compta/facture.php?facid=".$facture->id);
exit; exit;
} }
if ($_POST["cancel"] == $langs->trans("Cancel")) if ($_POST["cancel"] == $langs->trans("Cancel"))
{ {
$action = ''; $action = '';
Header("Location: fiche.php?id=".$_POST["id"]); Header("Location: fiche.php?id=".$_POST["id"]);
exit; exit;
} }
$html = new Form($db); $html = new Form($db);
/* /*
* Action création du produit * Action création du produit
*/ */
if ($_GET["action"] == 'create' && $user->rights->produit->creer) if ($_GET["action"] == 'create' && $user->rights->produit->creer)
{ {
$product = new Product($db); $product = new Product($db);
@ -553,7 +552,6 @@ if ($_GET["id"] || $_GET["ref"])
{ {
$class = 'Product'.ucfirst($product->canvas); $class = 'Product'.ucfirst($product->canvas);
include_once('canvas/product.'.$product->canvas.'.class.php'); include_once('canvas/product.'.$product->canvas.'.class.php');
$product = new $class($db); $product = new $class($db);
$result = $product->FetchCanvas($_GET["id"]); $result = $product->FetchCanvas($_GET["id"]);
@ -588,7 +586,7 @@ if ($_GET["id"] || $_GET["ref"])
print($mesg); print($mesg);
$product->load_previous_next_ref(); $product->load_previous_next_ref($product->next_prev_filter);
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':''; $previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':''; $next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
} }