From fa65df3203eaca602255c35d5cbf0f403190d521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Manjen=C4=8Di=C4=87?= Date: Tue, 12 Dec 2023 14:24:27 +0100 Subject: [PATCH] Revert "Feature 1711 custom mail templates" --- zmsdb/src/Zmsdb/Calldisplay.php | 2 -- .../src/Zmsentities/Helper/Messaging.php | 27 ++----------------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/zmsdb/src/Zmsdb/Calldisplay.php b/zmsdb/src/Zmsdb/Calldisplay.php index 220efa74c..95e4bbe8b 100644 --- a/zmsdb/src/Zmsdb/Calldisplay.php +++ b/zmsdb/src/Zmsdb/Calldisplay.php @@ -85,8 +85,6 @@ public function readImage(Entity $entity) ->fetchOne((new Query\Calldisplay(Query\Base::SELECT)) ->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..35f6136ba 100644 --- a/zmsentities/src/Zmsentities/Helper/Messaging.php +++ b/zmsentities/src/Zmsentities/Helper/Messaging.php @@ -114,7 +114,7 @@ public static function getMailContent( $client = $mainProcess->getFirstClient(); } - $template = self::getTemplate('mail', $status, $mainProcess); + $template = self::getTemplate('mail', $status); if ($initiator) { $template = self::getTemplate('admin', $status); } @@ -193,15 +193,8 @@ public static function getNotificationContent(Process $process, Config $config, return $message; } - protected static function getTemplate($type, $status, ?Process $process = null) + protected static function getTemplate($type, $status) { - $providerName = $process->getCurrentScope()->getProvider()->getDisplayName(); - $providerTemplate = 'custom/' . $type . '/' . $status . '/' . (self::slugify($providerName)) . '.twig'; - - if (file_exists('messaging/' . $providerTemplate)) { - return $providerTemplate; - } - $template = null; if (Property::__keyExists($type, self::$templates)) { if (Property::__keyExists($status, self::$templates[$type])) { @@ -211,22 +204,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,