From 7d4b45963989c0c78afa6efbc38588cb4bf0d49b Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Sat, 28 Jan 2023 14:43:00 +0100 Subject: [PATCH] change to 7 to be close to extrafields + reverse doc --- htdocs/core/class/commonobject.class.php | 6 +++--- htdocs/core/class/extrafields.class.php | 2 ++ htdocs/modulebuilder/template/class/myobject.class.php | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3dd24b807ac..2b336e3c855 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6158,9 +6158,9 @@ abstract class CommonObject //print $sql; //fix #22571 : order by could be set - //remember 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', - if(isset($InfoFieldList[5]) && $InfoFieldList[5] != "") { - $sql .= ' ORDER BY '.$InfoFieldList[5]; + //remember to be close to extrafields 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:CategoryIdType[:CategoryIdList[:Sortfield]]]]]]', + if(isset($InfoFieldList[7]) && $InfoFieldList[7] != "") { + $sql .= ' ORDER BY '.$InfoFieldList[7]; } else { $sql .= ' ORDER BY '.implode(', ', $fields_label); } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 8418ebcbb22..a5ab8d516c5 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1153,6 +1153,7 @@ class ExtraFields // 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value // 5 : id category type // 6 : ids categories list separated by comma for category root + // 7 : sort by (to be close to common object) $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid'); @@ -1327,6 +1328,7 @@ class ExtraFields // 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value // 5 : id category type // 6 : ids categories list separated by comma for category root + // 7 : sort by (to be close to common object) $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid'); if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) { diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 51992ada8ee..dec96ad76f0 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -68,9 +68,8 @@ class MyObject extends CommonObject const STATUS_VALIDATED = 1; const STATUS_CANCELED = 9; - /** - * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:CategoryIdType[:CategoryIdList[:SortField]]]]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms