From f7871be6cd334dac5d83e5fbccbc2abcfd07443b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Jan 2022 03:06:18 +0100 Subject: [PATCH] Debug v15 --- htdocs/categories/class/categorie.class.php | 12 ++++----- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/modules/modWorkstation.class.php | 2 +- htdocs/langs/en_US/main.lang | 2 ++ htdocs/theme/eldy/global.inc.php | 15 ++++++++++- htdocs/theme/md/style.css.php | 12 +++++++++ .../workstation/class/workstation.class.php | 8 +++--- htdocs/workstation/workstation_card.php | 14 +++++----- htdocs/workstation/workstation_list.php | 26 ++++++++++++++----- 9 files changed, 68 insertions(+), 25 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 9a449d63700..5ffed2e5e4b 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1355,7 +1355,7 @@ class Categorie extends CommonObject * @param string $addpicto Add picto into link * @return array */ - public function print_all_ways($sep = ' >> ', $url = '', $nocolor = 0, $addpicto = 0) + public function print_all_ways($sep = '>>', $url = '', $nocolor = 0, $addpicto = 0) { // phpcs:enable $ways = array(); @@ -1369,8 +1369,8 @@ class Categorie extends CommonObject $i++; if (empty($nocolor)) { - $forced_color = 'toreplace'; - if ($i == count($way)) { + $forced_color = 'colortoreplace'; + if ($i == count($way)) { // Last category in hierarchy // Check contrast with background and correct text color $forced_color = 'categtextwhite'; if ($cat->color) { @@ -1384,16 +1384,16 @@ class Categorie extends CommonObject if ($url == '') { $link = ''; $linkend = ''; - $w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; + $w[] = $link.(($addpicto && $i == 1) ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; } elseif ($url == 'none') { $link = ''; $linkend = ''; - $w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; + $w[] = $link.(($addpicto && $i == 1) ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; } else { $w[] = ''.($addpicto ? img_object('', 'category') : '').$cat->label.''; } } - $newcategwithpath = preg_replace('/toreplace/', $forced_color, implode($sep, $w)); + $newcategwithpath = preg_replace('/colortoreplace/', $forced_color, implode(''.$sep.'', $w)); $ways[] = $newcategwithpath; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 74dc0635292..8b7b3a78049 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8208,7 +8208,7 @@ class Form $toprint[] = '
  • color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'
  • '; } } - return '
    '; + return '
    '; } if ($rendermode == 0) { diff --git a/htdocs/core/modules/modWorkstation.class.php b/htdocs/core/modules/modWorkstation.class.php index 38c5222401c..6106c194544 100755 --- a/htdocs/core/modules/modWorkstation.class.php +++ b/htdocs/core/modules/modWorkstation.class.php @@ -62,7 +62,7 @@ class modWorkstation extends DolibarrModules // Used only if file README.md and README-LL.md not found. $this->descriptionlong = "WorkstationsDescription"; // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' - $this->version = 'development'; + $this->version = 'experimental'; // Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index c59da9aabec..2d850927782 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -212,6 +212,8 @@ User=User Users=Users Group=Group Groups=Groups +UserGroup=User group +UserGroups=User groups NoUserGroupDefined=No user group defined Password=Password PasswordRetype=Retype your password diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index b76838019b2..760fb0f7966 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1168,6 +1168,18 @@ select.flat.selectlimit { text-overflow: ellipsis; white-space: nowrap; } +.tdoverflowmax60 { /* For tdoverflow, the max-midth become a minimum ! */ + max-width: 60px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.tdoverflowmax80 { /* For tdoverflow, the max-midth become a minimum ! */ + max-width: 80px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} .tdoverflowmax100 { /* For tdoverflow, the max-midth become a minimum ! */ max-width: 100px; overflow: hidden; @@ -6122,11 +6134,12 @@ span#select2-boxbookmark-container { box-shadow: none; -webkit-box-shadow: none !important; box-shadow: none !important; + margin-top: 1px !important; margin-bottom: 0 !important; } span.noborderoncategories a, li.noborderoncategories a { line-height: normal; - vertical-align: top; + /* vertical-align: top; */ } span.noborderoncategories { padding: 4px 5px 0px 5px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 2cad39b8e55..bcc02e3ce39 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1278,6 +1278,18 @@ select.flat.selectlimit { text-overflow: ellipsis; white-space: nowrap; } +.tdoverflowmax60 { /* For tdoverflow, the max-midth become a minimum ! */ + max-width: 60px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.tdoverflowmax80 { /* For tdoverflow, the max-midth become a minimum ! */ + max-width: 80px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} .tdoverflowmax100 { /* For tdoverflow, the max-midth become a minimum ! */ max-width: 100px; overflow: hidden; diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index f66f2c51f49..3fed177d95c 100755 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -111,8 +111,8 @@ class Workstation extends CommonObject 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>512, 'notnull'=>-1, 'visible'=>-2,), 'nb_operators_required' => array('type'=>'integer', 'label'=>'NbOperatorsRequired', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1,), - 'thm_operator_estimated' => array('type'=>'double', 'help'=>'THMOperatorEstimatedHelp','label'=>'THMOperatorEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1,), - 'thm_machine_estimated' => array('type'=>'double', 'help'=>'THMMachineEstimatedHelp', 'label'=>'THMMachineEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1,), + 'thm_operator_estimated' => array('type'=>'double', 'help'=>'THMOperatorEstimatedHelp','label'=>'THMOperatorEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1, 'css'=>'right'), + 'thm_machine_estimated' => array('type'=>'double', 'help'=>'THMMachineEstimatedHelp', 'label'=>'THMMachineEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1, 'css'=>'right'), 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'default'=>1, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Enabled'),), ); public $rowid; @@ -855,8 +855,8 @@ class Workstation extends CommonObject } $statusType = 'status'.$status; - //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; - //if ($status == self::STATUS_CANCELED) $statusType = 'status6'; + //if ($status == self::STATUS_DISABLED) $statusType = 'status6'; + if ($status == self::STATUS_ENABLED) $statusType = 'status4'; return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index 733d1c78c62..a179084f75f 100755 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -392,26 +392,28 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Groups if ($object->type !== 'MACHINE') { $toprint = array(); + $g = new UserGroup($db); foreach ($object->usergroups as $id_group) { - $g = new UserGroup($db); $g->fetch($id_group); - $toprint[] = '
  • ' . $g->getNomUrl(1) . '
  • '; + $toprint[] = '
  • ' . $g->getNomUrl(1, '', 0, 'categtextwhite') . '
  • '; } + print '' . $langs->trans('Groups') . ''; - print '
    '; + print '
    '; print ''; } // Resources if ($object->type !== 'HUMAN') { $toprint = array(); + $r = new Dolresource($db); foreach ($object->resources as $id_resource) { - $r = new Dolresource($db); $r->fetch($id_resource); - $toprint[] = '
  • ' . $r->getNomUrl(1) . '
  • '; + $toprint[] = '
  • ' . $r->getNomUrl(1, '', '', 0, 'categtextwhite') . '
  • '; } + print '' . $langs->trans('Machines') . ''; - print '
    '; + print '
    '; print ''; } diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index 2269eb1d704..25dcc44de65 100755 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2020 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -120,7 +120,7 @@ foreach ($object->fields as $key => $val) { } $arrayfields['wug.fk_usergroup'] = array( - 'label'=>$langs->trans('Groups'), + 'label'=>$langs->trans('UserGroups'), 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>1000, @@ -633,25 +633,39 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if (!empty($arrayfields['wug.fk_usergroup']['checked'])) { $toprint = array(); + $cssforli = ''; + if (count($object->usergroups) >= 4) { + $cssforli = 'tdoverflowmax60'; + } elseif (count($object->usergroups) >= 2) { + $cssforli = 'tdoverflowmax80'; + } foreach ($object->usergroups as $id_group) { $g = new UserGroup($db); $g->fetch($id_group); - $toprint[] = '
  • ' . $g->getNomUrl(1) . '
  • '; + $toprint[] = '
  • ' . $g->getNomUrl(1, '', 0, 'categtextwhite') . '
  • '; } + print ''; - print '
      ' . implode(' ', $toprint) . '
    '; + print '
      ' . implode(' ', $toprint) . '
    '; print ''; } if (!empty($arrayfields['wr.fk_resource']['checked'])) { $toprint = array(); + $cssforli = ''; + if (count($object->resources) >= 4) { + $cssforli = 'tdoverflowmax60'; + } elseif (count($object->resources) >= 2) { + $cssforli = 'tdoverflowmax80'; + } foreach ($object->resources as $id_resource) { $r = new Dolresource($db); $r->fetch($id_resource); - $toprint[] = '
  • ' . $r->getNomUrl(1) . '
  • '; + $toprint[] = '
  • ' . $r->getNomUrl(1, '', '', 0, 'categtextwhite') . '
  • '; } + print ''; - print '
      ' . implode(' ', $toprint) . '
    '; + print '
      ' . implode(' ', $toprint) . '
    '; print ''; }