Clean code using dolGetFirstLineOfText()

This commit is contained in:
Laurent Destailleur 2022-03-16 21:22:03 +01:00
parent cd79b61ace
commit 143660799b
11 changed files with 15 additions and 13 deletions

View File

@ -497,7 +497,7 @@ if ($result) {
print '</td>';
print '<td class="tdoverflowonsmartphone">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
print '</td>';

View File

@ -637,7 +637,7 @@ if ($result) {
// Description
print '<td class="tdoverflowonsmartphone small">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc));
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facture_static_det->desc);
print '</td>';

View File

@ -405,7 +405,7 @@ if ($result) {
// Fees description -- Can be null
print '<td>';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
print '</td>';

View File

@ -481,7 +481,7 @@ if ($result) {
// Fees description -- Can be null
print '<td>';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
print '</td>';

View File

@ -502,7 +502,7 @@ if ($result) {
print '</td>';
print '<td class="tdoverflowonsmartphone">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
print '</td>';

View File

@ -644,7 +644,7 @@ if ($result) {
// Description
print '<td class="tdoverflowonsmartphone small">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc));
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc);
print '</td>';

View File

@ -133,7 +133,9 @@ if (empty($nosearch)) {
print '</span>';
print "</td>\n";
print "\t\t<td>";
print dolGetFirstLineOfText($cat->description);
$text = dolGetFirstLineOfText(dol_string_nohtmltag($cat->description, 1));
$trunclength = 48;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $cat->description);
print "</td>\n";
print "\t</tr>\n";
}

View File

@ -943,8 +943,8 @@ while ($i < min($num, $limit)) {
// Description
if (!empty($arrayfields['a.note']['checked'])) {
print '<td class="tdoverflowonsmartphone">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0));
print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private);
$text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 1));
print $form->textwithtooltip(dol_trunc($text, 48), $actionstatic->note_private);
print '</td>';
}

View File

@ -261,7 +261,7 @@ class CommActionRapport
if (!preg_match('/^'.preg_quote($obj->label, '/').'/', $obj->note)) {
$text = $obj->label."\n";
}
$text .= dolGetFirstLineOfText(dol_string_nohtmltag($obj->note), 2);
$text .= dolGetFirstLineOfText(dol_string_nohtmltag($obj->note), 1);
// Add status to text
$text .= "\n";
$status = $outputlangs->trans("Status").': '.dol_htmlentitiesbr_decode($eventstatic->getLibStatut(1, 1));

View File

@ -666,7 +666,7 @@ if ($resql) {
}
}
if (!empty($arrayfields['f.description']['checked'])) {
print '<td>'.dol_trunc(dolGetFirstLineOfText($obj->description), 48).'</td>';
print '<td>'.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)), 48).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -723,7 +723,7 @@ if ($resql) {
}
// Fields of detail of line
if (!empty($arrayfields['fd.description']['checked'])) {
print '<td>'.dolGetFirstLineOfText($obj->descriptiondetail).'</td>';
print '<td>'.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->descriptiondetail, 1)), 48).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -418,7 +418,7 @@ if ($num == 0) {
print '<td class="right">'.num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth).'</td>';
}
if (!empty($arrayfields['cp.description']['checked'])) {
print '<td class="maxwidth300 small">'.dol_escape_htmltag(dolGetFirstLineOfText($obj->description)).'</td>';
print '<td class="maxwidth300 small">'.dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)).'</td>';
}
print '<td></td>';