forked from Wavyzz/dolibarr
Prepare code for a cleaner implementation of #24943
This commit is contained in:
@@ -35,6 +35,7 @@ if (empty($conf) || !is_object($conf)) {
|
||||
@phan-var-force Conf $conf
|
||||
@phan-var-force Translate $langs
|
||||
@phan-var-force array<string,mixed> $parameters
|
||||
@phan-var-force Societe $thirdpartytopropagateextrafieldsfrom
|
||||
';
|
||||
|
||||
?>
|
||||
@@ -59,6 +60,17 @@ if (empty($reshook)) {
|
||||
$params['tpl_context'] = $parameters['tpl_context'];
|
||||
}
|
||||
|
||||
// By default $thirdpartytopropagateextrafieldsfrom is not set.
|
||||
// We can have it set to a thirdparty object to propagate also the extrafields from thirdparty to object.
|
||||
if (!empty($thirdpartytopropagateextrafieldsfrom) && $thirdpartytopropagateextrafieldsfrom instanceof Societe && !empty($thirdpartytopropagateextrafieldsfrom->id)) {
|
||||
// copy from thirdparty
|
||||
$tpExtrafields = new Extrafields($db);
|
||||
$tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($thirdpartytopropagateextrafieldsfrom->table_element);
|
||||
if ($thirdpartytopropagateextrafieldsfrom->fetch_optionals() > 0) {
|
||||
$object->array_options = array_merge($object->array_options, $thirdpartytopropagateextrafieldsfrom->array_options);
|
||||
}
|
||||
}
|
||||
|
||||
print $object->showOptionals($extrafields, 'create', $params);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user