diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 60e132f3051..122d62b1d76 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2006-2012 Regis Houssin * Copyright (C) 2006-2012 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013-2016 Juanjo Menent * Copyright (C) 2013-2016 Philippe Grand * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud @@ -618,17 +618,19 @@ class Categorie extends CommonObject { if ($this->db->num_rows($resql) > 0) { - $objparent = $this->db->fetch_object($resql); + $objparent = $this->db->fetch_object($resql); if (!empty($objparent->fk_parent)) { $cat = new Categorie($this->db); - $cat->id=$objparent->fk_parent; - $result=$cat->add_type($obj, $type); - if ($result < 0) - { - $this->error=$cat->error; - $error++; + $cat->id = $objparent->fk_parent; + if (!$cat->containsObject($type, $obj->id)) { + $result = $cat->add_type($obj, $type); + if ($result < 0) + { + $this->error = $cat->error; + $error++; + } } } } diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 8733f3ed8ce..4c0689cd282 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -2,6 +2,7 @@ /* Copyright (C) 2012-2014 Charles-François BENKE * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Frederic France + * Copyright (C) 2016 Juan José Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -79,8 +80,10 @@ class box_project extends ModeleBoxes $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; + if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc"; $sql.= " WHERE p.entity = ".$conf->entity; - $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; + $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts $sql.= " ORDER BY p.datec DESC"; $sql.= $db->plimit($max, 0); diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 895ed6de89d..89b2230d4e7 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -454,6 +454,10 @@ class ImportCsv extends ModeleImports } if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null" } + elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='numeric') + { + $newval = price2num($newval); + } //print 'Val to use as insert is '.$newval.'
'; } diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index a8c1bc5bad8..f420224d7ed 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -335,7 +335,8 @@ class modSociete extends DolibarrModules 's.code_client'=>array('rule'=>'getcustomercodeifauto'), 's.code_fournisseur'=>array('rule'=>'getsuppliercodeifauto'), 's.code_compta'=>array('rule'=>'getcustomeraccountancycodeifauto'), - 's.code_compta_fournisseur'=>array('rule'=>'getsupplieraccountancycodeifauto') + 's.code_compta_fournisseur'=>array('rule'=>'getsupplieraccountancycodeifauto'), + 's.capital'=>array('rule'=>'numeric') ); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); $this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 75d28bf41a4..b7125da21e2 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -170,7 +170,7 @@ $arrayfields=array( // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); } @@ -341,8 +341,9 @@ else dol_print_error($db); $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, "; $sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; -$sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4, s.fk_pays,"; +$sql.= " s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.fk_pays,"; $sql.= " s.tms as date_update, s.datec as date_creation,"; +$sql.= " s.code_compta,s.code_compta_fournisseur,"; $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name"; // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) @@ -408,7 +409,7 @@ foreach ($search_array_options as $key => $val) $typ=$extrafields->attribute_type[$tmpkey]; $mode=0; if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric - if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) + if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); } @@ -439,7 +440,6 @@ if (! $resql) $num = $db->num_rows($resql); $i = 0; - if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) { $obj = $db->fetch_object($resql); @@ -980,6 +980,7 @@ while ($i < min($num, $limit)) print $s; print ''; } + if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) { // Prospect level @@ -987,6 +988,7 @@ while ($i < min($num, $limit)) print $companystatic->getLibProspLevel(); print ""; } + if (! empty($arrayfields['s.fk_stcomm']['checked'])) { // Prospect status @@ -1004,9 +1006,9 @@ while ($i < min($num, $limit)) // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { print 'getAlignFlag($key);