Fix label-picto of extrafields

This commit is contained in:
Laurent Destailleur 2024-08-20 11:45:15 +02:00
parent 99924d4432
commit 0830af9f11
4 changed files with 20 additions and 18 deletions

View file

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

View file

@ -4860,8 +4860,8 @@ function getPictoForType($key, $morecss = '')
'select' => 'list',
'sellist' => 'list',
'radio' => 'check-circle',
'checkbox' => 'check-square',
'chkbxlst' => 'check-square',
'checkbox' => 'list',
'chkbxlst' => 'list',
'link' => 'link',
'icon' => "question",
'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);
} else {
print getPictoForType($type).$type2label[$type];
print getPictoForType($type);
print $type2label[$type];
print '<input type="hidden" name="type" id="type" value="'.$type.'">';
}
?>

View file

@ -454,13 +454,13 @@ ExtrafieldPriceWithCurrency=Price with currency
ExtrafieldMail = Email
ExtrafieldUrl = Url
ExtrafieldIP = IP
ExtrafieldSelect = Select list
ExtrafieldSelectList = Select from table
ExtrafieldSelect=Select list
ExtrafieldSelectList=Select from table
ExtrafieldSeparator=Separator (not a field)
ExtrafieldPassword=Password
ExtrafieldRadio=Radio buttons (one choice only)
ExtrafieldCheckBox=Checkboxes
ExtrafieldCheckBoxFromList=Checkboxes from table
ExtrafieldRadio=Radio buttons (1 choice only)
ExtrafieldCheckBox=Select list (n choices)
ExtrafieldCheckBoxFromList=Select from table (n choices)
ExtrafieldLink=Link to an object
ExtrafieldPointGeo=Geometric Point
ExtrafieldMultiPointGeo=Geometric Multi Point
@ -475,7 +475,7 @@ ExtrafieldParamHelpselect=List of values must be lines with format key,value (wh
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>...
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
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