diff options
-rw-r--r-- | program/include/rcube_user.inc | 9 | ||||
-rw-r--r-- | program/localization/de_DE/messages.inc | 2 | ||||
-rw-r--r-- | program/localization/en_GB/messages.inc | 2 | ||||
-rw-r--r-- | program/localization/en_US/messages.inc | 2 | ||||
-rw-r--r-- | program/steps/settings/delete_identity.inc | 7 |
5 files changed, 18 insertions, 4 deletions
diff --git a/program/include/rcube_user.inc b/program/include/rcube_user.inc index 841c84341..20c8dd827 100644 --- a/program/include/rcube_user.inc +++ b/program/include/rcube_user.inc @@ -241,6 +241,15 @@ class rcube_user if (!$this->ID) return false; + + $sql_result = $DB->query("SELECT count(*) AS ident_count FROM " . + get_table_name('identities') . + " WHERE user_id = ? AND del != 1", + $this->ID); + + $sql_arr = $DB->fetch_assoc($sql_result); + if ($sql_arr['ident_count'] <= 1) + return false; $DB->query( "UPDATE ".get_table_name('identities')." diff --git a/program/localization/de_DE/messages.inc b/program/localization/de_DE/messages.inc index d927b4b07..2ef66ac6b 100644 --- a/program/localization/de_DE/messages.inc +++ b/program/localization/de_DE/messages.inc @@ -76,5 +76,5 @@ $messages['errorsavingcontact'] = 'Die Änderungen konnten nicht gespeichert wer $messages['movingmessage'] = 'Die E-Mail wird verschoben...'; $messages['receiptsent'] = 'Bestätigung erfolgreich gesendet'; $messages['errorsendingreceipt'] = 'Bestätigung konnte nicht gesendet werden'; - +$messages['nodeletelastidentity'] = 'Sie koennen diesen Absender nicht loeschen.'; ?> diff --git a/program/localization/en_GB/messages.inc b/program/localization/en_GB/messages.inc index 599510871..20c0c14a3 100644 --- a/program/localization/en_GB/messages.inc +++ b/program/localization/en_GB/messages.inc @@ -74,5 +74,5 @@ $messages['copyerror'] = 'Could not copy any addresses'; $messages['sourceisreadonly'] = 'This address source is read-only'; $messages['errorsavingcontact'] = 'Could not save the contact address'; $messages['movingmessage'] = 'Moving message...'; - +$messages['nodeletelastidentity'] = 'You cannot delete this identity, it\'s your last one.'; ?>
\ No newline at end of file diff --git a/program/localization/en_US/messages.inc b/program/localization/en_US/messages.inc index 3576bf92f..5ee04d77c 100644 --- a/program/localization/en_US/messages.inc +++ b/program/localization/en_US/messages.inc @@ -76,5 +76,5 @@ $messages['errorsavingcontact'] = 'Could not save the contact address'; $messages['movingmessage'] = 'Moving message...'; $messages['receiptsent'] = 'Successfully sent a read receipt'; $messages['errorsendingreceipt'] = 'Could not send the receipt'; - +$messages['nodeletelastidentity'] = 'You cannot delete this identity, it\'s your last one.'; ?>
\ No newline at end of file diff --git a/program/steps/settings/delete_identity.inc b/program/steps/settings/delete_identity.inc index 06fdd94f4..a5f3d4445 100644 --- a/program/steps/settings/delete_identity.inc +++ b/program/steps/settings/delete_identity.inc @@ -23,8 +23,13 @@ if (($ids = get_input_value('_iid', RCUBE_INPUT_GET)) && preg_match('/^[0-9]+(,[ { if ($USER->delete_identity($ids)) + { $OUTPUT->show_message('deletedsuccessfully', 'confirmation'); - + } + else + { + $OUTPUT->show_message('nodeletelastidentity', 'error'); + } // send response if ($OUTPUT->ajax_call) $OUTPUT->send(); |