From a157327859fdddb95359f58b7660d6407ddae1d7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 28 Jul 2012 11:28:37 +0200 Subject: [PATCH] Fix: strict mode paradise --- htdocs/categories/categorie.php | 2 +- htdocs/categories/class/categorie.class.php | 4 +- htdocs/categories/edit.php | 20 ++++-- htdocs/categories/fiche.php | 31 +++++---- htdocs/categories/index.php | 24 +++---- htdocs/categories/photos.php | 72 ++++++++++---------- htdocs/categories/viewcat.php | 7 -- htdocs/core/lib/functions2.lib.php | 4 +- htdocs/core/lib/treeview.lib.php | 3 +- htdocs/core/lib/usergroups.lib.php | 42 +++++------- htdocs/core/modules/modAdherent.class.php | 2 +- htdocs/core/modules/modCommande.class.php | 2 +- htdocs/core/modules/modDeplacement.class.php | 2 +- htdocs/core/modules/modFicheinter.class.php | 2 +- htdocs/core/modules/modFournisseur.class.php | 6 +- htdocs/core/modules/modPropale.class.php | 2 +- htdocs/core/modules/modSociete.class.php | 54 +++++++-------- htdocs/core/modules/modStock.class.php | 2 +- htdocs/user/param_ihm.php | 2 +- htdocs/user/perms.php | 2 +- 20 files changed, 142 insertions(+), 143 deletions(-) diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index ba99f60eaf9..99ec4c512ce 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -223,7 +223,7 @@ if ($socid) print ''; } - if ($conf->global->MAIN_MODULE_BARCODE) + if (! empty($conf->global->MAIN_MODULE_BARCODE)) { print ''.$langs->trans('Gencod').''.$soc->barcode.''; } diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 178136cb73a..111f45a3aac 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1101,8 +1101,8 @@ class Categorie } } - if (count($ways) == 0) - $ways[0][0] = $this; + if (count($ways) == 0) + $ways[0][0] = $this; return $ways; } diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 76b38f29681..dc2d979239e 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -34,6 +34,12 @@ $type=GETPOST('type'); $action=GETPOST('action'); $confirm=GETPOST('confirm'); +$socid=GETPOST('socid','int'); +$nom=GETPOST('nom'); +$description=GETPOST('description'); +$visible=GETPOST('visible'); +$catMere=GETPOST('catMere'); + if ($id == "") { dol_print_error('','Missing parameter id'); @@ -55,13 +61,13 @@ if ($action == 'update' && $user->rights->categorie->creer) $categorie = new Categorie($db); $result=$categorie->fetch($id); - $categorie->label = $_POST["nom"]; - $categorie->description = $_POST["description"]; - $categorie->socid = ($_POST["socid"] ? $_POST["socid"] : 'null'); - $categorie->visible = $_POST["visible"]; + $categorie->label = $nom; + $categorie->description = $description; + $categorie->socid = ($socid ? $socid : 'null'); + $categorie->visible = $visible; - if($_POST['catMere'] != "-1") - $categorie->id_mere = $_POST['catMere']; + if ($catMere != "-1") + $categorie->id_mere = $catMere; else $categorie->id_mere = ""; @@ -76,7 +82,7 @@ if ($action == 'update' && $user->rights->categorie->creer) $_GET["action"] = 'create'; $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")); } - if (! $categorie->error) + if (empty($categorie->error)) { if ($categorie->update($user) > 0) { diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index 15ccad5b5d1..39a1d7c5dcb 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -1,7 +1,7 @@ * Copyright (C) 2006-2011 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Patrick Raguin * * This program is free software; you can redistribute it and/or modify @@ -41,6 +41,12 @@ $catorigin = GETPOST('catorigin','int'); $type = GETPOST('type','alpha'); $urlfrom = GETPOST('urlfrom','alpha'); +$socid=GETPOST('socid','int'); +$nom=GETPOST('nom'); +$description=GETPOST('description'); +$visible=GETPOST('visible'); +$catMere=GETPOST('catMere'); + if ($origin) { if ($type == 0) $idProdOrigin = $origin; @@ -101,22 +107,23 @@ if ($action == 'add' && $user->rights->categorie->creer) $object = new Categorie($db); - $object->label = $_POST["nom"]; - $object->description = $_POST["description"]; - $object->socid = ($_POST["socid"] ? $_POST["socid"] : 'null'); - $object->visible = $_POST["visible"]; + $object->label = $nom; + $object->description = $description; + $object->socid = ($socid ? $socid : 'null'); + $object->visible = $visible; $object->type = $type; - if($_POST['catMere'] != "-1") $object->id_mere = $_POST['catMere']; + if ($catMere != "-1") $object->id_mere = $catMere; if (! $object->label) { - $object->error = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")); - $_GET["action"] = 'create'; + $error++; + $errors[] = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")); + $action = 'create'; } // Create category in database - if (! $object->error) + if (! $error) { $result = $object->create(); if ($result > 0) @@ -197,19 +204,19 @@ if ($user->rights->categorie->creer) print_fiche_titre($langs->trans("CreateCat")); - dol_htmloutput_errors($object->error); + dol_htmloutput_errors('',$errors); print ''; // Ref print ''; - print ''; // Description print ''; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 4da7f4e3f6b..c70c37ee270 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -35,6 +35,8 @@ if (! $user->rights->categorie->lire) accessforbidden(); $id=GETPOST('id','int'); $type=(GETPOST('type') ? GETPOST('type') : 0); +$catname=GETPOST('catname','alpha'); +$section=(GETPOST('section')?GETPOST('section'):0); /* @@ -70,7 +72,7 @@ print ''; print ''; print ''; print ''; +print $langs->trans("Name").':'; /* // faire une rech dans une sous categorie uniquement print '
'.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print'
'.$langs->trans("Description").''; require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); - $doleditor=new DolEditor('description',$object->description,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,ROWS_6,50); + $doleditor=new DolEditor('description',$description,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,ROWS_6,50); $doleditor->Create(); print '
'.$langs->trans("Search").'
'; -print $langs->trans("Name").':
'; @@ -89,9 +91,9 @@ print ''; /* * Categories found */ -if($_POST['catname'] || $id > 0) +if ($catname || $id > 0) { - $cats = $categstatic->rechercher($id,$_POST['catname'],$type); + $cats = $categstatic->rechercher($id,$catname,$type); print ''; print ''; @@ -126,17 +128,10 @@ $cate_arbo = $categstatic->get_full_arbo($type); // Define fulltree array $fulltree=$cate_arbo; - - print '
'.$langs->trans("FoundCats").'
'; print ''; -$section=isset($_GET["section"])?$_GET["section"]:$_POST['section']; -if (! $section) $section=0; - - - // ----- This section will show a tree from a fulltree array ----- // $section must also be defined // --------------------------------------------------------------- @@ -212,9 +207,10 @@ foreach($fulltree as $key => $val) $showline=0; // If directory is son of expanded directory, we show line - if (in_array($val['id_mere'],$expandedsectionarray)) $showline=4; + if (isset($val['id_mere']) && in_array($val['id_mere'],$expandedsectionarray)) $showline=4; // If directory is brother of selected directory, we show line - elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) $showline=3; + // FIXME $ecmdirstatic not exist or not instantiate ? + //elseif (isset($val['id_mere']) && $val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) $showline=3; // If directory is parent of selected directory or is selected directory, we show line elseif (preg_match('/'.$val['fullpath'].'_/i',$fullpathselected.'_')) $showline=2; // If we are level one we show line @@ -243,7 +239,9 @@ foreach($fulltree as $key => $val) print '\n"; print "\t\t\n"; print '\n"; @@ -335,11 +330,9 @@ if ($object->type == 3) if (count($prods) > 0) { - $i = 0; $var=true; foreach ($prods as $key => $member) { - $i++; $var=!$var; print "\t\n"; print '
'.$langs->trans("Categories").''.$langs->trans("Description").'
'; //print $val['fullpath']."(".$showline.")"; $n='2'; - if ($b == 0 || ! in_array($val['id'],$expandedsectionarray)) $n='3'; + // FIXME $b not define ? + //if ($b == 0 || ! in_array($val['id'],$expandedsectionarray)) $n='3'; + if (! in_array($val['id'],$expandedsectionarray)) $n='3'; if (! in_array($val['id'],$expandedsectionarray)) $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/plustop'.$n.'.gif','',1); else $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop'.$n.'.gif','',1); if ($option == 'indexexpanded') $lien = ''; diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index d8d315c199a..b783e77ec22 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -63,7 +63,7 @@ if ($id > 0) * Actions */ -if ($_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) +if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { if ($object->id) $result = $object->add_photo($upload_dir, $_FILES['userfile']); } @@ -94,10 +94,10 @@ if ($object->id) elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); - + $head = categories_prepare_head($object,$type); dol_fiche_head($head, 'photos', $title, 0, 'category'); - + /* * Confirmation de la suppression de photo */ @@ -106,11 +106,11 @@ if ($object->id) $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1); if ($ret == 'html') print '
'; } - + print($mesg); - + print ''; - + // Path of category print ''; - + // Description print ''; - + // Visibility /* if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) { @@ -135,14 +135,14 @@ if ($object->id) { $soc = new Societe($db); $soc->fetch($object->socid); - + print ''; - + $catsMeres = $object->get_meres (); - + if ($catsMeres < 0) { dol_print_error(); @@ -171,21 +171,21 @@ if ($object->id) print ''; } */ - + print "
'; $ways = $object->print_all_ways(); @@ -121,13 +121,13 @@ if ($object->id) print $way."
\n"; } print '
'; print $langs->trans("Description").''; print nl2br($object->description); print '
'; print $langs->trans("AssignedToTheCustomer").''; print $soc->getNomUrl(1); print '
\n"; - + print "\n"; - - - + + + /* ************************************************************************** */ /* */ /* Barre d'action */ /* */ /* ************************************************************************** */ - + print "\n
\n"; - + /* * Ajouter une photo */ @@ -211,32 +211,32 @@ if ($object->id) $formfile=new FormFile($db); $formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&type='.$type,$langs->trans("AddPhoto"),1); } - + // Affiche photos if ($action != 'ajout_photo') { $nbphoto=0; $nbbyrow=5; - + $maxWidth = 160; $maxHeight = 120; - + $pdir = get_exdir($object->id,2) . $object->id ."/photos/"; $dir = $upload_dir.'/'.$pdir; - + print '
'; print ''; foreach ($object->liste_photos($dir) as $key => $obj) { $nbphoto++; - - + + if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print ''; if ($nbbyrow) print ''; if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print ''; } - + // Ferme tableau while ($nbphoto % $nbbyrow) { print ''; $nbphoto++; } - + if ($nbphoto < 1) { print ''; } - + print '
'; - + print ''; - + // Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine if ($obj['photo_vignette']) { @@ -246,21 +246,21 @@ if ($object->id) { $filename=$obj['photo']; } - + // Nom affiche $viewfilename=$obj['photo']; - + // Taille de l'image $object->get_image_size($dir.$filename); $imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth; $imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight; - + print ''; - + print ''; print '
'.$viewfilename; print '
'; - + // On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight)) { @@ -274,21 +274,21 @@ if ($object->id) if ($nbbyrow) print '
 
'; print "
".$langs->trans("NoPhotoYet")."

"; print '
'; } } diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index c1974a95139..b16c550de98 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -173,7 +173,6 @@ else $var=true; foreach ($cats as $cat) { - $i++; $var=!$var; print "\t
"; @@ -219,11 +218,9 @@ if ($object->type == 0) if (count($prods) > 0) { - $i = 0; $var=true; foreach ($prods as $prod) { - $i++; $var=!$var; print "\t
'; @@ -257,11 +254,9 @@ if ($object->type == 1) if (count($socs) > 0) { - $i = 0; $var=true; foreach ($socs as $soc) { - $i++; $var=!$var; print "\t
'; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 30423c65940..58092b58df9 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1091,9 +1091,9 @@ function dol_set_user_param($db, $conf, &$user, $tab) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_param(fk_user,entity,param,value)"; $sql.= " VALUES (".$user->id.",".$conf->entity.","; - $sql.= " '".$key."','".$db->escape($value)."');"; - dol_syslog("functions2.lib::dol_set_user_param sql=".$sql, LOG_DEBUG); + $sql.= " '".$key."','".$db->escape($value)."')"; + dol_syslog("functions2.lib::dol_set_user_param sql=".$sql, LOG_DEBUG); $result=$db->query($sql); if (! $result) { diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index bb5273cb781..0b72e156b40 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -101,7 +101,8 @@ function tree_showpad(&$fulltree,$key,$silent=0) if ($fulltree[$key2]['level'] > $pos) { $nbofdirinsub++; - $nbofdocinsub+=$fulltree[$key2]['cachenbofdoc']; + if (! empty($fulltree[$key2]['cachenbofdoc'])) + $nbofdocinsub+=$fulltree[$key2]['cachenbofdoc']; } if ($fulltree[$key2]['level'] == $pos) { diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 0848580ad7a..c50fb6ca9b1 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -174,12 +174,21 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) $thumbsbyrow=6; print ''; + $var=false; + // Title if ($foruserprofile) { print ''; print ''; print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; } else { @@ -192,31 +201,16 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print $langs->trans('DownloadMoreSkins'); print ''; print ''; - } - $var=false; - - if ($foruserprofile) - { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - - if (! $foruserprofile) - { - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; } $var=!$var; diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 08757f48183..767b8239afa 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -191,7 +191,7 @@ class modAdherent extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as extra ON a.rowid = extra.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'cotisation as c ON c.fk_adherent = a.rowid'; $this->export_sql_end[$r] .=' WHERE a.fk_adherent_type = ta.rowid'; - $this->export_dependencies_array[$r]=array('subscription'=>'c.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r]=array('subscription'=>'c.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Imports //-------- diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 0beaa964fc1..839153be5e3 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -175,7 +175,7 @@ class modCommande extends DolibarrModules $this->export_permission[$r]=array(array("commande","commande","export")); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefClient",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"DateOrder",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"OrderShortStatusInvoicee",'c.fk_statut'=>'Status','c.note'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'Label'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'cd.rowid'=>'order_line','cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); - $this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'commande as c, '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'commandedet as cd)'; diff --git a/htdocs/core/modules/modDeplacement.class.php b/htdocs/core/modules/modDeplacement.class.php index 098200168da..84fa089ce66 100644 --- a/htdocs/core/modules/modDeplacement.class.php +++ b/htdocs/core/modules/modDeplacement.class.php @@ -123,7 +123,7 @@ class modDeplacement extends DolibarrModules $this->export_permission[$r]=array(array("deplacement","export")); $this->export_fields_array[$r]=array('u.login'=>'Login','u.name'=>'Lastname','u.firstname'=>'Firstname','d.rowid'=>"TripId",'d.type'=>"Type",'d.km'=>"FeesKilometersOrAmout",'d.dated'=>"Date",'d.note'=>'NotePrivate','d.note_public'=>'NotePublic','s.nom'=>'ThirdParty'); $this->export_entities_array[$r]=array('u.login'=>'user','u.name'=>'user','u.firstname'=>'user','d.rowid'=>"trip",'d.type'=>"trip",'d.km'=>"trip",'d.dated'=>"trip",'d.note'=>'trip','d.note_public'=>'trip','s.nom'=>'company'); - $this->export_dependencies_array[$r]=array('trip'=>'d.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r]=array('trip'=>'d.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u'; diff --git a/htdocs/core/modules/modFicheinter.class.php b/htdocs/core/modules/modFicheinter.class.php index 58999ea99d1..8b088535d0c 100644 --- a/htdocs/core/modules/modFicheinter.class.php +++ b/htdocs/core/modules/modFicheinter.class.php @@ -141,7 +141,7 @@ class modFicheinter extends DolibarrModules $this->export_permission[$r]=array(array("ficheinter","export")); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InterId",'f.ref'=>"InterRef",'f.datec'=>"InterDateCreation",'f.duree'=>"InterDuration",'f.fk_statut'=>'InterStatus','f.description'=>"InterNote",'fd.rowid'=>'InterLineId','fd.date'=>"InterLineDate",'fd.duree'=>"InterLineDuration",'fd.description'=>"InterLineDesc"); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"intervention",'f.ref'=>"intervention",'f.datec'=>"intervention",'f.duree'=>"intervention",'f.fk_statut'=>"intervention",'f.description'=>"intervention",'fd.rowid'=>"inter_line",'fd.date'=>"inter_line",'fd.duree'=>'inter_line','fd.description'=>'inter_line'); - $this->export_dependencies_array[$r]=array('inter_line'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r]=array('inter_line'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'fichinter as f, '.MAIN_DB_PREFIX.'fichinterdet as fd, '.MAIN_DB_PREFIX.'societe as s)'; diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index bdb0705786e..468d1e8427f 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -243,7 +243,7 @@ class modFournisseur extends DolibarrModules $this->export_permission[$r]=array(array("fournisseur","facture","export")); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); - $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; @@ -260,7 +260,7 @@ class modFournisseur extends DolibarrModules $this->export_permission[$r]=array(array("fournisseur","facture","export")); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment'); - $this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; @@ -278,7 +278,7 @@ class modFournisseur extends DolibarrModules $this->export_permission[$r]=array(array("fournisseur","commande","export")); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.note'=>"Note",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"order",'f.ref'=>"order",'f.ref_supplier'=>"order",'f.date_creation'=>"order",'f.date_commande'=>"order",'f.total_ht'=>"order",'f.total_ttc'=>"order",'f.tva'=>"order",'f.fk_statut'=>'order','f.note'=>"order",'fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); - $this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index b58fffbf75a..6712f23303f 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -171,7 +171,7 @@ class modPropale extends DolibarrModules $this->export_permission[$r]=array(array("propale","export")); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','cp.code'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefClient",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'Label'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','cp.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note'=>"propal",'c.date_livraison'=>"propal",'cd.rowid'=>'propal_line','cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); - $this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s '; diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index e21e903bedd..56a41db58af 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -127,20 +127,20 @@ class modSociete extends DolibarrModules $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'lire'; -/* $r++; - $this->rights[$r][0] = 241; - $this->rights[$r][1] = 'Read thirdparties customers'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'thirparty_customer_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on +/* $r++; + $this->rights[$r][0] = 241; + $this->rights[$r][1] = 'Read thirdparties customers'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'thirparty_customer_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][5] = 'read'; - $r++; - $this->rights[$r][0] = 242; - $this->rights[$r][1] = 'Read thirdparties suppliers'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'thirdparty_supplier_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on + $r++; + $this->rights[$r][0] = 242; + $this->rights[$r][1] = 'Read thirdparties suppliers'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'thirdparty_supplier_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][5] = 'read'; */ @@ -151,21 +151,21 @@ class modSociete extends DolibarrModules $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'creer'; -/* $r++; - $this->rights[$r][0] = 251; - $this->rights[$r][1] = 'Create thirdparties customers'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'thirparty_customer_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on - $this->rights[$r][5] = 'read'; - - $r++; - $this->rights[$r][0] = 252; - $this->rights[$r][1] = 'Create thirdparties suppliers'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'thirdparty_supplier_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on - $this->rights[$r][5] = 'read'; +/* $r++; + $this->rights[$r][0] = 251; + $this->rights[$r][1] = 'Create thirdparties customers'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'thirparty_customer_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on + $this->rights[$r][5] = 'read'; + + $r++; + $this->rights[$r][0] = 252; + $this->rights[$r][1] = 'Create thirdparties suppliers'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'thirdparty_supplier_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on + $this->rights[$r][5] = 'read'; */ $r++; diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 41989d573e3..f639933c1fc 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -125,7 +125,7 @@ class modStock extends DolibarrModules $this->export_fields_array[$r]=array('e.rowid'=>'IdWarehouse','e.label'=>'LocationSummary','e.description'=>'DescWareHouse','e.lieu'=>'LieuWareHouse','e.address'=>'Address','e.cp'=>'Zip','e.ville'=>'Town','p.rowid'=>"ProductId",'p.ref'=>"Ref",'p.fk_product_type'=>"Type",'p.label'=>"Label",'p.description'=>"Description",'p.note'=>"Note",'p.price'=>"Price",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification','ps.reel'=>'Stock'); $this->export_entities_array[$r]=array('e.rowid'=>'warehouse','e.label'=>'warehouse','e.description'=>'warehouse','e.lieu'=>'warehouse','e.address'=>'warehouse','e.cp'=>'warehouse','e.ville'=>'warehouse','p.rowid'=>"product",'p.ref'=>"product",'p.fk_product_type'=>"product",'p.label'=>"product",'p.description'=>"product",'p.note'=>"product",'p.price'=>"product",'p.tva_tx'=>'product','p.tosell'=>"product",'p.duration'=>"product",'p.datec'=>'product','p.tms'=>'product','ps.reel'=>'stock'); $this->export_aggregate_array[$r]=array('ps.reel'=>'SUM'); // TODO Not used yet - $this->export_dependencies_array[$r]=array('stock'=>array('p.rowid','e.rowid')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r]=array('stock'=>array('p.rowid','e.rowid')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'entrepot as e'; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index e5b2542c238..d88f90446ab 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -41,7 +41,7 @@ $action = GETPOST('action','alpha'); if ($id) { // $user est le user qui edite, $id est l'id de l'utilisateur edite - $caneditfield=( (($user->id == $id) && $user->rights->user->self->creer) + $caneditfield=((($user->id == $id) && $user->rights->user->self->creer) || (($user->id != $id) && $user->rights->user->user->creer)); } diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 6981af8bba1..1c304ded7a9 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -317,7 +317,7 @@ if ($result) print ''; // Permission and tick - if ($fuser->admin && $objMod->rights_admin_allowed) // Permission own because admin + if (! empty($fuser->admin) && ! empty($objMod->rights_admin_allowed)) // Permission own because admin { if ($caneditperms) {
'.$langs->trans("Parameter").''.$langs->trans("DefaultValue").' 
'.$langs->trans("DefaultSkin").''.$conf->global->MAIN_THEME.' '.$langs->trans("UsePersonalValue").' 
'.$langs->trans("DefaultSkin").''.$conf->global->MAIN_THEME.' '.$langs->trans("UsePersonalValue").' 
'.$langs->trans("ThemeDir").''; - foreach($dirthemes as $dirtheme) - { - echo '"'.$dirtheme.'" '; - } - print '
'.$langs->trans("ThemeDir").''; + foreach($dirthemes as $dirtheme) + { + echo '"'.$dirtheme.'" '; + } + print '