mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
37c4acf8e0
|
|
@ -711,6 +711,44 @@ class Export
|
|||
$remaintopay = $tmpobjforcomputecall->getRemainToPay();
|
||||
}
|
||||
$obj->$alias = $remaintopay;
|
||||
} elseif (is_array($this->array_export_special[$indice][$key]) &&
|
||||
!empty($this->array_export_special[$indice][$key]['rule']) &&
|
||||
$this->array_export_special[$indice][$key]['rule'] == 'compute'
|
||||
) {
|
||||
// Custom compute
|
||||
$alias = str_replace(array('.', '-', '(', ')'), '_', $key);
|
||||
$value = '';
|
||||
if (!empty($this->array_export_special[$indice][$key]['class']) &&
|
||||
!empty($this->array_export_special[$indice][$key]['classfile']) &&
|
||||
!empty($this->array_export_special[$indice][$key]['method'])
|
||||
) {
|
||||
if (!dol_include_once($this->array_export_special[$indice][$key]['classfile'])) {
|
||||
$this->error = "Computed field bad configuration: {$this->array_export_special[$indice][$key]['classfile']} not found";
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!class_exists($this->array_export_special[$indice][$key]['class'])) {
|
||||
$this->error = "Computed field bad configuration: {$this->array_export_special[$indice][$key]['class']} class doesn't exist";
|
||||
return -1;
|
||||
}
|
||||
|
||||
$className = $this->array_export_special[$indice][$key]['class'];
|
||||
$tmpObject = new $className($this->db);
|
||||
if (!method_exists($tmpObject, $this->array_export_special[$indice][$key]['method'])) {
|
||||
$this->error = "Computed field bad configuration: {$this->array_export_special[$indice][$key]['method']} method doesn't exist";
|
||||
return -1;
|
||||
}
|
||||
|
||||
$methodName = $this->array_export_special[$indice][$key]['method'];
|
||||
$params = [];
|
||||
if (!empty($this->array_export_special[$indice][$key]['method_params'])) {
|
||||
foreach ($this->array_export_special[$indice][$key]['method_params'] as $paramName) {
|
||||
$params[] = $obj->$paramName ?? null;
|
||||
}
|
||||
}
|
||||
$value = $tmpObject->$methodName(...$params);
|
||||
}
|
||||
$obj->$alias = $value;
|
||||
} else {
|
||||
// TODO FIXME
|
||||
// Export of compute field does not work. $obj contains $obj->alias_field and formula may contains $obj->field
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user