NEW Can have a tooltip picto on title of column and keep autotruncation

of label. Tooltip is show at begin of text.
This commit is contained in:
ldestailleur
2025-09-08 11:58:32 +02:00
parent f095528260
commit d27940dd8b
7 changed files with 47 additions and 39 deletions

View File

@@ -98,15 +98,17 @@ if (!$sortorder) {
$sortorder = "ASC";
}
$object = new AccountingAccount($db);
$arrayfields = array(
'aa.account_number' => array('label' => "AccountNumber", 'checked' => '1'),
'aa.label' => array('label' => "Label", 'checked' => '1'),
'aa.labelshort' => array('label' => "LabelToShow", 'checked' => '1'),
'aa.labelshort' => array('label' => "ShortLabel", 'checked' => '1'),
'aa.account_parent' => array('label' => "Accountparent", 'checked' => '1'),
'aa.pcg_type' => array('label' => "Pcgtype", 'checked' => '1', 'help' => 'PcgtypeDesc'),
'categories' => array('label' => "AccountingCategories", 'checked' => '-1', 'help' => 'AccountingCategoriesDesc'),
'aa.reconcilable' => array('label' => "Reconcilable", 'checked' => '1'),
'aa.centralized' => array('label' => "Centralized", 'checked' => '1'),
'aa.centralized' => array('label' => "Centralized", 'checked' => '1', 'help' => 'CentralizedAccountHelp'),
'aa.import_key' => array('label' => "ImportId", 'checked' => '-1', 'help' => ''),
'aa.active' => array('label' => "Activated", 'checked' => '1')
);
@@ -574,10 +576,11 @@ if ($resql) {
// Active
if (!empty($arrayfields['aa.active']['checked'])) {
print '<td class="liste_titre center">';
print '<td class="liste_titre center parentonrightofpage">';
print $form->selectyesno('search_active', $search_active, 1, false, 1, 1, 'search_status onrightofpage width75');
print '</td>';
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center maxwidthsearch">';
@@ -614,12 +617,14 @@ if ($resql) {
print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
$totalarray['nbfield']++;
}
// Main group
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type,aa.account_number', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help'], 1);
print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type,aa.account_number', '', $param, '', $sortfield, $sortorder, 'right ', $arrayfields['aa.pcg_type']['help'].'::-1', 1);
$totalarray['nbfield']++;
}
// Number of custom groups
if (!empty($arrayfields['categories']['checked'])) {
print_liste_field_titre($arrayfields['categories']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '', $arrayfields['categories']['help'], 1);
print_liste_field_titre($arrayfields['categories']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '', $arrayfields['categories']['help'].'::-1', 1);
$totalarray['nbfield']++;
}
@@ -629,7 +634,7 @@ if ($resql) {
print $hookmanager->resPrint;
if (!empty($arrayfields['aa.import_key']['checked'])) {
print_liste_field_titre($arrayfields['aa.import_key']['label'], $_SERVER["PHP_SELF"], 'aa.import_key', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.import_key']['help'], 1);
print_liste_field_titre($arrayfields['aa.import_key']['label'], $_SERVER["PHP_SELF"], 'aa.import_key', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.import_key']['help'].'::-1', 1);
$totalarray['nbfield']++;
}
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
@@ -639,11 +644,11 @@ if ($resql) {
}
}
if (!empty($arrayfields['aa.centralized']['checked'])) {
print_liste_field_titre($arrayfields['aa.centralized']['label'], $_SERVER["PHP_SELF"], 'aa.centralized', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['aa.centralized']['label'], $_SERVER["PHP_SELF"], 'aa.centralized', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.centralized']['help'].'::-1', 1);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['aa.active']['checked'])) {
print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
}
// Action column
@@ -759,7 +764,7 @@ if ($resql) {
}
// Custom accounts
if (!empty($arrayfields['categories']['checked'])) {
print "<td>";
print '<td class="right">';
// TODO Get all custom groups labels the account is in
print dol_escape_htmltag($obj->fk_accounting_category);
print "</td>\n";

View File

@@ -245,7 +245,7 @@ if ($action == 'create') {
print '<td><input name="label" size="70" value="'.$object->label.'"></td></tr>';
// Label short
print '<tr><td>'.$langs->trans("LabelToShow").'</td>';
print '<tr><td>'.$langs->trans("ShortLabel").'</td>';
print '<td><input name="labelshort" size="70" value="'.$object->labelshort.'"></td></tr>';
// Account parent
@@ -314,15 +314,15 @@ if ($action == 'create') {
// Account number
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("AccountNumber").'</span></td>';
print '<td><input name="account_number" size="30" value="'.$object->account_number.'"></td></tr>';
print '<td><input class="minwidth300" name="account_number" value="'.$object->account_number.'"></td></tr>';
// Label
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';
print '<td><input name="label" size="70" value="'.$object->label.'"></td></tr>';
print '<td><input class="minwidth500" name="label" value="'.$object->label.'"></td></tr>';
// Label short
print '<tr><td>'.$langs->trans("LabelToShow").'</td>';
print '<td><input name="labelshort" size="70" value="'.$object->labelshort.'"></td></tr>';
print '<tr><td>'.$langs->trans("ShortLabel").'</td>';
print '<td><input class="minwidth300" name="labelshort" value="'.$object->labelshort.'"></td></tr>';
// Account parent
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
@@ -386,7 +386,7 @@ if ($action == 'create') {
print '<td colspan="2">'.$object->label.'</td></tr>';
// Label to show
print '<tr><td class="titlefield">'.$langs->trans("LabelToShow").'</td>';
print '<tr><td class="titlefield">'.$langs->trans("ShortLabel").'</td>';
print '<td colspan="2">'.$object->labelshort.'</td></tr>';
// Account parent

View File

@@ -7093,7 +7093,7 @@ function dol_print_error_email($prefixcode, $errormessage = '', $errormessages =
* @param ?string $sortorder Current sort order
* @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag, for example 'mycss '.
* @param ?string $tooltip Tooltip
* @param int $forcenowrapcolumntitle No need for use 'wrapcolumntitle' css style
* @param int $forcenowrapcolumntitle No need to use 'wrapcolumntitle' css style
* @return void
*/
function print_liste_field_titre($name, $file = "", $field = "", $begin = "", $moreparam = "", $moreattrib = "", $sortfield = "", $sortorder = "", $prefix = "", $tooltip = "", $forcenowrapcolumntitle = 0)
@@ -7115,7 +7115,7 @@ function print_liste_field_titre($name, $file = "", $field = "", $begin = "", $m
* @param ?string $sortorder Current sort order (Ex: 'asc,desc')
* @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag, for example 'mycss '.
* @param int<0,1> $disablesortlink 1=Disable sort link
* @param ?string $tooltip Tooltip
* @param ?string $tooltip Text of tooltip with syntax 'Tooltip' or 'Tooltip:[keytoenabledtheonclicktooltip]:[tooltipdirection]'
* @param int<0,1> $forcenowrapcolumntitle No need to use 'wrapcolumntitle' css style
* @return string
*/
@@ -7142,7 +7142,15 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
$tmpfield = explode(',', $field);
$field1 = trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep'
if (!getDolGlobalString('MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE') && empty($forcenowrapcolumntitle)) {
if (strpos($tooltip, ':') !== false) {
$tmptooltip = explode(':', $tooltip);
} else {
$tmptooltip = array($tooltip);
}
$wrapcolumntitle = (empty($forcenowrapcolumntitle) || (!empty($tmptooltip[2]) && $tmptooltip[2] == '-1'));
if (!getDolGlobalString('MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE') && $wrapcolumntitle) {
$prefix = 'wrapcolumntitle ' . $prefix;
}
@@ -7156,7 +7164,7 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
$tagstart = '<' . $tag . ' class="' . $prefix . $liste_titre . '" ' . $moreattrib;
//$out .= (($field && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && preg_match('/^[a-zA-Z_0-9\s\.\-:&;]*$/', $name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '');
$tagstart .= ($name && !getDolGlobalString('MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE') && empty($forcenowrapcolumntitle) && !dol_textishtml($name)) ? ' title="' . dolPrintHTMLForAttribute($langs->trans($name)) . '"' : '';
$tagstart .= ($name && !getDolGlobalString('MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE') && $wrapcolumntitle && !dol_textishtml($name)) ? ' title="' . dolPrintHTMLForAttribute($langs->trans($name)) . '"' : '';
$tagstart .= '>';
if (empty($thead) && $field && empty($disablesortlink)) { // If this is a sort field
@@ -7187,13 +7195,8 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
$out .= '>';
}
if ($tooltip) {
// You can also use 'TranslationString:keyfortooltiponclick:tooltipdirection' for a tooltip on click or to change tooltip position.
if (strpos($tooltip, ':') !== false) {
$tmptooltip = explode(':', $tooltip);
} else {
$tmptooltip = array($tooltip);
}
$out .= $form->textwithpicto($langs->trans((string) $name), $langs->trans($tmptooltip[0]), (empty($tmptooltip[2]) ? '1' : $tmptooltip[2]), 'help', '', 0, 3, (empty($tmptooltip[1]) ? '' : 'extra_' . str_replace('.', '_', $field) . '_' . $tmptooltip[1]));
// You can also use 'TranslationString:[keyfortooltiponclick]:[tooltipdirection]' for a tooltip on click or to change tooltip position.
$out .= $form->textwithpicto($langs->trans((string) $name), $langs->trans($tmptooltip[0]), (empty($tmptooltip[2]) ? '1' : $tmptooltip[2]), 'help', ((!empty($tmptooltip[2]) && $tmptooltip[2] == '-1') ? 'paddingrightonly' : ''), 0, 3, (empty($tmptooltip[1]) ? '' : 'extra_' . str_replace('.', '_', $field) . '_' . $tmptooltip[1]));
} else {
$out .= $langs->trans((string) $name);
}

View File

@@ -278,6 +278,7 @@ PcgtypeDesc=Group of account are used as predefined 'filter' and 'grouping' crit
AccountingCategoriesDesc=Custom group of accounts can be used to group accounting accounts into one name to ease the use of filters or building of custom reports.
Reconcilable=Reconcilable
Centralized=Centralized account
CentralizedAccountHelp=When a accounting transaction is recording on a centralized account, you are also allowed to record a more accurate subsidiary account on this transaction.
TotalVente=Total turnover before tax
TotalMarge=Total sales margin
DescVentilCustomer=Consult here the list of customer invoice lines bound (or not) to a product account from chart of account

View File

@@ -302,7 +302,6 @@ ByVatRate=By sale tax rate
TurnoverbyVatrate=Turnover invoiced by sale tax rate
TurnoverCollectedbyVatrate=Turnover collected by sale tax rate
PurchasebyVatrate=Purchase by sale tax rate
LabelToShow=Short label
PurchaseTurnover=Purchase turnover
PurchaseTurnoverCollected=Purchase turnover collected
RulesPurchaseTurnoverDue=- It includes the supplier's due invoices whether they are paid or not. <br>- It is based on the invoice date of these invoices.<br>

View File

@@ -1378,3 +1378,4 @@ Output=Output
Approval=Approval
Validation=Validation
Calculate=Calculate
ShortLabel=Short label

View File

@@ -181,7 +181,6 @@ StateOrigin=State|Province of origin
Nature=Nature of product (raw/manufactured)
NatureOfProductShort=Nature of product
NatureOfProductDesc=Raw material or manufactured product
ShortLabel=Short label
Unit=Unit
p=u.
set=set