Synchro
This commit is contained in:
parent
251a3f434a
commit
1f1a475da7
@ -71,6 +71,14 @@ class Menu {
|
||||
$this->liste[$i]['target'] = $target;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Supprime la derniere entree de menu
|
||||
*/
|
||||
function remove_last()
|
||||
{
|
||||
array_pop($this->liste);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Ajoute une entrée de menu de niveau inférieur
|
||||
* \param url Url a suivre sur le clic
|
||||
|
||||
@ -117,6 +117,7 @@ class Product
|
||||
/**
|
||||
* \brief Insère le produit en base
|
||||
* \param user Utilisateur qui effectue l'insertion
|
||||
* \return int id du produit ou numero d'erreur < 0
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
@ -224,7 +225,7 @@ class Product
|
||||
if ($this->ref) $sql .= ",ref = '" . $this->ref ."'";
|
||||
$sql .= ",tva_tx = '" . $this->tva_tx."'";
|
||||
$sql .= ",envente = " . $this->status;
|
||||
$sql .= ",seuil_stock_alerte = " . $this->seuil_stock_alerte;
|
||||
$sql .= ",seuil_stock_alerte = '" . $this->seuil_stock_alerte."'";
|
||||
$sql .= ",description = '" . addslashes($this->description) ."'";
|
||||
$sql .= ",note = '" . addslashes($this->note) ."'";
|
||||
$sql .= ",duration = '" . $this->duration_value . $this->duration_unit ."'";
|
||||
@ -1304,10 +1305,10 @@ class Product
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Lie un sousproduit au produit/service
|
||||
* \brief Lie un produit associe au produit/service
|
||||
* \param id_pere Id du produit auquel sera lié le produit à lier
|
||||
* \param id_fils Id du produit à lier
|
||||
* \return int < 0 si erreur, > 0 si ok
|
||||
* \param id_fils Id du produit à lier
|
||||
* \return int < 0 si erreur, > 0 si ok
|
||||
*/
|
||||
function add_sousproduit($id_pere, $id_fils,$qty)
|
||||
{
|
||||
@ -1411,6 +1412,33 @@ class Product
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Lie un sous produit au produit/service
|
||||
* \param id_sub Id du produit à lier
|
||||
* \return int < 0 si erreur, > 0 si ok
|
||||
*/
|
||||
function add_subproduct($id_sub)
|
||||
{
|
||||
if ($id_sub)
|
||||
{
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_subproduct(fk_product,fk_product_subproduct)';
|
||||
$sql .= ' VALUES ("'.$this->id.'","'.$id_sub.'")';
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Lie un fournisseur au produit/service
|
||||
* \param user Utilisateur qui fait le lien
|
||||
|
||||
@ -195,39 +195,38 @@ if ($_GET["action"] == 'clone' && $user->rights->produit->creer)
|
||||
|
||||
if ($product->check())
|
||||
{
|
||||
$id = $product->create($user);
|
||||
if ($id > 0)
|
||||
$id = $product->create($user);
|
||||
if ($id > 0)
|
||||
{
|
||||
// $product->clone_fournisseurs($originalId, $id);
|
||||
|
||||
$db->commit();
|
||||
|
||||
Header("Location: fiche.php?id=$id");
|
||||
$db->close();
|
||||
exit;
|
||||
// $product->clone_fournisseurs($originalId, $id);
|
||||
|
||||
$db->commit();
|
||||
|
||||
Header("Location: fiche.php?id=$id");
|
||||
$db->close();
|
||||
exit;
|
||||
}
|
||||
else if ($id == -3)
|
||||
else if ($id == -3)
|
||||
{
|
||||
$db->rollback();
|
||||
|
||||
$_error = 1;
|
||||
$_GET["action"] = "";
|
||||
dolibarr_print_error($product->db);
|
||||
$db->rollback();
|
||||
|
||||
$_error = 1;
|
||||
$_GET["action"] = "";
|
||||
dolibarr_print_error($product->db);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
|
||||
dolibarr_print_error($product->db);
|
||||
$db->rollback();
|
||||
dolibarr_print_error($product->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$db->rollback();
|
||||
|
||||
|
||||
dolibarr_print_error($product->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -546,10 +545,13 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
$result = $product->FetchCanvas($_GET["id"]);
|
||||
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$product->canvas.'/';
|
||||
|
||||
|
||||
$product->assign_values($smarty);
|
||||
}
|
||||
else
|
||||
{
|
||||
$product->canvas = '';
|
||||
}
|
||||
// END TODO RODO FINISH THIS PART
|
||||
|
||||
llxHeader("","",$langs->trans("CardProduct".$product->type));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user