Browse Source

Clean code using dolGetFirstLineOfText()

Laurent Destailleur 3 years ago
parent
commit
143660799b

+ 1 - 1
htdocs/accountancy/customer/lines.php

@@ -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>';

+ 1 - 1
htdocs/accountancy/customer/list.php

@@ -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>';

+ 1 - 1
htdocs/accountancy/expensereport/lines.php

@@ -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>';

+ 1 - 1
htdocs/accountancy/expensereport/list.php

@@ -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>';

+ 1 - 1
htdocs/accountancy/supplier/lines.php

@@ -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>';

+ 1 - 1
htdocs/accountancy/supplier/list.php

@@ -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>';

+ 3 - 1
htdocs/categories/index.php

@@ -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";
 		}

+ 2 - 2
htdocs/comm/action/list.php

@@ -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>';
 	}
 

+ 1 - 1
htdocs/core/modules/action/rapport.pdf.php

@@ -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));

+ 2 - 2
htdocs/fichinter/list.php

@@ -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']++;
 			}

+ 1 - 1
htdocs/holiday/month_report.php

@@ -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>';