diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index bffb631ba2e..743db11913b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -64,12 +64,12 @@ class ExtraFields public $errors = array(); /** - * @var string DB Error number + * @var string DB Error number */ public $errno; /** - * @var array array of type to label + * @var array Array of type to label */ public static $type2label = array( 'varchar'=>'String1Line', @@ -97,7 +97,6 @@ class ExtraFields 'separate' => 'ExtrafieldSeparator', ); - /** * Constructor * diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c1fd345e37e..ecb38743cca 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4123,6 +4123,49 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF } } +/** + * Return the picto for a data type + * + * @param string $key Key + * @return string Pïcto for the key + */ +function getPictoForType($key) +{ + // Set array with type -> picto + $type2picto = array( + 'varchar'=>'font', + 'text'=>'font', + 'html'=>'code', + 'int'=>'sort-numeric-down', + 'double'=>'sort-numeric-down', + 'int'=>'sort-numeric-down', + 'price'=>'currency', + 'pricecy'=>'multicurrency', + 'password' => 'key', + 'boolean'=>'check-square', + 'date'=>'calendar', + 'datetime'=>'calendar', + 'phone'=> 'phone', + 'mail'=> 'email', + 'url'=> 'url', + 'ip'=> 'country', + 'select' => 'list', + 'sellist' => 'list', + 'radio' => 'check-circle', + 'checkbox' => 'check-square', + 'chkbxlst' => 'check-square', + 'link' => 'link', + 'separate'=> 'minus' + ); + + if (!empty($type2picto[$key])) { + return img_picto('', $type2picto[$key], 'class="pictofixedwidth"'); + } + + return img_picto('', 'generic', 'class="pictofixedwidth"'); +} + + /** * Show picto whatever it's its name (generic function) * @@ -4219,30 +4262,30 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset', 'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'birthday-cake', 'bookmark', 'bom', 'briefcase-medical', 'bug', 'building', 'card', 'calendarlist', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype', - 'cash-register', 'category', 'chart', 'check', 'clock', 'clone', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cross', 'cubes', - 'currency', 'multicurrency', + 'cash-register', 'category', 'chart', 'check', 'clock', 'clone', 'close_title', 'code', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cross', 'cubes', + 'check-circle', 'check-square', 'currency', 'multicurrency', + 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies', 'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice', 'edit', 'ellipsis-h', 'email', 'entity', 'envelope', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt', 'eye', - 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus', + 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus', 'font', 'gears', 'generate', 'generic', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group', 'hands-helping', 'help', 'holiday', 'id-card', 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'jobprofile', - 'knowledgemanagement', + 'key', 'knowledgemanagement', 'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lock', 'lot', 'long-arrow-alt-right', - 'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next', + 'margin', 'map-marker-alt', 'member', 'meeting', 'minus', 'money-bill-alt', 'movement', 'mrp', 'note', 'next', 'off', 'on', 'order', 'paiment', 'paragraph', 'play', 'pdf', 'phone', 'phoning', 'phoning_mobile', 'phoning_fax', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'proposal', 'puce', 'stock', 'resize', 'service', 'stats', 'trip', 'security', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'switch_on_warning', 'switch_on_red', 'tools', 'unlink', 'uparrow', 'user', 'user-tie', 'vcard', 'wrench', 'github', 'google', 'jabber', 'microsoft', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', - 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies', 'generic', 'home', 'hrm', 'members', 'products', 'invoicing', 'partnership', 'payment', 'payment_vat', 'pencil-ruler', 'pictoconfirm', 'preview', 'project', 'projectpub', 'projecttask', 'question', 'refresh', 'region', 'salary', 'shipment', 'state', 'supplier_invoice', 'supplier_invoicea', 'supplier_invoicer', 'supplier_invoiced', 'technic', 'ticket', 'error', 'warning', 'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'replacement', 'resource', 'recurring','rss', - 'shapes', 'skill', 'square', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice', + 'shapes', 'skill', 'square', 'sort-numeric-down', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda', 'uncheck', 'url', 'user-cog', 'user-injured', 'user-md', 'vat', 'website', 'workstation', 'webhook', 'world', 'private', 'conferenceorbooth', 'eventorganization', @@ -4282,7 +4325,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_warning'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'filter'=>'filter', 'list-alt'=>'list-alt', 'calendarlist'=>'bars', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table', - 'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'currency'=>'dollar-sign', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice', + 'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'order'=>'file-invoice', 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'other'=>'square', 'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'pos'=>'cash-register', 'preview'=>'binoculars', 'project'=>'project-diagram', 'projectpub'=>'project-diagram', 'projecttask'=>'tasks', 'propal'=>'file-signature', 'proposal'=>'file-signature', @@ -4300,6 +4343,13 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'website'=>'globe-americas', 'workstation'=>'pallet', 'webhook'=>'bullseye', 'world'=>'globe', 'private'=>'user-lock', 'conferenceorbooth'=>'chalkboard-teacher', 'eventorganization'=>'project-diagram' ); + if ($conf->currency == 'EUR') { + $arrayconvpictotofa['currency'] = 'euro-sign'; + $arrayconvpictotofa['multicurrency'] = 'dollar-sign'; + } else { + $arrayconvpictotofa['currency'] = 'dollar-sign'; + $arrayconvpictotofa['multicurrency'] = 'euro-sign'; + } if ($pictowithouttext == 'off') { $fakey = 'fa-square'; $fasize = '1.3em'; diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 5404f831a65..7930551e376 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -157,7 +157,22 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con trans("AttributeCode"); ?> (trans("AlphaNumOnlyLowerCharsAndNoSpace"); ?>) trans("Type"); ?> -selectarray('type', $type2label, GETPOST('type', 'alpha'), 0, 0, 0, '', 0, 0, 0, '', '', 1); ?> +'; +foreach ($type2label as $key => $val) { + $selected = ''; + if ($key == GETPOST('type', 'alpha')) { + $selected = ' selected="selected"'; + } + + // Set $valhtml with the picto for the type + $valhtml = ($key ? getPictoForType($key) : '').$val; + + print ''; +} +print ''; +print ajax_combobox('type'); +?> trans("Size"); ?> diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index cb5775ca347..d94d58a1659 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -216,23 +216,26 @@ if ($size <= 255 && in_array($type, array('text', 'html'))) { }*/ if (in_array($type, array_keys($typewecanchangeinto))) { - $newarray = array(); print ''; print ajax_combobox('type'); } else { - print $type2label[$type]; + print getPictoForType($type).$type2label[$type]; print ''; } ?> diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 7eb871f5b2b..8f28bc87f52 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -109,6 +109,7 @@ if (isset($extrafields->attributes[$elementtype]['type']) && is_array($extrafiel // Type $typetoshow = $type2label[$extrafields->attributes[$elementtype]['type'][$key]]; print ''; + print getPictoForType($extrafields->attributes[$elementtype]['type'][$key]); print dol_escape_htmltag($typetoshow); print "\n"; // Size