issue #113: only send test sms if user has a mobile no

This commit is contained in:
Pepijn Over 2014-07-28 09:46:48 +02:00
parent 5ba71af367
commit b45c93f254
13 changed files with 21 additions and 5 deletions

View File

@ -225,6 +225,7 @@ $sm_lang = array(
'email_error' => 'Възникна грешка при изпращането на тесовия имейл',
'sms_sent' => 'Тестовото SMS съобщение е изпратеното успешно.',
'sms_error' => 'Възникна грешка при изпращането на тестовия SMS',
'sms_error_nomobile' => 'Unable to send test SMS: no valid phone number found in your profile.',
),
// За нов ред в имейл съобщението, моля използвайте тага <br/>
'notifications' => array(

View File

@ -225,6 +225,7 @@ $sm_lang = array(
'email_error' => 'Fejl ved afsendelse af email',
'sms_sent' => 'Sms sendt',
'sms_error' => 'Fejl ved afsendelse af SMS',
'sms_error_nomobile' => 'Unable to send test SMS: no valid phone number found in your profile.',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -225,6 +225,7 @@ $sm_lang = array(
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
'sms_error_nomobile' => 'Unable to send test SMS: no valid phone number found in your profile.',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -225,6 +225,7 @@ $sm_lang = array(
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
'sms_error_nomobile' => 'Unable to send test SMS: no valid phone number found in your profile.',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -223,6 +223,7 @@ $sm_lang = array(
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
'sms_error_nomobile' => 'Unable to send test SMS: no valid phone number found in your profile.',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -224,6 +224,7 @@ $sm_lang = array(
'email_error' => 'Erreur lors de l\'envoie de l\'email',
'sms_sent' => 'Sms envoyé',
'sms_error' => 'Erreur lors de l\'envoie du sms',
'sms_error_nomobile' => 'Unable to send test SMS: no valid phone number found in your profile.',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -223,6 +223,7 @@ $sm_lang = array(
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
'sms_error_nomobile' => 'Unable to send test SMS: no valid phone number found in your profile.',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -223,6 +223,7 @@ $sm_lang = array(
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
'sms_error_nomobile' => 'Unable to send test SMS: no valid phone number found in your profile.',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -200,7 +200,7 @@ $sm_lang = array(
'log_email' => 'Log emails verstuurd bij het script?',
'log_sms' => 'Log sms berichten verstuurd bij het script?',
'updated' => 'De configuratie is gewijzigd.',
'nochanges' => 'The configuration didn\'t change.',
'nochanges' => 'De configuratie is ongewijzigd.',
'tab_email' => 'Email',
'tab_sms' => 'SMS',
'tab_log' => 'Log',
@ -224,6 +224,7 @@ $sm_lang = array(
'email_error' => 'Er is een fout opgetreden tijdens het verzenden',
'sms_sent' => 'SMS verzonden',
'sms_error' => 'Er is een fout opgetreden tijdens het verzenden',
'sms_error_nomobile' => 'Kan test SMS niet verzenden: er is geen telefoonnummer ingevuld in je profiel.',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -225,6 +225,7 @@ $sm_lang = array(
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
'sms_error_nomobile' => 'Unable to send test SMS: no valid phone number found in your profile.',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -225,6 +225,7 @@ $sm_lang = array(
'email_error' => 'Ошибка при отправке email',
'sms_sent' => 'Sms отправлено',
'sms_error' => 'Ошибка при отправке sms',
'sms_error_nomobile' => 'Unable to send test SMS: no valid phone number found in your profile.',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -224,6 +224,7 @@ $sm_lang = array(
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
'sms_error_nomobile' => 'Unable to send test SMS: no valid phone number found in your profile.',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -210,11 +210,15 @@ class ConfigController extends AbstractController {
$sms = psm_build_sms();
if($sms) {
$user = $this->user->getUser();
$sms->addRecipients($user->mobile);
if($sms->sendSMS(psm_get_lang('config', 'test_message'))) {
$this->addMessage(psm_get_lang('config', 'sms_sent'), 'success');
if(empty($user->mobile)) {
$this->addMessage(psm_get_lang('config', 'sms_error_nomobile'), 'error');
} else {
$this->addMessage(psm_get_lang('config', 'sms_error'), 'error');
$sms->addRecipients($user->mobile);
if($sms->sendSMS(psm_get_lang('config', 'test_message'))) {
$this->addMessage(psm_get_lang('config', 'sms_sent'), 'success');
} else {
$this->addMessage(psm_get_lang('config', 'sms_error'), 'error');
}
}
}
}