2
0
forked from Wavyzz/dolibarr

Fix: Import for companies works even with prefix empty.

This commit is contained in:
Laurent Destailleur
2010-01-15 00:02:52 +00:00
parent aab75e9ec4
commit 2f80ec6828
7 changed files with 11 additions and 8 deletions

View File

@@ -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.

View File

@@ -1527,7 +1527,7 @@ if ($step == 6 && $datatoimport)
print '</div>';
// Show OK
if (! sizeof($arrayoferrors) && ! sizeof($arrayofwarnings)) print img_tick().' <b>'.$langs->trans("NoErrors").'</b><br><br>';
if (! sizeof($arrayoferrors) && ! sizeof($arrayofwarnings)) print img_tick().' <b>'.$langs->trans("NoError").'</b><br><br>';
else print $langs->trans("NbOfLinesOK",$nbok).'</b><br><br>';
// Show Errors

View File

@@ -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)
{

View File

@@ -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');

View File

@@ -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

View File

@@ -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

View File

@@ -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