diff --git a/ChangeLog b/ChangeLog index 497db948f30..309ff14b547 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,6 +29,7 @@ For users: - New: task #9916 : Add FREE text for interventions card. - New: Can define the new product ref when cloning. - New: Project module support status of project and end date. +- Fix: Import module works even if prefix is empty in source file. - Fix: bug #28055 : Unable to modify the date of a cloned command. - Fix: bug #27891. - Fix: Change of numbering module was not effective. @@ -36,6 +37,7 @@ For users: for a product. - Fix: Running sending-email.php - Fix: Warning should not appears for invoice closed +- Fix: Import for companies works even with prefix empty. For developers: - Qual: Reorganize /dev directory. diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 9f7490d92eb..0fdfda6771f 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1527,7 +1527,7 @@ if ($step == 6 && $datatoimport) print ''; // Show OK - if (! sizeof($arrayoferrors) && ! sizeof($arrayofwarnings)) print img_tick().' '.$langs->trans("NoErrors").'

'; + if (! sizeof($arrayoferrors) && ! sizeof($arrayofwarnings)) print img_tick().' '.$langs->trans("NoError").'

'; else print $langs->trans("NbOfLinesOK",$nbok).'

'; // Show Errors diff --git a/htdocs/includes/modules/import/import_csv.modules.php b/htdocs/includes/modules/import/import_csv.modules.php index dc3c05b52af..cee7b0ee9e3 100644 --- a/htdocs/includes/modules/import/import_csv.modules.php +++ b/htdocs/includes/modules/import/import_csv.modules.php @@ -198,7 +198,7 @@ class ImportCsv extends ModeleImports /** * \brief Return array of next record in input file. * \return Array Array of field values. Data are UTF8 encoded. - * [0]=>(['val']=>val,['type']=>-1=null,0=blank,1=string) + * [0] => (['val']=>val, ['type']=>-1=null,0=blank,1=string) */ function import_read_record() { @@ -226,12 +226,12 @@ class ImportCsv extends ModeleImports if (strtolower($conf->global->IMPORT_CSV_FORCE_CHARSET) == 'utf8') { $newarrayres[$key]['val']=$val; - $newarrayres[$key]['type']=1; + $newarrayres[$key]['type']=(strlen($val)?1:-1); // If empty we considere it's null } else { $newarrayres[$key]['val']=utf8_encode($val); - $newarrayres[$key]['type']=1; + $newarrayres[$key]['type']=(strlen($val)?1:-1); // If empty we considere it's null } } else // Autodetect format (UTF8 or ISO) @@ -239,12 +239,12 @@ class ImportCsv extends ModeleImports if (utf8_check($val)) { $newarrayres[$key]['val']=$val; - $newarrayres[$key]['type']=1; + $newarrayres[$key]['type']=(strlen($val)?1:-1); // If empty we considere it's null } else { $newarrayres[$key]['val']=utf8_encode($val); - $newarrayres[$key]['type']=1; + $newarrayres[$key]['type']=(strlen($val)?1:-1); // If empty we considere it's null } } } @@ -359,6 +359,7 @@ class ImportCsv extends ModeleImports } $i++; } + //print $listvalues; if (! $errorforthistable) { diff --git a/htdocs/includes/modules/modProduit.class.php b/htdocs/includes/modules/modProduit.class.php index 266234c6da4..bf6e6e8b586 100644 --- a/htdocs/includes/modules/modProduit.class.php +++ b/htdocs/includes/modules/modProduit.class.php @@ -157,7 +157,6 @@ class modProduit extends DolibarrModules $this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product'); $this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id $this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.note'=>"Note",'p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.envente'=>"OnSell*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.duration'=>"Duration",'p.weight'=>"Weight",'p.volume'=>"Volume",'p.datec'=>'DateCreation*'); - //if ($conf->barcode->enabled) $this->import_fields_array[$r]= $this->import_entities_array[$r]=array(); // We define here only fields that use another picto $this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.envente'=>'^[0|1]','p.fk_product_type'=>'^[0|1]','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); $this->import_examplevalues_array[$r]=array('p.ref'=>"PR123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.envente'=>"0 or 1",'p.fk_product_type'=>"0 for product, 1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31'); diff --git a/htdocs/includes/modules/modSociete.class.php b/htdocs/includes/modules/modSociete.class.php index efe885aec48..a17639c85d4 100644 --- a/htdocs/includes/modules/modSociete.class.php +++ b/htdocs/includes/modules/modSociete.class.php @@ -233,7 +233,6 @@ class modSociete extends DolibarrModules $this->import_code[$r]=$this->rights_class.'_'.$r; $this->import_label[$r]='ImportDataset_company_1'; $this->import_icon[$r]='company'; - //$this->import_permission[$r]=array(array("societe","export")); $this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'societe'); // List of tables to insert into (insert done in same order) $this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.prefix_comm'=>"Prefix",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.datec'=>"DateCreation",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Effectif","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus'); $this->import_entities_array[$r]=array(); // We define here only fields that use another picto diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 74b30dbaada..7dd472fe995 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -12,6 +12,7 @@ FormatDateHourShort=%d/%m/%Y %I:%M %p FormatDateHourTextShort=%b %d, %Y, %I:%M %p FormatDateHourText=%B %d, %Y, %I:%M %p DatabaseConnection=Database connection +NoError=No error Error=Error ErrorFieldRequired=Field '%s' is required ErrorFieldFormat=Field '%s' has a bad value diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 5cc66d8d5c1..cea249215d8 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -12,6 +12,7 @@ FormatDateHourShort=%d/%m/%Y %H:%M FormatDateHourTextShort=%d %b %Y %H:%M FormatDateHourText=%d %B %Y %H:%M DatabaseConnection=Connexion à la base +NoError=Aucune erreur Error=Erreur ErrorFieldRequired=Le champ '%s' est obligatoire ErrorFieldFormat=Le champ '%s' a une valeur incorrecte