Fix: big avoid strict mode errors
This commit is contained in:
parent
1f98c2cfc4
commit
66b2f630ac
@ -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:'');
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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 '</td>';
|
||||
print '<td align="right" nowrap="nowrap">'.price($obj->total_ht).'</td></tr>';
|
||||
$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)";
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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 '<td>';
|
||||
if ($obj->rowid > 0)
|
||||
{
|
||||
$customerstatic->id=$obj->rowid;
|
||||
$customerstatic->name=$obj->sname;
|
||||
$customerstatic->client=$obj->client;
|
||||
print $customerstatic->getNomUrl(1,'',16);
|
||||
}
|
||||
print '</td>';
|
||||
{
|
||||
$customerstatic->id=$obj->rowid;
|
||||
$customerstatic->name=$obj->sname;
|
||||
$customerstatic->client=$obj->client;
|
||||
print $customerstatic->getNomUrl(1,'',16);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$datep=$db->jdate($obj->dp);
|
||||
$datep2=$db->jdate($obj->dp2);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -1569,6 +1569,10 @@ function main_area($title='')
|
||||
*/
|
||||
function getHelpParamFor($helppagename,$langs)
|
||||
{
|
||||
$helpbaseurl='';
|
||||
$helppage='';
|
||||
$mode='';
|
||||
|
||||
if (preg_match('/^http/i',$helppagename))
|
||||
{
|
||||
// If complete URL
|
||||
|
||||
@ -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
|
||||
</a> (".$desc_pere[1].")</td><td align=\"center\"> ".($desc_pere[1]*$multiply)."</td><td> </td><td> </td>
|
||||
<td align=\"center\">".$this->stock_entrepot[1]." ".$img."</td></tr>",
|
||||
$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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -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)
|
||||
|
||||
@ -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 '<div class="error">'.$error_msg.'</div><br>';
|
||||
if (! empty($mesg)) {
|
||||
dol_htmloutput_mesg($mesg);
|
||||
}
|
||||
|
||||
if ($action=='delete')
|
||||
|
||||
@ -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"]);
|
||||
|
||||
@ -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 '<br>';
|
||||
}
|
||||
|
||||
|
||||
print($mesg);
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Reference
|
||||
print '<tr>';
|
||||
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
|
||||
print $form->showrefnav($object,'ref','',1,'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Libelle
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$object->libelle.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Status (to sell)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
|
||||
print $object->getLibStatut(2,0);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Status (to buy)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
|
||||
print $object->getLibStatut(2,1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Barre d'action */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
print "\n<div class=\"tabsAction\">\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").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "\n</div>\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 '<br>';
|
||||
|
||||
@ -144,9 +144,9 @@ if ($isphoto)
|
||||
print '</tr>';
|
||||
|
||||
// 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 "</table>\n";
|
||||
|
||||
print "</div>\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();
|
||||
|
||||
|
||||
@ -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 = '';
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
|
||||
@ -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 = '<div class="error">'.$product->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// 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 = '<div class="error">'.$product->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
$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 '<div class="error">'.$mesg.'</div>';
|
||||
if (! empty($mesg)) {
|
||||
dol_htmloutput_mesg($mesg);
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -155,30 +158,33 @@ print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
if ($_GET["action"] == 'edit')
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<form action="" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="vedit">';
|
||||
print '<input type="hidden" name="id" value="'.$_GET["id"].'">';
|
||||
print '<input type="hidden" name="id" value="'.$product->id.'">';
|
||||
|
||||
foreach ( $product->multilangs as $key => $value)
|
||||
if (! empty($product->multilangs))
|
||||
{
|
||||
print "<br><b><u>".$langs->trans('Language_'.$key)." :</u></b><br>";
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$product->multilangs[$key]["libelle"].'"></td></tr>';
|
||||
print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>';
|
||||
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 '</td></tr>';
|
||||
print '<tr><td valign="top" width="15%">'.$langs->trans('Note').'</td><td>';
|
||||
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 '</td></tr>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
foreach ($product->multilangs as $key => $value)
|
||||
{
|
||||
print "<br><b><u>".$langs->trans('Language_'.$key)." :</u></b><br>";
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$product->multilangs[$key]["libelle"].'"></td></tr>';
|
||||
print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>';
|
||||
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 '</td></tr>';
|
||||
print '<tr><td valign="top" width="15%">'.$langs->trans('Note').'</td><td>';
|
||||
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 '</td></tr>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<br><center>';
|
||||
@ -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 "<br>".($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b><br>";
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="15%">'.$langs->trans('Label').'</td><td>'.$product->multilangs[$key]["libelle"].'</td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans('Description').'</td><td>'.$product->multilangs[$key]["description"].'</td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans('Note').'</td><td>'.$product->multilangs[$key]["note"].'</td></tr>';
|
||||
print '</table>';
|
||||
foreach ($product->multilangs as $key => $value)
|
||||
{
|
||||
$cnt_trans++;
|
||||
$s=picto_from_langcode($key);
|
||||
print "<br>".($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b><br>";
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="15%">'.$langs->trans('Label').'</td><td>'.$product->multilangs[$key]["libelle"].'</td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans('Description').'</td><td>'.$product->multilangs[$key]["description"].'</td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans('Note').'</td><td>'.$product->multilangs[$key]["note"].'</td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
if (!$cnt_trans ) print '<br>'. $langs->trans('NoTranslation');
|
||||
if (! $cnt_trans) print '<br>'. $langs->trans('NoTranslation');
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
@ -216,7 +225,7 @@ print "</div>\n";
|
||||
|
||||
print "\n<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($_GET["action"] == '')
|
||||
if ($action == '')
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/traduction.php?action=add&id='.$product->id.'">'.$langs->trans("Add").'</a>';
|
||||
@ -230,7 +239,7 @@ print "\n</div>\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 '<br>';
|
||||
print '<form action="" method="post">';
|
||||
@ -264,5 +273,7 @@ if ($_GET["action"] == 'add' && ($user->rights->produit->creer || $user->rights-
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
$db->close();
|
||||
?>
|
||||
@ -75,7 +75,12 @@ print "</table></form><br>";
|
||||
/*
|
||||
* 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 '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
||||
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 '<tr><td align="center">';
|
||||
$dataseries=array();
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user