Skip to content
Snippets Groups Projects
Commit 0ad1eca4 authored by Murtaza Sultani's avatar Murtaza Sultani Committed by Jan-Hendrik Willms
Browse files

Resolve "Besseres Betreffpräfix für E-Mails"

Closes #4529

Merge request studip/studip!3404
parent 93f10fdd
No related branches found
No related tags found
No related merge requests found
...@@ -47,10 +47,8 @@ class NewPasswordController extends StudipController ...@@ -47,10 +47,8 @@ class NewPasswordController extends StudipController
setTempLanguage($users[0]->id); setTempLanguage($users[0]->id);
// there are mutliple accounts with this mail addresses! // there are mutliple accounts with this mail addresses!
$subject = sprintf( $prefix = ltrim(Config::get()->MAIL_SUBJECT_PREFIX . ' ');
_("[Stud.IP - %s] Passwortänderung angefordert"), $subject = $prefix . _('Passwortänderung angefordert');
Config::get()->UNI_NAME_CLEAN
);
$mailbody = sprintf( $mailbody = sprintf(
_("Dies ist eine Informationsmail des Stud.IP-Systems\n" _("Dies ist eine Informationsmail des Stud.IP-Systems\n"
......
<?php
final class Tic4529 extends Migration
{
public function description()
{
return 'Delete MAIL_USE_SUBJECT_PREFIX and add MAIL_SUBJECT_PREFIX';
}
public function up()
{
$db = DBManager::get();
$MAIL_USE_SUBJECT_PREFIX = $db->fetchColumn("SELECT `value` FROM `config_values` WHERE `field` = ?", ["MAIL_USE_SUBJECT_PREFIX"]);
if (!$MAIL_USE_SUBJECT_PREFIX) {
$MAIL_USE_SUBJECT_PREFIX = $db->fetchColumn("SELECT `value` FROM `config` WHERE `field` = ?", ["MAIL_USE_SUBJECT_PREFIX"]);
}
$value = '';
if ($MAIL_USE_SUBJECT_PREFIX) {
$UNI_NAME_CLEAN = $db->fetchColumn("SELECT `value` FROM `config_values` WHERE `field` = ?", ["UNI_NAME_CLEAN"]);
$value = $UNI_NAME_CLEAN ? sprintf('[Stud.IP - %s]', $UNI_NAME_CLEAN) : '[Stud.IP]';
}
$db->execute(
"INSERT IGNORE INTO `config` VALUES (:field, :value, :type, :range, :section, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :desc)",
[
'field' => 'MAIL_SUBJECT_PREFIX',
'value' => $value,
'type' => 'string',
'range' => 'global',
'section' => 'global',
'desc' => 'Stellt dem Titel von per Mail versandten Nachrichten'
]
);
$db->execute(
"DELETE `config`, `config_values` FROM `config` LEFT JOIN `config_values` USING(`field`) WHERE `field` = ?",
["MAIL_USE_SUBJECT_PREFIX"]
);
}
public function down()
{
DBManager::get()->execute(
"DELETE `config`, `config_values` FROM `config` LEFT JOIN `config_values` USING(`field`) WHERE `field` = ?",
["MAIL_SUBJECT_PREFIX"]
);
DBManager::get()->execute(
"INSERT IGNORE INTO `config` VALUES (:field, :value, :type, :range, :section, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :desc)",
[
'field' => 'MAIL_USE_SUBJECT_PREFIX',
'value' => '0',
'type' => 'boolean',
'range' => 'global',
'section' => 'global',
'desc' => 'Stellt dem Titel von per Mail versandten Nachrichten den Wert von UNI_NAME_CLEAN voran.'
]
);
}
}
...@@ -688,10 +688,8 @@ class UserManagement ...@@ -688,10 +688,8 @@ class UserManagement
// new users alawys receive a link to generate a password // new users alawys receive a link to generate a password
if ($new) { if ($new) {
$subject = sprintf( $prefix = ltrim(Config::get()->MAIL_SUBJECT_PREFIX . ' ');
_("[Stud.IP - %s] Es wurde ein Zugang für sie erstellt - Setzen sie ein Passwort"), $subject = $prefix . _('Es wurde ein Zugang für sie erstellt - Setzen sie ein Passwort');
Config::get()->UNI_NAME_CLEAN
);
$mailbody = sprintf( $mailbody = sprintf(
_("Dies ist eine Bestätigungsmail des Stud.IP-Systems\n" _("Dies ist eine Bestätigungsmail des Stud.IP-Systems\n"
...@@ -719,10 +717,8 @@ class UserManagement ...@@ -719,10 +717,8 @@ class UserManagement
if ($user->auth_plugin !== 'standard') { if ($user->auth_plugin !== 'standard') {
// inform user, that their password cannot be reset via mail // inform user, that their password cannot be reset via mail
$subject = sprintf( $prefix = ltrim(Config::get()->MAIL_SUBJECT_PREFIX . ' ');
_("[Stud.IP - %s] Passwortänderung angefordert"), $subject = $prefix . _('Passwortänderung angefordert');
Config::get()->UNI_NAME_CLEAN
);
$mailbody = sprintf( $mailbody = sprintf(
_("Dies ist eine Informationsmail des Stud.IP-Systems\n" _("Dies ist eine Informationsmail des Stud.IP-Systems\n"
...@@ -739,10 +735,8 @@ class UserManagement ...@@ -739,10 +735,8 @@ class UserManagement
} else { } else {
$subject = sprintf( $prefix = ltrim(Config::get()->MAIL_SUBJECT_PREFIX . ' ');
_("[Stud.IP - %s] Neues Passwort setzen"), $subject = $prefix . _('Neues Passwort setzen');
Config::get()->UNI_NAME_CLEAN
);
$mailbody = sprintf( $mailbody = sprintf(
_("Dies ist eine Bestätigungsmail des Stud.IP-Systems\n" _("Dies ist eine Bestätigungsmail des Stud.IP-Systems\n"
...@@ -1307,10 +1301,8 @@ class UserManagement ...@@ -1307,10 +1301,8 @@ class UserManagement
// include language-specific subject and mailbody // include language-specific subject and mailbody
setTempLanguage($this->user_data['auth_user_md5.user_id']); setTempLanguage($this->user_data['auth_user_md5.user_id']);
$subject = sprintf( $prefix = ltrim(Config::get()->MAIL_SUBJECT_PREFIX . ' ');
_("[Stud.IP - %s] Passwortänderung"), $subject = $prefix . _('Passwortänderung');
Config::get()->UNI_NAME_CLEAN
);
$mailbody = sprintf( $mailbody = sprintf(
_("Dies ist eine Informationsmail des Stud.IP-Systems\n" _("Dies ist eine Informationsmail des Stud.IP-Systems\n"
......
...@@ -177,7 +177,7 @@ class messaging ...@@ -177,7 +177,7 @@ class messaging
setTempLanguage($rec_user_id); setTempLanguage($rec_user_id);
$title_prefix = Config::get()->MAIL_USE_SUBJECT_PREFIX ? '[Stud.IP - ' . Config::get()->UNI_NAME_CLEAN . '] ' : ''; $title_prefix = ltrim(Config::get()->MAIL_SUBJECT_PREFIX . ' ');;
$title = $title_prefix . kill_format(str_replace(["\r", "\n"], '', $subject)); $title = $title_prefix . kill_format(str_replace(["\r", "\n"], '', $subject));
if ($snd_user_id != "____%system%____") { if ($snd_user_id != "____%system%____") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment