Fix extrafields in import tool

This commit is contained in:
Maxime Kohlhaas
2018-11-30 19:23:05 +01:00
parent d8ab614efb
commit 5dcb3d2a1f
7 changed files with 8 additions and 8 deletions

View File

@@ -287,7 +287,7 @@ class modResource extends DolibarrModules
$this->import_tables_array[$r]=array('r'=>MAIN_DB_PREFIX.'resource','extra'=>MAIN_DB_PREFIX.'resource_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r]=array('r.ref'=>"ResourceFormLabel_ref*",'r.fk_code_type_resource'=>'ResourceTypeCode','r.description'=>'ResourceFormLabel_description','r.note_private'=>"NotePrivate",'r.note_public'=>"NotePublic",'r.asset_number'=>'AssetNumber','r.datec'=>'DateCreation');
// Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'resource' AND entity = ".$conf->entity;
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'resource' AND entity IN (0,".$conf->entity.")";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{