mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-11 02:12:33 +01:00
Fix/140/t250062/extrafields multicompany data loss (#34022)
* insertExtrafields(): simplify by returning 0 early if array_options is empty * insertExtrafields(): simplify by using local variables $newValue and $attributeType * insertExtrafields(): refactor by grouping the empty value cases for geodatabase-type extrafields * insertExtrafields(): refactor by using a static mapping of geodata types to their ST_* db function on ExtraField class * FIX: when an object that is shared across multiple entities already has some extrafields from another entity that are not reachable from the current entity, their values are lost * Compliance with - phan ( Closure Closure($key) has no declared or inferred parameter type for $key) - php-stan (Error: Property ExtraFields::$geoDataTypes has no type specified)
This commit is contained in:
@@ -107,6 +107,26 @@ class ExtraFields
|
||||
'stars' => 'ExtrafieldStars',
|
||||
);
|
||||
|
||||
/** @var array<string,array<string,string>> $geoDataTypes */
|
||||
public static $geoDataTypes = array(
|
||||
'point' => array(
|
||||
'ST_Function' => 'ST_PointFromText',
|
||||
'shortname' => 'point'
|
||||
),
|
||||
'multipts' => array(
|
||||
'ST_Function' => 'ST_MultiPointFromText',
|
||||
'shortname' => 'multipoint'
|
||||
),
|
||||
'linestrg' => array(
|
||||
'ST_Function' => 'ST_LineFromText',
|
||||
'shortname' => 'line'
|
||||
),
|
||||
'polygon' => array(
|
||||
'ST_Function' => 'ST_PolyFromText',
|
||||
'shortname' => 'polygon'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user