Skip to content

Commit

Permalink
Revert "Feature 1711 custom mail templates"
Browse files Browse the repository at this point in the history
  • Loading branch information
manjencic authored Dec 12, 2023
1 parent a0df6c6 commit fa65df3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
2 changes: 0 additions & 2 deletions zmsdb/src/Zmsdb/Calldisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
27 changes: 2 additions & 25 deletions zmsentities/src/Zmsentities/Helper/Messaging.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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])) {
Expand All @@ -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,
Expand Down

0 comments on commit fa65df3

Please sign in to comment.