NEW: Star Field Type for Extra Fields (#31348)

* stars type for extrafields

* min value

* fix phan
This commit is contained in:
Mohamed DAOUD
2024-10-13 17:24:15 +02:00
committed by GitHub
parent 611019ec4d
commit b4732da616
7 changed files with 200 additions and 1 deletions

View File

@@ -466,6 +466,7 @@ ExtrafieldPointGeo=Geometric Point
ExtrafieldMultiPointGeo=Geometric Multi Point
ExtrafieldLinestringGeo=Geometric Linestring
ExtrafieldPolygonGeo=Geometric Polygon
ExtrafieldStars=Stars
ComputedFormula=Computed field
ComputedFormulaDesc=You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: <strong>$db, $conf, $langs, $mysoc, $user, $objectoffield</strong>.<br><strong>WARNING</strong>: If you need properties of an object not loaded, just fetch yourself the object into your formula like in the second example.<br>Using a computed field means you can't enter yourself any value from interface. Also, if there is a syntax error, the formula may return nothing.<br><br>Example of formula:<br>$objectoffield->id < 10 ? round($objectoffield->id / 2, 2): ($objectoffield->id + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)<br><br>Example to reload object<br>(($reloadedobj = new Societe($db)) && ($reloadedobj->fetchNoCompute($objectoffield->id) > 0 ? $reloadedobj->array_options['options_extrafieldkey'] * $reloadedobj->capital / 5: '-1')<br><br>Other example of formula to force load of object and its parent object:<br>(($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($objectoffield->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref: 'Parent project not found'
Computedpersistent=Store computed field