diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php
index 4a7ceaf36c3..75082eaf140 100644
--- a/htdocs/categories/categorie.php
+++ b/htdocs/categories/categorie.php
@@ -58,20 +58,20 @@ if ($id || $ref)
$dbtablename = 'product';
$fieldid = isset($ref)?'ref':'rowid';
}
- if ($type == 1) {
+ elseif ($type == 1) {
$elementtype = 'fournisseur';
$objecttype = 'societe&categorie';
$objectid = isset($id)?$id:(isset($socid)?$socid:'');
$fieldid = 'rowid';
}
- if ($type == 2) {
+ elseif ($type == 2) {
$elementtype = 'societe';
$objecttype = 'societe&categorie';
$objectid = isset($id)?$id:(isset($socid)?$socid:'');
$dbtablename = '&societe';
$fieldid = 'rowid';
}
- if ($type == 3) {
+ elseif ($type == 3) {
$elementtype = 'member';
$objecttype = 'adherent&categorie';
$objectid = isset($id)?$id:(isset($ref)?$ref:'');
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index fccc9c68ce2..c0f92cc9288 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -776,7 +776,7 @@ class Categorie
// Process all childs on several levels of this category
$protection++;
if ($protection > 10) return; // On ne traite pas plus de 10 niveaux de profondeurs
- if (! is_array($this->cats[$id_categ]['id_children'])) return;
+ if (empty($this->cats[$id_categ]['id_children'])) return;
foreach($this->cats[$id_categ]['id_children'] as $key => $idchild)
{
// Protection when a category has itself as a child (should not happen)
diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index 9c587c2df69..b1913cef72b 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -31,15 +31,13 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/agenda.lib.php");
if ($conf->contrat->enabled) require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
-if (!$user->rights->societe->lire)
-accessforbidden();
+if (! $user->rights->societe->lire) accessforbidden();
$langs->load("commercial");
// Securite acces client
-$socid='';
-if ($_GET["socid"]) { $socid=$_GET["socid"]; }
-if ($user->societe_id > 0)
+$socid=GETPOST('socid','int');
+if (isset($user->societe_id) && $user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
@@ -180,7 +178,7 @@ if ($conf->propal->enabled && $user->rights->propal->lire)
print '';
print '
'.price($obj->total_ht).' | ';
$i++;
- $total += $obj->price;
+ $total += $obj->total_ht;
}
if ($total>0)
{
@@ -282,7 +280,7 @@ if ($conf->societe->enabled && $user->rights->societe->lire)
{
$langs->load("boxes");
- $sql = "SELECT s.rowid, s.nom as name, s.client, s.datec,s.tms";
+ $sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.client IN (1, 2, 3)";
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 2428c57a531..2841baa79f0 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -189,7 +189,7 @@ class Conf
{
$modulename=strtolower($reg[1]);
if ($modulename == 'propale') $modulename='propal';
- if (! is_object($this->$modulename)) $this->$modulename=(object) array();
+ if (! isset($this->$modulename) || ! is_object($this->$modulename)) $this->$modulename=(object) array();
$this->$modulename->enabled=true;
$this->modules[]=$modulename; // Add this module in list of enabled modules
}
diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php
index 91b9e8ec78b..68571f50066 100644
--- a/htdocs/core/class/dolgraph.class.php
+++ b/htdocs/core/class/dolgraph.class.php
@@ -88,7 +88,7 @@ class DolGraph
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
// To use old feature
- if ($conf->global->MAIN_GRAPH_LIBRARY == 'artichow')
+ if (isset($conf->global->MAIN_GRAPH_LIBRARY) && $conf->global->MAIN_GRAPH_LIBRARY == 'artichow')
{
$this->_library='artichow';
@@ -850,7 +850,7 @@ class DolGraph
$this->_stringtoshow.='{ ';
if (! isset($this->type[$i]) || $this->type[$i] == 'bars') $this->_stringtoshow.='bars: { show: true, align: "'.($i==$firstlot?'center':'left').'", barWidth: 0.5 }, ';
if (isset($this->type[$i]) && $this->type[$i] == 'lines') $this->_stringtoshow.='lines: { show: true, fill: false }, ';
- $this->_stringtoshow.='color: "#'.$color.'", label: "'.dol_escape_js($this->Legend[$i]).'", data: d'.$i.' }';
+ $this->_stringtoshow.='color: "#'.$color.'", label: "'.(isset($this->Legend[$i]) ? dol_escape_js($this->Legend[$i]) : '').'", data: d'.$i.' }';
$i++;
}
$this->_stringtoshow.="\n".' ], { series: { stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6 } }'."\n";
diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php
index 9b2ece03540..c12074faea7 100644
--- a/htdocs/core/lib/agenda.lib.php
+++ b/htdocs/core/lib/agenda.lib.php
@@ -178,7 +178,7 @@ function show_array_actions_to_do($max=5)
include_once(DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php');
include_once(DOL_DOCUMENT_ROOT.'/societe/class/client.class.php');
- $sql = "SELECT a.id, a.label, a.datep as dp, a.fk_user_author, a.percent,";
+ $sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,";
$sql.= " c.code, c.libelle,";
$sql.= " s.nom as sname, s.rowid, s.client";
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,";
@@ -226,13 +226,13 @@ function show_array_actions_to_do($max=5)
print '';
if ($obj->rowid > 0)
- {
- $customerstatic->id=$obj->rowid;
- $customerstatic->name=$obj->sname;
- $customerstatic->client=$obj->client;
- print $customerstatic->getNomUrl(1,'',16);
- }
- print ' | ';
+ {
+ $customerstatic->id=$obj->rowid;
+ $customerstatic->name=$obj->sname;
+ $customerstatic->client=$obj->client;
+ print $customerstatic->getNomUrl(1,'',16);
+ }
+ print '';
$datep=$db->jdate($obj->dp);
$datep2=$db->jdate($obj->dp2);
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index 95cdb171a1d..f3b4c9a052b 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -115,14 +115,12 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
if ($dbt_select != 'rowid') $objectid = "'".$objectid."'";
// More features to check
- if (! empty($features)) {
- $features = explode("&", $features);
- }
+ $features = explode("&", $features);
// More parameters
- if (! empty($dbtablename)) {
- list($dbtablename, $sharedelement) = explode('&', $dbtablename);
- }
+ $params = explode('&', $dbtablename);
+ $dbtablename=(! empty($params[0]) ? $params[0] : '');
+ $sharedelement=(! empty($params[1]) ? $params[1] : '');
// Check read permission from module
// TODO Replace "feature" param into caller by first level of permission
diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php
index c00ec226cb6..4fbb595c6f8 100644
--- a/htdocs/fourn/class/fournisseur.product.class.php
+++ b/htdocs/fourn/class/fournisseur.product.class.php
@@ -293,7 +293,7 @@ class ProductFournisseur extends Product
global $conf;
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,";
- $sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn,";
+ $sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.fk_product as product_fourn_id,";
$sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.fk_availability";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 2936da5720d..5ae9909408b 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1569,6 +1569,10 @@ function main_area($title='')
*/
function getHelpParamFor($helppagename,$langs)
{
+ $helpbaseurl='';
+ $helppage='';
+ $mode='';
+
if (preg_match('/^http/i',$helppagename))
{
// If complete URL
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 409a0f775b0..196cfcfc264 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1991,11 +1991,15 @@ class Product extends CommonObject
{
if (is_array($desc_pere)) // If this parent desc is an array, this is an array of childs
{
- if($multiply)
+ $id=(! empty($desc_pere[0]) ? $desc_pere[0] :'');
+ $nb=(! empty($desc_pere[1]) ? $desc_pere[1] :'');
+ $type=(! empty($desc_pere[2]) ? $desc_pere[2] :'');
+
+ if ($multiply)
{
//print "XXX ".$desc_pere[1]." multiply=".$multiply;
$img="";
- $this->fetch($desc_pere[0]);
+ $this->fetch($id);
$this->load_stock();
if ($this->stock_warehouse[1]->real < $this->seuil_stock_alerte)
{
@@ -2007,13 +2011,13 @@ class Product extends CommonObject
(".$desc_pere[1].") ".($desc_pere[1]*$multiply)." |   |   |
".$this->stock_entrepot[1]." ".$img." | ",
$desc_pere[0], // Id product
-*/ 'id'=>$desc_pere[0], // Id product
- 'nb'=>$desc_pere[1], // Nb of units that compose parent product
- 'nb_total'=>$desc_pere[1]*$multiply, // Nb of units for all nb of product
+*/ 'id'=>$id, // Id product
+ 'nb'=>$nb, // Nb of units that compose parent product
+ 'nb_total'=>$nb*$multiply, // Nb of units for all nb of product
'stock'=>$this->stock_warehouse[1]->real, // Stock
'stock_alert'=>$this->seuil_stock_alerte, // Stock alert
'fullpath' => $compl_path.$nom_pere, // Label
- 'type'=>$desc_pere[2] // Nb of units that compose parent product
+ 'type'=>$type // Nb of units that compose parent product
);
}
else
@@ -2023,13 +2027,13 @@ class Product extends CommonObject
$this->res[]= array(
/* $compl_path.$nom_pere." (".$desc_pere[1].")",
$desc_pere[0], // Id product
-*/ 'id'=>$desc_pere[0], // Id product
- 'nb'=>$desc_pere[1], // Nb of units that compose parent product
- 'nb_total'=>$desc_pere[1], // Nb of units for all nb of product
+*/ 'id'=>$id, // Id product
+ 'nb'=>$nb, // Nb of units that compose parent product
+ 'nb_total'=>$nb, // Nb of units for all nb of product
'stock'=>$this->stock_warehouse[1]->real, // Stock
'stock_alert'=>$this->seuil_stock_alerte, // Stock alert
'fullpath' => $compl_path.$nom_pere, // Label
- 'type'=>$desc_pere[2] // Nb of units that compose parent product
+ 'type'=>$type // Nb of units that compose parent product
);
}
}
diff --git a/htdocs/product/composition/fiche.php b/htdocs/product/composition/fiche.php
index 650c99a6fcb..3b24ca48227 100644
--- a/htdocs/product/composition/fiche.php
+++ b/htdocs/product/composition/fiche.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2001-2007 Rodolphe Quiedeville
* Copyright (C) 2004-2011 Laurent Destailleur
* Copyright (C) 2005 Eric Seigne
- * Copyright (C) 2005-2010 Regis Houssin
+ * Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2006 Andre Cianfarani
* Copyright (C) 2011 Juanjo Menent
*
@@ -35,24 +35,22 @@ require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
$langs->load("bills");
$langs->load("products");
+$id=GETPOST('id','int');
+$ref=GETPOST('ref','alpha');
+$action=GETPOST('action','alpha');
+$confirm=GETPOST('confirm','alpha');
+$cancel=GETPOST('cancel','alpha');
+$key=GETPOST('key');
+$catMere=GETPOST('catMere');
+
// Security check
-if (isset($_GET["id"]) || isset($_GET["ref"]))
-{
- $id = isset($_GET["id"])?$_GET["id"]:(isset($_GET["ref"])?$_GET["ref"]:'');
-}
-$fieldid = isset($_GET["ref"])?'ref':'rowid';
-if ($user->societe_id) $socid=$user->societe_id;
-$result=restrictedArea($user,'produit|service',$id,'product','','',$fieldid);
+if (! empty($user->societe_id)) $socid=$user->societe_id;
+$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
+$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
+$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
$mesg = '';
-$id=isset($_GET["id"])?$_GET["id"]:$_POST["id"];
-$ref=isset($_GET["ref"])?$_GET["ref"]:$_POST["ref"];
-$key=isset($_GET["key"])?$_GET["key"]:$_POST["key"];
-$catMere=isset($_GET["catMere"])?$_GET["catMere"]:$_POST["catMere"];
-$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
-$cancel=isset($_GET["cancel"])?$_GET["cancel"]:$_POST["cancel"];
-
$product = new Product($db);
$productid=0;
if ($id || $ref)
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index a3547f6bedc..4e63ec969bd 100755
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -44,7 +44,7 @@ $confirm=GETPOST('confirm','alpha');
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid=$user->societe_id;
-$result=restrictedArea($user,'produit|service',$fielvalue,'product&product','','',$fieldtype);
+$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
// Get parameters
$sortfield = GETPOST("sortfield",'alpha');
@@ -72,7 +72,7 @@ $modulepart='produit';
* Action envoie fichier
*/
-if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
+if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
if (dol_mkdir($upload_dir) >= 0)
{
@@ -121,9 +121,8 @@ llxHeader("","",$langs->trans("CardProduct".$object->type));
if ($object->id)
{
- if ( $error_msg )
- {
- echo ''.$error_msg.'
';
+ if (! empty($mesg)) {
+ dol_htmloutput_mesg($mesg);
}
if ($action=='delete')
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 0194d896f82..27a27cb98c1 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -171,7 +171,7 @@ if ($action == 'updateprice' && $_POST["cancel"] <> $langs->trans("Cancel"))
}
}
-if ($_POST["cancel"] == $langs->trans("Cancel"))
+if (GETPOST('cancel') == $langs->trans("Cancel"))
{
$action = '';
Header("Location: fournisseurs.php?id=".$_GET["id"]);
diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php
index eeaebbc448e..20cacf3045d 100644
--- a/htdocs/product/photos.php
+++ b/htdocs/product/photos.php
@@ -57,7 +57,7 @@ if ($id > 0 || ! empty($ref))
* Actions
*/
-if ($_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
+if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
if ($object->id) $result = $object->add_photo($dir, $_FILES['userfile']);
}
@@ -82,7 +82,7 @@ $form = new Form($db);
if ($object->id)
{
llxHeader("","",$langs->trans("CardProduct".$object->type));
-
+
/*
* En mode visu
*/
@@ -90,56 +90,56 @@ if ($object->id)
$titre=$langs->trans("CardProduct".$object->type);
$picto=($object->type==1?'service':'product');
dol_fiche_head($head, 'photos', $titre, 0, $picto);
-
+
/*
* Confirmation de la suppression de photo
*/
- if ($_GET['action'] == 'delete')
+ if ($action == 'delete')
{
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
if ($ret == 'html') print '
';
}
-
+
print($mesg);
-
+
print '';
-
+
// Reference
print '';
print '| '.$langs->trans("Ref").' | ';
print $form->showrefnav($object,'ref','',1,'ref');
print ' | ';
print '
';
-
+
// Libelle
print '| '.$langs->trans("Label").' | '.$object->libelle.' | ';
print '
';
-
+
// Status (to sell)
print '| '.$langs->trans("Status").' ('.$langs->trans("Sell").') | ';
print $object->getLibStatut(2,0);
print ' |
';
-
+
// Status (to buy)
print '| '.$langs->trans("Status").' ('.$langs->trans("Buy").') | ';
print $object->getLibStatut(2,1);
print ' |
';
-
+
print "
\n";
-
+
print "\n";
-
-
-
+
+
+
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
-
+
print "\n\n";
-
- if ($_GET["action"] != 'ajout_photo' && ($user->rights->produit->creer || $user->rights->service->creer))
+
+ if ($action != 'ajout_photo' && ($user->rights->produit->creer || $user->rights->service->creer))
{
if (! empty($conf->global->MAIN_UPLOAD_DOC))
{
@@ -152,9 +152,9 @@ if ($object->id)
print $langs->trans("AddPhoto").'';
}
}
-
+
print "\n
\n";
-
+
/*
* Add a photo
*/
@@ -164,18 +164,18 @@ if ($object->id)
$formfile=new FormFile($db);
$formfile->form_attach_new_file($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans("AddPhoto"),1);
}
-
+
// Affiche photos
if ($action != 'ajout_photo')
{
$nbphoto=0;
$nbbyrow=5;
-
+
$maxWidth = 160;
$maxHeight = 120;
-
+
print $object->show_photos($dir,1,1000,$nbbyrow,1,1);
-
+
if ($object->nbphoto < 1)
{
print '
';
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index c6045df5920..8bfaae435e6 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -144,9 +144,9 @@ if ($isphoto)
print '';
// MultiPrix
-if ($conf->global->PRODUIT_MULTIPRICES)
+if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
- if ($socid)
+ if (! empty($socid))
{
$soc = new Societe($db);
$soc->id = $socid;
@@ -272,8 +272,9 @@ print "\n";
print "\n";
-
-dol_htmloutput_mesg($mesg);
+if (! empty($mesg)) {
+ dol_htmloutput_mesg($mesg);
+}
/* ************************************************************************** */
@@ -431,7 +432,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."product_price as p,";
$sql.= " ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE fk_product = ".$object->id;
$sql.= " AND p.fk_user_author = u.rowid";
-if ($socid && $conf->global->PRODUIT_MULTIPRICES) $sql.= " AND p.price_level = ".$soc->price_level;
+if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES)) $sql.= " AND p.price_level = ".$soc->price_level;
$sql.= " ORDER BY p.date_price DESC, p.price_level ASC";
//$sql .= $db->plimit();
diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php
index 55fcf93dd04..c3d698a20fb 100644
--- a/htdocs/product/stats/facture.php
+++ b/htdocs/product/stats/facture.php
@@ -35,10 +35,12 @@ $langs->load("products");
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
+$socid='';
+if (! empty($user->societe_id)) $socid=$user->societe_id;
+
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
-if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
$mesg = '';
diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php
index 24b1444ddcc..b65c5df965c 100644
--- a/htdocs/product/stats/fiche.php
+++ b/htdocs/product/stats/fiche.php
@@ -40,10 +40,12 @@ $mode = (GETPOST('mode') ? GETPOST('mode') : 'byunit');
$error = 0;
$mesg = '';
+$socid='';
+if (! empty($user->societe_id)) $socid=$user->societe_id;
+
// Security check
$fieldvalue = (! empty($id) ? $id : $ref);
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
-if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php
index d1e2608e1c7..eea25aceee9 100644
--- a/htdocs/product/traduction.php
+++ b/htdocs/product/traduction.php
@@ -35,6 +35,8 @@ $langs->load("languages");
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
+$action=GETPOST('action','alpha');
+$cancel=GETPOST('cancel','alpha');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
@@ -48,18 +50,18 @@ $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','',
*/
// retour a l'affichage des traduction si annulation
-if ($_POST["cancel"] == $langs->trans("Cancel"))
+if ($cancel == $langs->trans("Cancel"))
{
- $_GET["action"] = '';
+ $action = '';
}
// Validation de l'ajout
-if ($_POST["action"] == 'vadd' &&
-$_POST["cancel"] != $langs->trans("Cancel") &&
+if ($action == 'vadd' &&
+$cancel != $langs->trans("Cancel") &&
($user->rights->produit->creer || $user->rights->service->creer))
{
$product = new Product($db);
- $product->fetch($_POST["id"]);
+ $product->fetch($id);
$current_lang = $langs->getDefaultLang();
// update de l'objet
@@ -79,22 +81,22 @@ $_POST["cancel"] != $langs->trans("Cancel") &&
// sauvegarde en base
if ( $product->setMultiLangs() > 0 )
{
- $_GET["action"] = '';
+ $action = '';
}
else
{
- $_GET["action"] = 'add';
- $mesg = $product->mesg_error;
+ $action = 'add';
+ $mesg = ''.$product->error.'
';
}
}
// Validation de l'edition
-if ($_POST["action"] == 'vedit' &&
-$_POST["cancel"] != $langs->trans("Cancel") &&
+if ($action == 'vedit' &&
+$cancel != $langs->trans("Cancel") &&
($user->rights->produit->creer || $user->rights->service->creer))
{
$product = new Product($db);
- $product->fetch($_POST["id"]);
+ $product->fetch($id);
$current_lang = $langs->getDefaultLang();
foreach ( $product->multilangs as $key => $value ) // enregistrement des nouvelles valeurs dans l'objet
@@ -115,18 +117,17 @@ $_POST["cancel"] != $langs->trans("Cancel") &&
if ( $product->setMultiLangs() > 0 )
{
- $_GET["action"] = '';
+ $action = '';
}
else
{
- $_GET["action"] = 'edit';
- $mesg = $product->mesg_error;
+ $action = 'edit';
+ $mesg = ''.$product->error.'
';
}
}
$product = new Product($db);
-if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
-if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
+$result = $product->fetch($id,$ref);
/*
@@ -143,7 +144,9 @@ $titre=$langs->trans("CardProduct".$product->type);
$picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'translation', $titre, 0, $picto);
-if ($mesg) print ''.$mesg.'
';
+if (! empty($mesg)) {
+ dol_htmloutput_mesg($mesg);
+}
print '';
@@ -155,30 +158,33 @@ print '';
print '';
print '
';
-if ($_GET["action"] == 'edit')
+if ($action == 'edit')
{
print '