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 ''; print ''; - + // Libelle print ''; print ''; - + // Status (to sell) print ''; - + // Status (to buy) print ''; - + print "
'.$langs->trans("Ref").''; print $form->showrefnav($object,'ref','',1,'ref'); print '
'.$langs->trans("Label").''.$object->libelle.'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; print $object->getLibStatut(2,0); print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; print $object->getLibStatut(2,1); 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 '
'; print ''; print ''; - print ''; + print ''; - foreach ( $product->multilangs as $key => $value) + if (! empty($product->multilangs)) { - print "
".$langs->trans('Language_'.$key)." :
"; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); - $doleditor=new DolEditor('desc-'.$key.'',$product->multilangs[$key]["description"],'',160,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,3,80); - $doleditor->Create(); - print '
'.$langs->trans('Note').''; - require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); - $doleditor=new DolEditor('note-'.$key.'',$product->multilangs[$key]["note"],'',160,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,3,80); - $doleditor->Create(); - print '
'; + foreach ($product->multilangs as $key => $value) + { + print "
".$langs->trans('Language_'.$key)." :
"; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; + require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); + $doleditor=new DolEditor('desc-'.$key.'',$product->multilangs[$key]["description"],'',160,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,3,80); + $doleditor->Create(); + print '
'.$langs->trans('Note').''; + require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); + $doleditor=new DolEditor('note-'.$key.'',$product->multilangs[$key]["note"],'',160,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,3,80); + $doleditor->Create(); + print '
'; + } } print '
'; @@ -191,18 +197,21 @@ if ($_GET["action"] == 'edit') else { $cnt_trans = 0; - foreach ( $product->multilangs as $key => $value) + if (! empty($product->multilangs)) { - $cnt_trans++; - $s=picto_from_langcode($key); - print "
".($s?$s.' ':'')." ".$langs->trans('Language_'.$key).":
"; - print ''; - print ''; - print ''; - print ''; - print '
'.$langs->trans('Label').''.$product->multilangs[$key]["libelle"].'
'.$langs->trans('Description').''.$product->multilangs[$key]["description"].'
'.$langs->trans('Note').''.$product->multilangs[$key]["note"].'
'; + foreach ($product->multilangs as $key => $value) + { + $cnt_trans++; + $s=picto_from_langcode($key); + print "
".($s?$s.' ':'')." ".$langs->trans('Language_'.$key).":
"; + print ''; + print ''; + print ''; + print ''; + print '
'.$langs->trans('Label').''.$product->multilangs[$key]["libelle"].'
'.$langs->trans('Description').''.$product->multilangs[$key]["description"].'
'.$langs->trans('Note').''.$product->multilangs[$key]["note"].'
'; + } } - if (!$cnt_trans ) print '
'. $langs->trans('NoTranslation'); + if (! $cnt_trans) print '
'. $langs->trans('NoTranslation'); } print "\n"; @@ -216,7 +225,7 @@ print "\n"; print "\n
\n"; -if ($_GET["action"] == '') +if ($action == '') if ($user->rights->produit->creer || $user->rights->service->creer) { print ''.$langs->trans("Add").''; @@ -230,7 +239,7 @@ print "\n
\n"; * Form to add a new translation */ -if ($_GET["action"] == 'add' && ($user->rights->produit->creer || $user->rights->service->creer)) +if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service->creer)) { print '
'; print ''; @@ -264,5 +273,7 @@ if ($_GET["action"] == 'add' && ($user->rights->produit->creer || $user->rights- print '
'; } + llxFooter(); -?> +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index dd0e7717164..c1c7d6c205e 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -75,7 +75,12 @@ print "
"; /* * Statistics area */ -$third = array(); +$third = array( + 'customer' => 0, + 'prospect' => 0, + 'supplier' => 0, + 'other' =>0 +); $total=0; $sql = "SELECT s.rowid, s.client, s.fournisseur"; @@ -92,10 +97,10 @@ if ($result) while ($objp = $db->fetch_object($result)) { $found=0; - if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) { $found=1; $third['customer']++; } - if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) { $found=1; $third['prospect']++; } - if ($conf->fournisseur->enabled && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) { $found=1; $third['supplier']++; } - if ($conf->societe->enabled && $objp->client == 0 && $objp->fournisseur == 0) { $found=1; $third['other']++; } + if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) { $found=1; $third['customer']++; } + if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) { $found=1; $third['prospect']++; } + if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) { $found=1; $third['supplier']++; } + if (! empty($conf->societe->enabled) && $objp->client == 0 && $objp->fournisseur == 0) { $found=1; $third['other']++; } if ($found) $total++; } } @@ -103,7 +108,7 @@ else dol_print_error($db); print ''; print ''; -if ($conf->use_javascript_ajax && ((round($third['prospect'])?1:0)+(round($third['customer'])?1:0)+(round($third['supplier'])?1:0)+(round($third['other'])?1:0) >= 2)) +if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(round($third['customer'])?1:0)+(round($third['supplier'])?1:0)+(round($third['other'])?1:0) >= 2)) { print '
'.$langs->trans("Statistics").'
'; $dataseries=array(); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b2b4941a695..326da714425 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -143,7 +143,9 @@ $fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty( // Set text color to black or white $tmppart=explode(',',$colorback1); -$tmpval=$tmppart[1]+$tmppart[2]+$tmppart[3]; +$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : ''); +$tmpval+=(! empty($tmppart[2]) ? $tmppart[2] : ''); +$tmpval+=(! empty($tmppart[3]) ? $tmppart[3] : ''); //print $tmpval; if ($tmpval < 340) $colortextmain='FFFFFF'; else $colortextmain='101010'; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f3cad67cd4a..fe6650d4203 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -531,11 +531,11 @@ class User extends CommonObject if ($perms) { - if (! is_object($this->rights)) $this->rights = (object) array(); // For avoid error - if (! is_object($this->rights->$module)) $this->rights->$module = (object) array(); + if (! isset($this->rights)) $this->rights = (object) array(); // For avoid error + if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = (object) array(); if ($subperms) { - if (! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = (object) array(); + if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = (object) array(); $this->rights->$module->$perms->$subperms = 1; } else @@ -578,11 +578,11 @@ class User extends CommonObject if ($perms) { - if (! is_object($this->rights)) $this->rights = (object) array(); // For avoid error - if (! is_object($this->rights->$module)) $this->rights->$module = (object) array(); + if (! isset($this->rights)) $this->rights = (object) array(); // For avoid error + if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = (object) array(); if ($subperms) { - if (! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = (object) array(); + if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = (object) array(); $this->rights->$module->$perms->$subperms = 1; } else diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 91f3c895bca..48b388bd971 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -470,11 +470,11 @@ class UserGroup extends CommonObject if ($perms) { - if (! is_object($this->rights)) $this->rights = (object) array(); // For avoid error - if (! is_object($this->rights->$module)) $this->rights->$module = (object) array(); + if (! isset($this->rights)) $this->rights = (object) array(); // For avoid error + if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = (object) array(); if ($subperms) { - if (! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = (object) array(); + if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = (object) array(); $this->rights->$module->$perms->$subperms = 1; } else