diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index 91a15d02916..6f62bc2ac00 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -105,7 +105,7 @@ if ($_POST["action"] == 'update_price' && ! $_POST["cancel"] && $user->rights->p
}
}
-if ($_GET["action"] == 'delete' && $user->rights->produit->creer)
+if ($_GET["action"] == 'delete' && $user->rights->produit->supprimer)
{
$productstatic = new Product($db);
$result=$productstatic->log_price_delete($user,$_GET["lineid"]);
@@ -406,7 +406,7 @@ if ($result)
print '
'.$langs->trans("MinPrice").' '.$langs->trans("HT").' ';
print ''.$langs->trans("MinPrice").' '.$langs->trans("TTC").' ';
print ''.$langs->trans("ChangedBy").' ';
- if ($user->rights->produit->creer) print ' ';
+ if ($user->rights->produit->supprimer) print ' ';
print '';
$var=True;
@@ -436,7 +436,7 @@ if ($result)
print ''.img_object($langs->trans("ShowUser"),'user').' '.$objp->login.' ';
// Action
- if ($user->rights->produit->creer)
+ if ($user->rights->produit->supprimer)
{
print '';
if ($i > 0)
diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php
index e1f655c3a20..ab257ad6f6f 100644
--- a/htdocs/product/stock/fiche.php
+++ b/htdocs/product/stock/fiche.php
@@ -20,11 +20,11 @@
*/
/**
- \file htdocs/product/stock/fiche.php
- \ingroup stock
- \brief Page fiche entrepot
- \version $Id$
-*/
+ \file htdocs/product/stock/fiche.php
+ \ingroup stock
+ \brief Page fiche entrepot
+ \version $Id$
+ */
require("./pre.inc.php");
@@ -48,80 +48,80 @@ $mesg = '';
// Ajout entrepot
if ($_POST["action"] == 'add')
{
- $entrepot = new Entrepot($db);
+ $entrepot = new Entrepot($db);
- $entrepot->ref = $_POST["ref"];
- $entrepot->libelle = $_POST["libelle"];
- $entrepot->description = $_POST["desc"];
- $entrepot->statut = $_POST["statut"];
- $entrepot->lieu = $_POST["lieu"];
- $entrepot->address = $_POST["address"];
- $entrepot->cp = $_POST["cp"];
- $entrepot->ville = $_POST["ville"];
- $entrepot->pays_id = $_POST["pays_id"];
+ $entrepot->ref = $_POST["ref"];
+ $entrepot->libelle = $_POST["libelle"];
+ $entrepot->description = $_POST["desc"];
+ $entrepot->statut = $_POST["statut"];
+ $entrepot->lieu = $_POST["lieu"];
+ $entrepot->address = $_POST["address"];
+ $entrepot->cp = $_POST["cp"];
+ $entrepot->ville = $_POST["ville"];
+ $entrepot->pays_id = $_POST["pays_id"];
- if ($entrepot->libelle) {
- $id = $entrepot->create($user);
- if ($id > 0) {
- Header("Location: fiche.php?id=$id");
- }
+ if ($entrepot->libelle) {
+ $id = $entrepot->create($user);
+ if ($id > 0) {
+ Header("Location: fiche.php?id=$id");
+ }
- $_GET["action"] = 'create';
- $mesg="".$entrepot->error."
";
- }
- else {
- $mesg="".$langs->trans("ErrorWarehouseRefRequired")."
";
- $_GET["action"]="create"; // Force retour sur page création
- }
+ $_GET["action"] = 'create';
+ $mesg="".$entrepot->error."
";
+ }
+ else {
+ $mesg="".$langs->trans("ErrorWarehouseRefRequired")."
";
+ $_GET["action"]="create"; // Force retour sur page cr�ation
+ }
}
// Modification entrepot
if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
- $entrepot = new Entrepot($db);
- if ($entrepot->fetch($_POST["id"]))
- {
- $entrepot->libelle = $_POST["libelle"];
- $entrepot->description = $_POST["desc"];
- $entrepot->statut = $_POST["statut"];
- $entrepot->lieu = $_POST["lieu"];
- $entrepot->address = $_POST["address"];
- $entrepot->cp = $_POST["cp"];
- $entrepot->ville = $_POST["ville"];
- $entrepot->pays_id = $_POST["pays_id"];
+ $entrepot = new Entrepot($db);
+ if ($entrepot->fetch($_POST["id"]))
+ {
+ $entrepot->libelle = $_POST["libelle"];
+ $entrepot->description = $_POST["desc"];
+ $entrepot->statut = $_POST["statut"];
+ $entrepot->lieu = $_POST["lieu"];
+ $entrepot->address = $_POST["address"];
+ $entrepot->cp = $_POST["cp"];
+ $entrepot->ville = $_POST["ville"];
+ $entrepot->pays_id = $_POST["pays_id"];
- if ( $entrepot->update($_POST["id"], $user) > 0)
- {
- $_GET["action"] = '';
- $_GET["id"] = $_POST["id"];
- //$mesg = 'Fiche mise à jour
';
- }
- else
- {
- $_GET["action"] = 'edit';
- $_GET["id"] = $_POST["id"];
- $mesg = 'Fiche non mise à jour !' . " " . $entrepot->error.'
';
- }
- }
- else
- {
- $_GET["action"] = 'edit';
- $_GET["id"] = $_POST["id"];
- $mesg = 'Fiche non mise à jour !' . " " . $entrepot->error.'
';
- }
+ if ( $entrepot->update($_POST["id"], $user) > 0)
+ {
+ $_GET["action"] = '';
+ $_GET["id"] = $_POST["id"];
+ //$mesg = 'Fiche mise � jour
';
+ }
+ else
+ {
+ $_GET["action"] = 'edit';
+ $_GET["id"] = $_POST["id"];
+ $mesg = 'Fiche non mise � jour !' . " " . $entrepot->error.'
';
+ }
+ }
+ else
+ {
+ $_GET["action"] = 'edit';
+ $_GET["id"] = $_POST["id"];
+ $mesg = 'Fiche non mise � jour !' . " " . $entrepot->error.'
';
+ }
}
if ($_POST["cancel"] == $langs->trans("Cancel"))
{
- $_GET["action"] = '';
- $_GET["id"] = $_POST["id"];
+ $_GET["action"] = '';
+ $_GET["id"] = $_POST["id"];
}
/*
-* View
-*/
+ * View
+ */
llxHeader("","",$langs->trans("WarehouseCard"));
@@ -129,322 +129,335 @@ $form=new Form($db);
if ($_GET["action"] == 'create')
{
- print "';
}
else
{
- if ($_GET["id"])
- {
- if ($mesg) print $mesg;
+ if ($_GET["id"])
+ {
+ if ($mesg) print $mesg;
- $entrepot = new Entrepot($db);
- $result = $entrepot->fetch($_GET["id"]);
- if ($result < 0)
- {
- dolibarr_print_error($db);
- }
+ $entrepot = new Entrepot($db);
+ $result = $entrepot->fetch($_GET["id"]);
+ if ($result < 0)
+ {
+ dolibarr_print_error($db);
+ }
- /*
- * Affichage fiche
- */
- if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
- {
+ /*
+ * Affichage fiche
+ */
+ if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
+ {
- /*
- * Affichage onglets
- */
- $h = 0;
+ /*
+ * Affichage onglets
+ */
+ $h = 0;
- $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id;
- $head[$h][1] = $langs->trans("WarehouseCard");
- $hselected=$h;
- $h++;
+ $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id;
+ $head[$h][1] = $langs->trans("WarehouseCard");
+ $hselected=$h;
+ $h++;
- $head[$h][0] = DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id;
- $head[$h][1] = $langs->trans("StockMovements");
- $h++;
-
- $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$entrepot->id;
- $head[$h][1] = $langs->trans("EnhancedValue");
- $h++;
+ $head[$h][0] = DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id;
+ $head[$h][1] = $langs->trans("StockMovements");
+ $h++;
+
+ $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$entrepot->id;
+ $head[$h][1] = $langs->trans("EnhancedValue");
+ $h++;
- if ($conf->global->STOCK_USE_WAREHOUSE_BY_USER)
- {
- // Add the constant STOCK_USE_WAREHOUSE_BY_USER in cont table to use this feature.
- // Should not be enabled by defaut because does not work yet correctly because
- // there is no way to add values in the table llx_user_entrepot
- $head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$entrepot->id;
- $head[$h][1] = $langs->trans("Users");
- $h++;
- }
+ if ($conf->global->STOCK_USE_WAREHOUSE_BY_USER)
+ {
+ // Add the constant STOCK_USE_WAREHOUSE_BY_USER in cont table to use this feature.
+ // Should not be enabled by defaut because does not work yet correctly because
+ // there is no way to add values in the table llx_user_entrepot
+ $head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$entrepot->id;
+ $head[$h][1] = $langs->trans("Users");
+ $h++;
+ }
- $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id;
- $head[$h][1] = $langs->trans("Info");
- $h++;
+ $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id;
+ $head[$h][1] = $langs->trans("Info");
+ $h++;
- dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle);
+ dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle);
- print '';
+ print '';
// Ref
- print ''.$langs->trans("Ref").' '.$entrepot->libelle.' ';
+ print ''.$langs->trans("Ref").' '.$entrepot->libelle.' ';
- print ''.$langs->trans("LocationSummary").' '.$entrepot->lieu.' ';
+ print ''.$langs->trans("LocationSummary").' '.$entrepot->lieu.' ';
// Description
- print ''.$langs->trans("Description").' '.nl2br($entrepot->description).' ';
+ print ''.$langs->trans("Description").' '.nl2br($entrepot->description).' ';
- print ''.$langs->trans('Address').' ';
- print $entrepot->address;
- print ' ';
+ print ''.$langs->trans('Address').' ';
+ print $entrepot->address;
+ print ' ';
- print ''.$langs->trans('Zip').' '.$entrepot->cp.' ';
- print ''.$langs->trans('Town').' '.$entrepot->ville.' ';
+ print ''.$langs->trans('Zip').' '.$entrepot->cp.' ';
+ print ''.$langs->trans('Town').' '.$entrepot->ville.' ';
- print ''.$langs->trans('Country').' ';
- print $entrepot->pays;
- print ' ';
+ print ''.$langs->trans('Country').' ';
+ print $entrepot->pays;
+ print ' ';
- // Statut
- print ''.$langs->trans("Status").' '.$entrepot->getLibStatut(4).' ';
+ // Statut
+ print ''.$langs->trans("Status").' '.$entrepot->getLibStatut(4).' ';
- print ''.$langs->trans("NumberOfProducts").' ';
- print $entrepot->nb_products();
- print " ";
+ print ''.$langs->trans("NumberOfProducts").' ';
+ print $entrepot->nb_products();
+ print " ";
- // Dernier mouvement
- $sql = "SELECT max( ".$db->pdate("m.datem").") as datem";
- $sql .= " FROM llx_stock_mouvement as m";
- $sql .= " WHERE m.fk_entrepot = '".$entrepot->id."';";
- $resql = $db->query($sql);
- if ($resql)
- {
- $row = $db->fetch_row($resql);
- }
- else
- {
- dolibarr_print_error($db);
- }
+ // Dernier mouvement
+ $sql = "SELECT max( ".$db->pdate("m.datem").") as datem";
+ $sql .= " FROM llx_stock_mouvement as m";
+ $sql .= " WHERE m.fk_entrepot = '".$entrepot->id."';";
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $row = $db->fetch_row($resql);
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
- print ''.$langs->trans("LastMovement").' ';
- print ''.dolibarr_print_date($row[0]).' ';
- print " ";
+ print ''.$langs->trans("LastMovement").' ';
+ print ''.dolibarr_print_date($row[0]).' ';
+ print " ";
- print "
";
+ print "
";
- print '';
-
-
- /* ************************************************************************** */
- /* */
- /* Barre d'action */
- /* */
- /* ************************************************************************** */
-
- print "";
+ print '';
- /* ************************************************************************** */
- /* */
- /* Affichage de la liste des produits de l'entrepot */
- /* */
- /* ************************************************************************** */
- print ' ';
-
- print '';
- print "";
+ /* ************************************************************************** */
+ /* */
+ /* Barre d'action */
+ /* */
+ /* ************************************************************************** */
- print_liste_field_titre($langs->trans("Product"),"", "p.ref","&id=".$_GET['id'],"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$_GET['id'],"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder);
-
- print " ";
- $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, ps.reel as value ";
- $sql .= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p ";
- if ($conf->categorie->enabled && !$user->rights->categorie->voir)
- {
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
- }
- $sql .= " WHERE ps.fk_product = p.rowid ";
- $sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
- $sql .= " AND ps.fk_entrepot = ".$entrepot->id;
- if ($conf->categorie->enabled && !$user->rights->categorie->voir)
- {
- $sql.= ' AND IFNULL(c.visible,1)=1';
- }
+ print "";
+
+
+ /* ************************************************************************** */
+ /* */
+ /* Affichage de la liste des produits de l'entrepot */
+ /* */
+ /* ************************************************************************** */
+ print ' ';
+
+ print '';
+ print "";
+ print_liste_field_titre($langs->trans("Product"),"", "p.ref","&id=".$_GET['id'],"","",$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$_GET['id'],"","",$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder);
+ if ($user->rights->stock->mouvement->creer) print ' ';
+ if ($user->rights->stock->creer) print ' ';
+ print " ";
+
+ $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, ps.reel as value ";
+ $sql .= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p ";
+ if ($conf->categorie->enabled && !$user->rights->categorie->voir)
+ {
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
+ }
+ $sql .= " WHERE ps.fk_product = p.rowid ";
+ $sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
+ $sql .= " AND ps.fk_entrepot = ".$entrepot->id;
+ if ($conf->categorie->enabled && !$user->rights->categorie->voir)
+ {
+ $sql.= ' AND IFNULL(c.visible,1)=1';
+ }
$sql .= " ORDER BY " . $sortfield . " " . $sortorder;
- //$sql .= $db->plimit($limit + 1 ,$offset);
+ //$sql .= $db->plimit($limit + 1 ,$offset);
- $resql = $db->query($sql) ;
- if ($resql)
- {
- $num = $db->num_rows($resql);
- $i = 0;
- $var=True;
- while ($i < $num)
- {
- $objp = $db->fetch_object($resql);
-
- // Multilangs
- if ($conf->global->MAIN_MULTILANGS) // si l'option est active
- {
- $sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
- $sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";
- $sql.= " LIMIT 1";
+ $resql = $db->query($sql) ;
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ $i = 0;
+ $var=True;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($resql);
- $result = $db->query($sql);
- if ($result)
- {
- $objtp = $db->fetch_object($result);
- if ($objtp->label != '') $objp->produit = $objtp->label;
- }
- }
-
- $var=!$var;
- //print ''.dolibarr_print_date($objp->datem).' ';
- print "";
- print "rowid\">";
- print img_object($langs->trans("ShowProduct"),"product").' '.$objp->ref;
- print " ";
- print ''.$objp->produit.' ';
- print ''.$objp->value.' ';
- //print "entrepot_id\">";
- //print img_object($langs->trans("ShowWarehous"),"stock").' '.$objp->stock;
- //print " \n";
- print " ";
- $i++;
- }
- $db->free($resql);
- }
- else
- {
- dolibarr_print_error($db);
- }
- print "
\n";
- }
+ // Multilangs
+ if ($conf->global->MAIN_MULTILANGS) // si l'option est active
+ {
+ $sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
+ $sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";
+ $sql.= " LIMIT 1";
+
+ $result = $db->query($sql);
+ if ($result)
+ {
+ $objtp = $db->fetch_object($result);
+ if ($objtp->label != '') $objp->produit = $objtp->label;
+ }
+ }
+
+ $var=!$var;
+ //print ''.dolibarr_print_date($objp->datem).' ';
+ print "";
+ print "rowid\">";
+ print img_object($langs->trans("ShowProduct"),"product").' '.$objp->ref;
+ print " ";
+ print ''.$objp->produit.' ';
+ print ''.$objp->value.' ';
+
+ if ($user->rights->stock->mouvement->creer)
+ {
+ print '';
+ print $langs->trans("StockMovement");
+ print " ";
+ }
+
+ if ($user->rights->stock->creer)
+ {
+ print '';
+ print $langs->trans("StockCorrection");
+ print " ";
+ }
+
+ print " ";
+ $i++;
+ }
+ $db->free($resql);
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
+ print "
\n";
+ }
- /*
- * Edition fiche
- */
- if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && 1)
- {
- print_fiche_titre($langs->trans("WarehouseEdit"), $mesg);
+ /*
+ * Edition fiche
+ */
+ if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && 1)
+ {
+ print_fiche_titre($langs->trans("WarehouseEdit"), $mesg);
- print '';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
- print '';
+ print ' ';
- }
- }
+ }
+ }
}
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index 43a8ffcbefe..a9cc1cdc017 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -121,7 +121,7 @@ if ($_GET["id"] || $_GET["ref"])
print ' ';
print '';
- // Libellé
+ // Libell�
print ''.$langs->trans("Label").' '.$product->libelle.' ';
print ' ';
@@ -231,7 +231,9 @@ if ($_GET["id"] || $_GET["ref"])
print ''.$langs->trans("Warehouse").' ';
// Entrepot
- print '';
+ print '';
+
+ print '';
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql .= " WHERE statut = 1";
$sql .= " ORDER BY lower(e.label)";
@@ -240,15 +242,20 @@ if ($_GET["id"] || $_GET["ref"])
if ($resql)
{
$num = $db->num_rows($resql);
+ if ($num > 1) print ' ';
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
- print ' '.$obj->label ;
+ print ' rowid) print ' selected="true"';
+ print '>'.$obj->label ;
$i++;
}
}
- print ' ';
+ print ' ';
+
+ print ' ';
print '';
print '';
print ''.$langs->trans("Add").' ';
@@ -265,7 +272,7 @@ if ($_GET["id"] || $_GET["ref"])
}
/*
- * Transfert de pièces
+ * Transfert of units
*/
if ($_GET["action"] == "transfert")
{
@@ -273,7 +280,10 @@ if ($_GET["id"] || $_GET["ref"])
print "id\" method=\"post\">\n";
print ' ';
print '';
- print ''.$langs->trans("Source").' ';
+ print ''.$langs->trans("Source").' ';
+
+ // Select datewarehous
+ print '';
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql .= " WHERE statut = 1";
@@ -283,18 +293,25 @@ if ($_GET["id"] || $_GET["ref"])
if ($resql)
{
$num = $db->num_rows($resql);
+ if ($num > 1) print ' ';
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
- print ' '.$obj->label ;
+ print ' rowid) print ' selected="true"';
+ print '>'.$obj->label ;
$i++;
}
}
- print ' ';
-
- print ''.$langs->trans("Target").' ';
+ print ' ';
+
+ print ' ';
+ print ''.$langs->trans("Target").' ';
+
+ // Select datawarehous
+ print '';
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql .= " WHERE statut = 1";
$sql .= " ORDER BY lower(e.label)";
@@ -303,6 +320,7 @@ if ($_GET["id"] || $_GET["ref"])
if ($resql)
{
$num = $db->num_rows($resql);
+ if ($num > 1) print ' ';
$i = 0;
while ($i < $num)
{
@@ -311,7 +329,9 @@ if ($_GET["id"] || $_GET["ref"])
$i++;
}
}
- print ' ';
+ print ' ';
+
+ print ' ';
print ''.$langs->trans("NumberOfUnit").' ';
print ' ';
print ' ';
@@ -329,8 +349,10 @@ if ($_GET["id"] || $_GET["ref"])
print "id\" method=\"post\">\n";
print ' ';
print '';