diff --git a/app/Utils/Helpers.php b/app/Utils/Helpers.php index 889d75e29f3f..b9947fedc9b2 100644 --- a/app/Utils/Helpers.php +++ b/app/Utils/Helpers.php @@ -41,15 +41,15 @@ class Helpers /** * A centralised way to format the custom fields content. - * - * @param mixed $custom_fields - * @param mixed $field - * @param mixed $value - * @param null|\App\Models\Client $client - * - * @return null|string + * + * @param mixed $custom_fields + * @param mixed $field + * @param mixed $value + * @param \App\Models\Client|null $client + * + * @return null|string */ - public function formatCustomFieldValue($custom_fields, $field, $value, ?Client $client): ?string + public function formatCustomFieldValue($custom_fields, $field, $value, Client $client = null): ?string { $custom_field = ''; @@ -64,7 +64,7 @@ class Helpers switch ($custom_field) { case 'date': - return $this->formatDate($value, $client->date_format()); + return is_null($client) ? $value : $this->formatDate($value, $client->date_format()); break; case 'switch':