Skip to content

Commit

Permalink
FIX #15365 export of extrafields for user and resources
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 12, 2020
1 parent 73df033 commit 0215892
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions htdocs/core/modules/modResource.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ public function __construct($db)

$this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = c.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = r.rowid';
$this->export_sql_end[$r] .= ' AND r.entity IN ('.getEntity('resource').')';


Expand Down
5 changes: 4 additions & 1 deletion htdocs/core/modules/modUser.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,16 @@ public function __construct($db)
'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user',
'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member"
);
if (empty($conf->adherent->enabled))
$keyforselect = 'user'; $keyforelement = 'user'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
if (empty($conf->adherent->enabled))
{
unset($this->export_fields_array[$r]['u.fk_member']);
unset($this->export_entities_array[$r]['u.fk_member']);
}
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extra ON u.rowid = extra.fk_object';
$this->export_sql_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')';

// Imports
Expand Down

2 comments on commit 0215892

@sachinsyam
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥🔥🔥🔥

@sachinsyam
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we expect any new update releases for v12 soon?

Please sign in to comment.