forked from Wavyzz/dolibarr
Fix: fk_stcomm is no more required.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -173,7 +173,7 @@ class ImportCsv extends ModeleImports
|
||||
global $langs;
|
||||
$ret=1;
|
||||
|
||||
dol_syslog("ImportCsv::open_file file=".$file);
|
||||
dol_syslog(get_class($this)."::open_file file=".$file);
|
||||
|
||||
ini_set('auto_detect_line_endings',1); // For MAC compatibility
|
||||
|
||||
@@ -346,10 +346,10 @@ class ImportCsv extends ModeleImports
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
}
|
||||
// Test format only if field is not a missing mandatory field
|
||||
// Test format only if field is not a missing mandatory field (field may be a value or empty but not mandatory)
|
||||
else
|
||||
{
|
||||
// We convert fields if required
|
||||
// We convert field if required
|
||||
if (! empty($objimport->array_import_convertvalue[0][$val]))
|
||||
{
|
||||
//print 'Must convert '.$newval.' with rule '.join(',',$objimport->array_import_convertvalue[0][$val]).'. ';
|
||||
@@ -388,6 +388,10 @@ class ImportCsv extends ModeleImports
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='zeroifnull')
|
||||
{
|
||||
if (empty($newval)) $newval='0';
|
||||
}
|
||||
|
||||
//print 'Val to use as insert is '.$newval.'<br>';
|
||||
}
|
||||
@@ -449,7 +453,8 @@ class ImportCsv extends ModeleImports
|
||||
// Define $listfields and $listvalues to build SQL request
|
||||
if ($listfields) { $listfields.=', '; $listvalues.=', '; }
|
||||
$listfields.=$fieldname;
|
||||
if ($arrayrecord[($key-1)]['type'] < 0) $listvalues.="null";
|
||||
|
||||
if ($arrayrecord[($key-1)]['type'] < 0) $listvalues.=($newval=='0'?$newval:"null");
|
||||
elseif ($arrayrecord[($key-1)]['type'] == 0) $listvalues.="''";
|
||||
elseif ($arrayrecord[($key-1)]['type'] > 0) $listvalues.="'".$this->db->escape($newval)."'";
|
||||
}
|
||||
@@ -523,6 +528,8 @@ class ImportCsv extends ModeleImports
|
||||
dol_print_error('','ErrorFieldListEmptyFor '.$alias."/".$tablename);
|
||||
}*/
|
||||
}
|
||||
|
||||
if ($error) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ class modSociete extends DolibarrModules
|
||||
$this->import_icon[$r]='company';
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'societe','extra'=>MAIN_DB_PREFIX.'societe_extrafields'); // List of tables to insert into (insert done in same order)
|
||||
$this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.fk_pays'=>"CountryCode",'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*','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode','s.datec'=>"DateCreation");
|
||||
$this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.fk_pays'=>"CountryCode",'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','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode','s.datec'=>"DateCreation");
|
||||
// Add extra fields
|
||||
$sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'company'";
|
||||
$resql=$this->db->query($sql);
|
||||
@@ -288,6 +288,7 @@ class modSociete extends DolibarrModules
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
's.fk_typent'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ctypent.class.php','class'=>'Ctypent','method'=>'fetch','dict'=>'DictionnaryCompanyType'),
|
||||
's.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cpays.class.php','class'=>'Cpays','method'=>'fetch','dict'=>'DictionnaryCountry'),
|
||||
's.fk_stcomm'=>array('rule'=>'zeroifnull')
|
||||
);
|
||||
//$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]$');
|
||||
|
||||
Reference in New Issue
Block a user