2
0
forked from Wavyzz/dolibarr

Fix label-picto of extrafields

This commit is contained in:
Laurent Destailleur
2024-08-20 11:45:15 +02:00
parent c68c1b1ccf
commit 871643857d
4 changed files with 21 additions and 19 deletions

View File

@@ -90,9 +90,9 @@ class ExtraFields
'ip' => 'ExtrafieldIP', 'ip' => 'ExtrafieldIP',
'icon' => 'Icon', 'icon' => 'Icon',
'password' => 'ExtrafieldPassword', 'password' => 'ExtrafieldPassword',
'radio' => 'ExtrafieldRadio',
'select' => 'ExtrafieldSelect', 'select' => 'ExtrafieldSelect',
'sellist' => 'ExtrafieldSelectList', 'sellist' => 'ExtrafieldSelectList',
'radio' => 'ExtrafieldRadio',
'checkbox' => 'ExtrafieldCheckBox', 'checkbox' => 'ExtrafieldCheckBox',
'chkbxlst' => 'ExtrafieldCheckBoxFromList', 'chkbxlst' => 'ExtrafieldCheckBoxFromList',
'link' => 'ExtrafieldLink', 'link' => 'ExtrafieldLink',
@@ -2584,23 +2584,24 @@ class ExtraFields
{ {
global $langs; global $langs;
$arraytype2label = array('');
$tmptype2label = ExtraFields::$type2label; $tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) { foreach ($tmptype2label as $key => $val) {
$type2label[$key] = $langs->transnoentitiesnoconv($val); $arraytype2label[$key] = $langs->transnoentitiesnoconv($val);
} }
if (!getDolGlobalString('MAIN_USE_EXTRAFIELDS_ICON')) { if (!getDolGlobalString('MAIN_USE_EXTRAFIELDS_ICON')) {
unset($type2label['icon']); unset($arraytype2label['icon']);
} }
if (!getDolGlobalString('MAIN_USE_GEOPHP')) { if (!getDolGlobalString('MAIN_USE_GEOPHP')) {
unset($type2label['point']); unset($arraytype2label['point']);
unset($type2label['multipts']); unset($arraytype2label['multipts']);
unset($type2label['linestrg']); unset($arraytype2label['linestrg']);
unset($type2label['polygon']); unset($arraytype2label['polygon']);
} }
return $type2label; return $arraytype2label;
} }
/** /**

View File

@@ -4761,8 +4761,8 @@ function getPictoForType($key, $morecss = '')
'select' => 'list', 'select' => 'list',
'sellist' => 'list', 'sellist' => 'list',
'radio' => 'check-circle', 'radio' => 'check-circle',
'checkbox' => 'check-square', 'checkbox' => 'list',
'chkbxlst' => 'check-square', 'chkbxlst' => 'list',
'link' => 'link', 'link' => 'link',
'icon' => "question", 'icon' => "question",
'point' => "country", 'point' => "country",

View File

@@ -223,7 +223,8 @@ if (in_array($type, array_keys($typewecanchangeinto))) {
} }
print $formadmin->selectTypeOfFields('type', GETPOST('type', 'alpha') ? GETPOST('type', 'alpha') : $type, $typewecanchangeinto); print $formadmin->selectTypeOfFields('type', GETPOST('type', 'alpha') ? GETPOST('type', 'alpha') : $type, $typewecanchangeinto);
} else { } else {
print getPictoForType($type).$type2label[$type]; print getPictoForType($type);
print $type2label[$type];
print '<input type="hidden" name="type" id="type" value="'.$type.'">'; print '<input type="hidden" name="type" id="type" value="'.$type.'">';
} }
?> ?>

View File

@@ -456,9 +456,9 @@ ExtrafieldSelect = Select list
ExtrafieldSelectList=Select from table ExtrafieldSelectList=Select from table
ExtrafieldSeparator=Separator (not a field) ExtrafieldSeparator=Separator (not a field)
ExtrafieldPassword=Password ExtrafieldPassword=Password
ExtrafieldRadio=Radio buttons (one choice only) ExtrafieldRadio=Radio buttons (1 choice only)
ExtrafieldCheckBox=Checkboxes ExtrafieldCheckBox=Select list (n choices)
ExtrafieldCheckBoxFromList=Checkboxes from table ExtrafieldCheckBoxFromList=Select from table (n choices)
ExtrafieldLink=Link to an object ExtrafieldLink=Link to an object
ExtrafieldPointGeo=Geometric Point ExtrafieldPointGeo=Geometric Point
ExtrafieldMultiPointGeo=Geometric Multi Point ExtrafieldMultiPointGeo=Geometric Multi Point
@@ -472,8 +472,8 @@ ExtrafieldParamHelpPassword=Leaving this field blank means this value will be st
ExtrafieldParamHelpselect=List of values must be lines with format key,value (where key can't be '0')<br><br> for example: <br>1,value1<br>2,value2<br>code3,value3<br>...<br><br>In order to have the list depending on another complementary attribute list:<br>1,value1|options_<i>parent_list_code</i>:parent_key<br>2,value2|options_<i>parent_list_code</i>:parent_key <br><br>In order to have the list depending on another list:<br>1,value1|<i>parent_list_code</i>:parent_key<br>2,value2|<i>parent_list_code</i>:parent_key ExtrafieldParamHelpselect=List of values must be lines with format key,value (where key can't be '0')<br><br> for example: <br>1,value1<br>2,value2<br>code3,value3<br>...<br><br>In order to have the list depending on another complementary attribute list:<br>1,value1|options_<i>parent_list_code</i>:parent_key<br>2,value2|options_<i>parent_list_code</i>:parent_key <br><br>In order to have the list depending on another list:<br>1,value1|<i>parent_list_code</i>:parent_key<br>2,value2|<i>parent_list_code</i>:parent_key
ExtrafieldParamHelpcheckbox=List of values must be lines with format key,value (where key can't be '0')<br><br> for example: <br>1,value1<br>2,value2<br>3,value3<br>... ExtrafieldParamHelpcheckbox=List of values must be lines with format key,value (where key can't be '0')<br><br> for example: <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpradio=List of values must be lines with format key,value (where key can't be '0')<br><br> for example: <br>1,value1<br>2,value2<br>3,value3<br>... ExtrafieldParamHelpradio=List of values must be lines with format key,value (where key can't be '0')<br><br> for example: <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpsellist=List of values comes from a table<br>Syntax: table_name:label_field:id_field::filtersql<br>Example: c_typent:libelle:id::filtersql<br><br>- id_field is necessarily a primary int key<br>- filtersql is a SQL condition. It can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter which is the current id of current object<br>To use a SELECT into the filter use the keyword $SEL$ to bypass anti-injection protection.<br>if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list:<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter ExtrafieldParamHelpsellist=List of values comes from a table<br>Syntax: table_name:label_field:id_field::filtersql<br>Example: c_typent:libelle:id::filtersql<br><br>- id_field is necessarily a primary int key<br>- filtersql is a condition. It must use the USF syntax. Example: (active:=:1) to display only active value<br>You can also use $ID$ in filter which is the current id of current object<br>If you want to filter on extrafields use syntax extra.fieldcode=... (where fieldcode is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list:<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter
ExtrafieldParamHelpchkbxlst=List of values comes from a table<br>Syntax: table_name:label_field:id_field::filtersql<br>Example: c_typent:libelle:id::filtersql<br><br>filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list:<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter ExtrafieldParamHelpchkbxlst=List of values comes from a table<br>Syntax: table_name:label_field:id_field::filtersql<br>Example: c_typent:libelle:id::filtersql<br><br>filter can be a simple test (eg active=1 to display only active value)<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list:<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter
ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath<br>Syntax: ObjectName:Classpath ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath<br>Syntax: ObjectName:Classpath
ExtrafieldParamHelpSeparator=Keep empty for a simple separator<br>Set this to 1 for a collapsing separator (open by default for new session, then status is kept for each user session)<br>Set this to 2 for a collapsing separator (collapsed by default for new session, then status is kept fore each user session) ExtrafieldParamHelpSeparator=Keep empty for a simple separator<br>Set this to 1 for a collapsing separator (open by default for new session, then status is kept for each user session)<br>Set this to 2 for a collapsing separator (collapsed by default for new session, then status is kept fore each user session)
LibraryToBuildPDF=Library used for PDF generation LibraryToBuildPDF=Library used for PDF generation