diff --git a/i18n/en-US.json b/i18n/en-US.json index ec1360a..3a01ac7 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -425,7 +425,10 @@ "passwordReseted": "The password has been reset, an e-mail has been sent to {{ email }} with instructions on how to create a new password.", "userDelete": "You successfully deleted {{ name }} from the Smart PBX!", "userUpdated": "You successfully updated {{ name }} settings.", - "pinUpdated": "You successfully updated the PIN of {{ name }}." + "pinUpdated": "You successfully updated the PIN of {{ name }}.", + "__comment": "UI-1033: Now properly remove the Caller-ID Feature if we remove a number that was set as that Caller-ID Number", + "__version": "3.20", + "callerIDDeleted": "The Caller-ID Number of this user was set to a number that was no longer assigned to him, so we disabled the Caller-ID Feature." }, "uploadPicture": "Upload a Picture", "user": "User", diff --git a/i18n/fr-FR.json b/i18n/fr-FR.json index ef2a11b..433f963 100644 --- a/i18n/fr-FR.json +++ b/i18n/fr-FR.json @@ -400,7 +400,10 @@ "passwordReseted": "Le mot de passe a été réinitialisé, un email a été envoyé à {{email}} avec les instructions pour créer un nouveau mot de passe.", "userDelete": "Vous avez supprimé {{ name }} avec succès!", "userUpdated": "Vous avez mis à jour {{ name }} avec succès!", - "pinUpdated": "Vous avez mis à jour le PIN de {{ name }} avec succès!" + "pinUpdated": "Vous avez mis à jour le PIN de {{ name }} avec succès!", + "__comment": "UI-1033: Now properly remove the Caller-ID Feature if we remove a number that was set as that Caller-ID Number", + "__version": "3.20", + "callerIDDeleted": "Le Numéro de Caller-ID de cet utilisateur n'étant plus assigné, la fonctionnalité Caller-ID a été desactivée." }, "uploadPicture": "Uploader une image", "user": "Utilisateur", diff --git a/submodules/users/users.js b/submodules/users/users.js index e511b18..74960d8 100644 --- a/submodules/users/users.js +++ b/submodules/users/users.js @@ -1053,9 +1053,27 @@ define(function(require){ if(dataNumbers.length > 0) { self.usersUpdateCallflowNumbers(userId, (currentCallflow || {}).id, dataNumbers, function(callflowData) { - toastr.success(monster.template(self, '!' + toastrMessages.numbersUpdated, { name: name })); + var afterUpdate = function() { + toastr.success(monster.template(self, '!' + toastrMessages.numbersUpdated, { name: name })); + + self.usersRender({ userId: callflowData.owner_id }); + }; + + // If the User has the External Caller ID Number setup to a number that is no longer assigned to this user, then remove the Caller-ID Feature + if(currentUser.caller_id.hasOwnProperty('external') + && currentUser.caller_id.external.hasOwnProperty('number') + && callflowData.numbers.indexOf(currentUser.caller_id.external.number) < 0) { + delete currentUser.caller_id.external.number; - self.usersRender({ userId: callflowData.owner_id }); + self.usersUpdateUser(currentUser, function() { + afterUpdate(); + + toastr.info(toastrMessages.callerIDDeleted); + }); + } + else { + afterUpdate(); + } }); } else {