Debug v15

This commit is contained in:
Laurent Destailleur 2022-01-03 03:06:18 +01:00
parent 219ca9b610
commit f7871be6cd
9 changed files with 68 additions and 25 deletions

View File

@ -1355,7 +1355,7 @@ class Categorie extends CommonObject
* @param string $addpicto Add picto into link * @param string $addpicto Add picto into link
* @return array * @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 // phpcs:enable
$ways = array(); $ways = array();
@ -1369,8 +1369,8 @@ class Categorie extends CommonObject
$i++; $i++;
if (empty($nocolor)) { if (empty($nocolor)) {
$forced_color = 'toreplace'; $forced_color = 'colortoreplace';
if ($i == count($way)) { if ($i == count($way)) { // Last category in hierarchy
// Check contrast with background and correct text color // Check contrast with background and correct text color
$forced_color = 'categtextwhite'; $forced_color = 'categtextwhite';
if ($cat->color) { if ($cat->color) {
@ -1384,16 +1384,16 @@ class Categorie extends CommonObject
if ($url == '') { if ($url == '') {
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$cat->id.'&type='.$cat->type.'" class="'.$forced_color.'">'; $link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$cat->id.'&type='.$cat->type.'" class="'.$forced_color.'">';
$linkend = '</a>'; $linkend = '</a>';
$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') { } elseif ($url == 'none') {
$link = '<span class="'.$forced_color.'">'; $link = '<span class="'.$forced_color.'">';
$linkend = '</span>'; $linkend = '</span>';
$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 { } else {
$w[] = '<a class="'.$forced_color.'" href="'.DOL_URL_ROOT.'/'.$url.'?catid='.$cat->id.'">'.($addpicto ? img_object('', 'category') : '').$cat->label.'</a>'; $w[] = '<a class="'.$forced_color.'" href="'.DOL_URL_ROOT.'/'.$url.'?catid='.$cat->id.'">'.($addpicto ? img_object('', 'category') : '').$cat->label.'</a>';
} }
} }
$newcategwithpath = preg_replace('/toreplace/', $forced_color, implode($sep, $w)); $newcategwithpath = preg_replace('/colortoreplace/', $forced_color, implode('<span class="inline-block valignmiddle paddingleft paddingright '.$forced_color.'">'.$sep.'</span>', $w));
$ways[] = $newcategwithpath; $ways[] = $newcategwithpath;
} }

View File

@ -8208,7 +8208,7 @@ class Form
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>'; $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';
} }
} }
return '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
} }
if ($rendermode == 0) { if ($rendermode == 0) {

View File

@ -62,7 +62,7 @@ class modWorkstation extends DolibarrModules
// Used only if file README.md and README-LL.md not found. // Used only if file README.md and README-LL.md not found.
$this->descriptionlong = "WorkstationsDescription"; $this->descriptionlong = "WorkstationsDescription";
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' // 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 // Url to the file with your last numberversion of this module
//$this->url_last_version = 'http://www.example.com/versionmodule.txt'; //$this->url_last_version = 'http://www.example.com/versionmodule.txt';

View File

@ -212,6 +212,8 @@ User=User
Users=Users Users=Users
Group=Group Group=Group
Groups=Groups Groups=Groups
UserGroup=User group
UserGroups=User groups
NoUserGroupDefined=No user group defined NoUserGroupDefined=No user group defined
Password=Password Password=Password
PasswordRetype=Retype your password PasswordRetype=Retype your password

View File

@ -1168,6 +1168,18 @@ select.flat.selectlimit {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; 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 ! */ .tdoverflowmax100 { /* For tdoverflow, the max-midth become a minimum ! */
max-width: 100px; max-width: 100px;
overflow: hidden; overflow: hidden;
@ -6122,11 +6134,12 @@ span#select2-boxbookmark-container {
box-shadow: none; box-shadow: none;
-webkit-box-shadow: none !important; -webkit-box-shadow: none !important;
box-shadow: none !important; box-shadow: none !important;
margin-top: 1px !important;
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
span.noborderoncategories a, li.noborderoncategories a { span.noborderoncategories a, li.noborderoncategories a {
line-height: normal; line-height: normal;
vertical-align: top; /* vertical-align: top; */
} }
span.noborderoncategories { span.noborderoncategories {
padding: 4px 5px 0px 5px; padding: 4px 5px 0px 5px;

View File

@ -1278,6 +1278,18 @@ select.flat.selectlimit {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; 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 ! */ .tdoverflowmax100 { /* For tdoverflow, the max-midth become a minimum ! */
max-width: 100px; max-width: 100px;
overflow: hidden; overflow: hidden;

View File

@ -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,), '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,), '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,), '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_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,), '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'),), '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; public $rowid;
@ -855,8 +855,8 @@ class Workstation extends CommonObject
} }
$statusType = 'status'.$status; $statusType = 'status'.$status;
//if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; //if ($status == self::STATUS_DISABLED) $statusType = 'status6';
//if ($status == self::STATUS_CANCELED) $statusType = 'status6'; if ($status == self::STATUS_ENABLED) $statusType = 'status4';
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
} }

View File

@ -392,26 +392,28 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Groups // Groups
if ($object->type !== 'MACHINE') { if ($object->type !== 'MACHINE') {
$toprint = array(); $toprint = array();
$g = new UserGroup($db);
foreach ($object->usergroups as $id_group) { foreach ($object->usergroups as $id_group) {
$g = new UserGroup($db);
$g->fetch($id_group); $g->fetch($id_group);
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $g->getNomUrl(1) . '</li>'; $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $g->getNomUrl(1, '', 0, 'categtextwhite') . '</li>';
} }
print '<tr><td>' . $langs->trans('Groups') . '</td><td>'; print '<tr><td>' . $langs->trans('Groups') . '</td><td>';
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
print '</td></tr>'; print '</td></tr>';
} }
// Resources // Resources
if ($object->type !== 'HUMAN') { if ($object->type !== 'HUMAN') {
$toprint = array(); $toprint = array();
$r = new Dolresource($db);
foreach ($object->resources as $id_resource) { foreach ($object->resources as $id_resource) {
$r = new Dolresource($db);
$r->fetch($id_resource); $r->fetch($id_resource);
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $r->getNomUrl(1) . '</li>'; $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $r->getNomUrl(1, '', '', 0, 'categtextwhite') . '</li>';
} }
print '<tr><td>' . $langs->trans('Machines') . '</td><td>'; print '<tr><td>' . $langs->trans('Machines') . '</td><td>';
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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( $arrayfields['wug.fk_usergroup'] = array(
'label'=>$langs->trans('Groups'), 'label'=>$langs->trans('UserGroups'),
'checked'=>(($visible < 0) ? 0 : 1), 'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
'position'=>1000, 'position'=>1000,
@ -633,25 +633,39 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!empty($arrayfields['wug.fk_usergroup']['checked'])) { if (!empty($arrayfields['wug.fk_usergroup']['checked'])) {
$toprint = array(); $toprint = array();
$cssforli = '';
if (count($object->usergroups) >= 4) {
$cssforli = 'tdoverflowmax60';
} elseif (count($object->usergroups) >= 2) {
$cssforli = 'tdoverflowmax80';
}
foreach ($object->usergroups as $id_group) { foreach ($object->usergroups as $id_group) {
$g = new UserGroup($db); $g = new UserGroup($db);
$g->fetch($id_group); $g->fetch($id_group);
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $g->getNomUrl(1) . '</li>'; $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ? ' '.$cssforli : '').'" style="background: #bbb">' . $g->getNomUrl(1, '', 0, 'categtextwhite') . '</li>';
} }
print '<td>'; print '<td>';
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['wr.fk_resource']['checked'])) { if (!empty($arrayfields['wr.fk_resource']['checked'])) {
$toprint = array(); $toprint = array();
$cssforli = '';
if (count($object->resources) >= 4) {
$cssforli = 'tdoverflowmax60';
} elseif (count($object->resources) >= 2) {
$cssforli = 'tdoverflowmax80';
}
foreach ($object->resources as $id_resource) { foreach ($object->resources as $id_resource) {
$r = new Dolresource($db); $r = new Dolresource($db);
$r->fetch($id_resource); $r->fetch($id_resource);
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $r->getNomUrl(1) . '</li>'; $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ? ' '.$cssforli : '').'" style="background: #bbb">' . $r->getNomUrl(1, '', '', 0, 'categtextwhite') . '</li>';
} }
print '<td>'; print '<td>';
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
print '</td>'; print '</td>';
} }