1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Remove mb_strimwidth

This commit is contained in:
Hillel Coren 2017-03-08 08:47:26 +02:00
parent c843da52d2
commit bc4f70e3ed
3 changed files with 7 additions and 2 deletions

View File

@ -1228,4 +1228,9 @@ class Utils
return round($amount + $tax1 + $tax2, 2); return round($amount + $tax1 + $tax2, 2);
} }
public static function truncateString($string, $length)
{
return strlen($string) > $length ? rtrim(substr($string, 0, $length)) . '...' : $in;
}
} }

View File

@ -137,7 +137,7 @@ class Expense extends EntityModel
if ($this->transaction_id) { if ($this->transaction_id) {
return $this->transaction_id; return $this->transaction_id;
} elseif ($this->public_notes) { } elseif ($this->public_notes) {
return mb_strimwidth($this->public_notes, 0, 16, '...'); return Utils::truncateString($this->public_notes, 16);
} else { } else {
return '#' . $this->public_id; return '#' . $this->public_id;
} }

View File

@ -196,7 +196,7 @@ class Task extends EntityModel
public function getDisplayName() public function getDisplayName()
{ {
if ($this->description) { if ($this->description) {
return mb_strimwidth($this->description, 0, 16, '...'); return Utils::truncateString($this->description, 16);
} }
return '#' . $this->public_id; return '#' . $this->public_id;