diff --git a/zmsdb/src/Zmsdb/Calldisplay.php b/zmsdb/src/Zmsdb/Calldisplay.php index 220efa74c..b525f5531 100644 --- a/zmsdb/src/Zmsdb/Calldisplay.php +++ b/zmsdb/src/Zmsdb/Calldisplay.php @@ -86,7 +86,6 @@ public function readImage(Entity $entity) ->getQueryImage(), ['name' => "logo.png"]); } - return null; $mime = pathinfo($image['name'], PATHINFO_EXTENSION); $image['mime'] = ($mime == 'jpg') ? 'jpeg' : $mime; return $image; diff --git a/zmsentities/src/Zmsentities/Helper/Messaging.php b/zmsentities/src/Zmsentities/Helper/Messaging.php index 65272ce37..39e7fbc2d 100644 --- a/zmsentities/src/Zmsentities/Helper/Messaging.php +++ b/zmsentities/src/Zmsentities/Helper/Messaging.php @@ -195,11 +195,13 @@ public static function getNotificationContent(Process $process, Config $config, protected static function getTemplate($type, $status, ?Process $process = null) { - $providerName = $process->getCurrentScope()->getProvider()->getDisplayName(); - $providerTemplate = 'custom/' . $type . '/' . $status . '/' . (self::slugify($providerName)) . '.twig'; + if ($process) { + $providerName = $process->getCurrentScope()->getProvider()->getName(); + $providerTemplate = 'custom/' . $type . '/' . $status . '/' . $providerName . '.twig'; - if (file_exists('messaging/' . $providerTemplate)) { - return $providerTemplate; + if (file_exists(TemplateFinder::getTemplatePath() . '/messaging/' . $providerTemplate)) { + return $providerTemplate; + } } $template = null; @@ -211,22 +213,6 @@ protected static function getTemplate($type, $status, ?Process $process = null) return $template; } - private static function slugify($text, string $divider = '_') - { - $text = preg_replace('~[^\pL\d]+~u', $divider, $text); - $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text); - $text = preg_replace('~[^-\w]+~', '', $text); - $text = trim($text, $divider); - $text = preg_replace('~-+~', $divider, $text); - $text = strtolower($text); - - if (empty($text)) { - return 'none'; - } - - return $text; - } - public static function getMailSubject( Process $process, Config $config,