Fix: Plantage
This commit is contained in:
parent
5013f41623
commit
dc057c576f
@ -18,7 +18,6 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,36 +59,36 @@ if ($_GET["action"] == 'fastappro')
|
|||||||
// Action ajout d'un produit ou service
|
// Action ajout d'un produit ou service
|
||||||
if ($_POST["action"] == 'add' && $user->rights->produit->creer)
|
if ($_POST["action"] == 'add' && $user->rights->produit->creer)
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
|
|
||||||
$product->ref = $_POST["ref"];
|
$product->ref = $_POST["ref"];
|
||||||
$product->libelle = $_POST["libelle"];
|
$product->libelle = $_POST["libelle"];
|
||||||
$product->price = $_POST["price"];
|
$product->price = $_POST["price"];
|
||||||
$product->catid = $_POST["catid"];
|
$product->catid = $_POST["catid"];
|
||||||
$product->tva_tx = $_POST["tva_tx"];
|
$product->tva_tx = $_POST["tva_tx"];
|
||||||
$product->type = $_POST["type"];
|
$product->type = $_POST["type"];
|
||||||
$product->envente = $_POST["statut"];
|
$product->envente = $_POST["statut"];
|
||||||
$product->description = $_POST["desc"];
|
$product->description = $_POST["desc"];
|
||||||
$product->duration_value = $_POST["duration_value"];
|
$product->duration_value = $_POST["duration_value"];
|
||||||
$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);
|
$e_product = $product;
|
||||||
|
|
||||||
if ($id > 0)
|
$id = $product->create($user);
|
||||||
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
Header("Location: fiche.php?id=$id");
|
Header("Location: fiche.php?id=$id");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($id == -3)
|
if ($id == -3)
|
||||||
{
|
{
|
||||||
$_error = 1;
|
$mesg='<div class="error">'.$product->error.'</div>';
|
||||||
$_GET["action"] = "create";
|
$_error = 1;
|
||||||
$_GET["type"] = $_POST["type"];
|
$_GET["action"] = "create";
|
||||||
}
|
$_GET["type"] = $_POST["type"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,6 +198,7 @@ if ($_POST["cancel"] == $langs->trans("Cancel"))
|
|||||||
Header("Location: fiche.php?id=".$_POST["id"]);
|
Header("Location: fiche.php?id=".$_POST["id"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Le produit n'est pas encore chargé a ce stade
|
// Le produit n'est pas encore chargé a ce stade
|
||||||
llxHeader("","",$langs->trans("CardProduct0"));
|
llxHeader("","",$langs->trans("CardProduct0"));
|
||||||
|
|
||||||
@ -227,6 +227,8 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
if ($mesg) print $mesg;
|
||||||
|
|
||||||
if ($conf->categorie->enabled)
|
if ($conf->categorie->enabled)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Categorie");
|
print '<tr><td>'.$langs->trans("Categorie");
|
||||||
@ -272,7 +274,7 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
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>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
@ -334,8 +336,8 @@ else
|
|||||||
|
|
||||||
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
|
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
|
||||||
|
|
||||||
|
if ($mesg) print($mesg);
|
||||||
print($mesg);
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
if ($conf->categorie->enabled)
|
if ($conf->categorie->enabled)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -18,97 +18,98 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
\file htdocs/product/pre.inc.php
|
\file htdocs/fourn/product/pre.inc.php
|
||||||
\ingroup product,service
|
\ingroup product,service
|
||||||
\brief Fichier gestionnaire du menu gauche des produits et services
|
\brief Fichier gestionnaire du menu gauche des produits et services fournisseurs
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("../../main.inc.php");
|
require("../../main.inc.php");
|
||||||
require_once DOL_DOCUMENT_ROOT."/fourn/fournisseur.class.php";
|
require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.class.php");
|
||||||
require_once DOL_DOCUMENT_ROOT."/categories/categorie.class.php";
|
require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php");
|
||||||
|
|
||||||
$langs->load("suppliers");
|
$langs->load("suppliers");
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
|
|
||||||
$user->getrights("produit");
|
$user->getrights("produit");
|
||||||
|
|
||||||
|
|
||||||
function llxHeader($head = "", $title="", $help_url='',$addons='')
|
function llxHeader($head = "", $title="", $help_url='',$addons='')
|
||||||
{
|
{
|
||||||
global $db, $user, $conf, $langs;
|
global $db, $user, $conf, $langs;
|
||||||
|
|
||||||
|
|
||||||
top_menu($head, $title);
|
|
||||||
|
|
||||||
$menu = new Menu();
|
top_menu($head, $title);
|
||||||
|
|
||||||
if (is_array($addons))
|
$menu = new Menu();
|
||||||
|
|
||||||
|
if (is_array($addons))
|
||||||
{
|
{
|
||||||
//$menu->add($url, $libelle);
|
//$menu->add($url, $libelle);
|
||||||
$menu->add($addons[0][0], $addons[0][1]);
|
$menu->add($addons[0][0], $addons[0][1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->produit->enabled)
|
if ($conf->produit->enabled)
|
||||||
{
|
|
||||||
$menu->add(DOL_URL_ROOT."/fourn/product/", $langs->trans("Products"));
|
|
||||||
$menu->add_submenu(DOL_URL_ROOT."/fourn/product/liste.php?type=0", $langs->trans("List"));
|
|
||||||
|
|
||||||
if ($user->societe_id == 0 && $user->rights->produit->creer)
|
|
||||||
{
|
|
||||||
if ($conf->categorie->enabled)
|
|
||||||
{
|
|
||||||
$menu->add_submenu(DOL_URL_ROOT."/fourn/product/fiche.php?action=create&type=0&catid=".$_REQUEST['catid'], $langs->trans("NewProduct"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$menu->add_submenu(DOL_URL_ROOT."/fourn/product/fiche.php?action=create&type=0", $langs->trans("NewProduct"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($conf->categorie->enabled)
|
|
||||||
{
|
|
||||||
$menu->add(DOL_URL_ROOT."/categories/", $langs->trans("Categories"));
|
|
||||||
}
|
|
||||||
|
|
||||||
$menu->add('liste.php','Top');
|
|
||||||
|
|
||||||
if (isset($_REQUEST['catid']))
|
|
||||||
{
|
{
|
||||||
$catid = $_REQUEST['catid'];
|
$menu->add(DOL_URL_ROOT."/fourn/product/", $langs->trans("Products"));
|
||||||
|
$menu->add_submenu(DOL_URL_ROOT."/fourn/product/liste.php?type=0", $langs->trans("List"));
|
||||||
|
|
||||||
$c = new Categorie ($db, $catid);
|
if ($user->societe_id == 0 && $user->rights->produit->creer)
|
||||||
|
{
|
||||||
$menu->add('liste.php?catid='.$c->id, $c->label);
|
if ($conf->categorie->enabled)
|
||||||
|
{
|
||||||
$cats = $c->get_filles();
|
$menu->add_submenu(DOL_URL_ROOT."/fourn/product/fiche.php?action=create&type=0&catid=".$_REQUEST['catid'], $langs->trans("NewProduct"));
|
||||||
|
}
|
||||||
if (sizeof ($cats) > 0)
|
else
|
||||||
{
|
{
|
||||||
foreach ($cats as $cat)
|
$menu->add_submenu(DOL_URL_ROOT."/fourn/product/fiche.php?action=create&type=0", $langs->trans("NewProduct"));
|
||||||
{
|
}
|
||||||
$menu->add_submenu('liste.php?catid='.$cat->id, $cat->label);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$c = new Categorie ($db);
|
|
||||||
$cats = $c->get_main_categories();
|
|
||||||
|
|
||||||
if (sizeof ($cats) > 0)
|
|
||||||
{
|
|
||||||
foreach ($cats as $cat)
|
|
||||||
{
|
|
||||||
$menu->add_submenu('liste.php?catid='.$cat->id, $cat->label);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
left_menu($menu->liste, $help_url);
|
if ($conf->categorie->enabled)
|
||||||
|
{
|
||||||
|
$menu->add(DOL_URL_ROOT."/categories/", $langs->trans("Categories"));
|
||||||
|
}
|
||||||
|
|
||||||
|
$menu->add('liste.php','Top');
|
||||||
|
|
||||||
|
if (isset($_REQUEST['catid']) && $_REQUEST['catid'] != '')
|
||||||
|
{
|
||||||
|
$catid = $_REQUEST['catid'];
|
||||||
|
|
||||||
|
$c = new Categorie ($db, $catid);
|
||||||
|
|
||||||
|
$menu->add('liste.php?catid='.$c->id, $c->label);
|
||||||
|
|
||||||
|
$cats = $c->get_filles();
|
||||||
|
|
||||||
|
if (sizeof ($cats) > 0)
|
||||||
|
{
|
||||||
|
foreach ($cats as $cat)
|
||||||
|
{
|
||||||
|
$menu->add_submenu('liste.php?catid='.$cat->id, $cat->label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$c = new Categorie ($db);
|
||||||
|
$cats = $c->get_main_categories();
|
||||||
|
|
||||||
|
if (sizeof ($cats) > 0)
|
||||||
|
{
|
||||||
|
foreach ($cats as $cat)
|
||||||
|
{
|
||||||
|
$menu->add_submenu('liste.php?catid='.$cat->id, $cat->label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
left_menu($menu->liste, $help_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user