Browse Source

Merge branch 'master' into 4.3

4.3
Joris Tirado 7 years ago
parent
commit
cdc47b6596
3 changed files with 84 additions and 49 deletions
  1. +2
    -1
      i18n/de-DE.json
  2. +1
    -1
      i18n/en-US.json
  3. +81
    -47
      submodules/users/users.js

+ 2
- 1
i18n/de-DE.json View File

@ -947,7 +947,8 @@
},
"confirmMessages": {
"deleteHoliday": "Dieser Feiertag wird dauerhaft gelöscht. Vorgang fortsetzen?",
"disableHolidays": "Alle vorhandenen Feiertage werden dauerhaft gelöscht. Vorgang fortsetzen?"
"disableHolidays": "Alle vorhandenen Feiertage werden dauerhaft gelöscht. Vorgang fortsetzen?",
"resetCalls": "Alle Strategien zur Verarbeitung eingehender Anrufe werden auf die Standardwerte zurückgesetzt. Fortfahren?"
},
"alertMessages": {
"uniqueHoliday": "Jeder Feiertag benötigt einen eindeutigen Namen.",


+ 1
- 1
i18n/en-US.json View File

@ -542,7 +542,7 @@
"nameHelp": "Type the User's First Name in the first input, and the User's Last Name in the second one",
"loginHelp": "This is the Username of this user, used to login to the application",
"vmboxHelp": "This is the Voicemail Box Number of this user, click on Change PIN to reset the PIN of the Voicemail box of this user",
"roleHelp": "The \"Admin\" will have rights to access the App Exchange and add apps to this accoutn, whereas the \"User\" will only be able to access the apps that are enabled for them",
"roleHelp": "The \"Admin\" will have rights to access the App Exchange and add apps to this account, whereas the \"User\" will only be able to access the apps that are enabled for them",
"languageHelp": "This will change the language of the text displayed in the UI",
"timezoneHelp": "This will set the Timezone used for this User's devices and Voicemail Box",
"ringingHelp": "This will set the Ringing Timeout for this User and his Devices. For example, if you set it to 20, this user will be rung for 20 seconds before the system moves to his Voicemail Box",


+ 81
- 47
submodules/users/users.js View File

@ -1665,22 +1665,26 @@ define(function(require) {
popup = args.popup;
template.find('.create_user').on('click', function() {
var action = $(this).data('action');
if (monster.ui.valid(template.find('#form_user_creation'))) {
var $buttons = template.find('.create_user'),
dataForm = _.merge(monster.ui.getFormData('form_user_creation'), {
user: {
device: {
family: template.find('#device_model').find(':selected').data('family')
}
if (!monster.ui.valid(template.find('#form_user_creation'))) {
return;
}
var action = $(this).data('action'),
$buttons = template.find('.create_user'),
dataForm = _.merge(monster.ui.getFormData('form_user_creation'), {
user: {
device: {
family: template.find('#device_model').find(':selected').data('family')
}
}),
formattedData = self.usersFormatCreationData(dataForm);
}
}),
formattedData = self.usersFormatCreationData(dataForm);
$buttons.prop('disabled', true);
$buttons.prop('disabled', true);
self.usersCreate(formattedData, function(data) {
self.usersCreate({
data: formattedData,
success: function(data) {
popup.dialog('close').remove();
switch (action) {
@ -1692,10 +1696,11 @@ define(function(require) {
self.usersRender({ userId: data.user.id });
break;
}
}, function() {
},
error: function() {
$buttons.prop('disabled', false);
});
}
}
});
});
template.find('#notification_email').on('change', function() {
@ -3898,8 +3903,16 @@ define(function(require) {
});
},
usersCreate: function(data, success, error) {
/**
* Creates an user, with all its related components
* @param {Object} args
* @param {Object} args.data User formatted data
* @param {Function} args.success Success callback
* @param {Function} args.error Error callback
*/
usersCreate: function(args) {
var self = this,
data = args.data,
deviceData = _.get(data, 'user.device');
delete data.user.device;
@ -3914,12 +3927,7 @@ define(function(require) {
data.user.id = _dataUser.id;
callback(null, _dataUser);
},
error: function(parsedError) {
if (parsedError.error === '402') {
error();
return;
}
error: function() {
callback(true);
},
onChargesCancelled: function() {
@ -3941,6 +3949,16 @@ define(function(require) {
success: function(_dataVM) {
data.callflow.flow.children._.data.id = _dataVM.id;
callback(null, _dataUser);
},
error: function() {
callback(true);
},
onChargesCancelled: function() {
// VMBox won't be created, so let's remove its data
data.extra.createVmbox = false;
delete data.vmbox;
delete data.callflow.flow.children._;
callback(null, _dataUser);
}
});
},
@ -3971,30 +3989,30 @@ define(function(require) {
}
deviceData.owner_id = _dataUser.id;
self.usersAddUserDevice({
data: deviceData,
data: {
data: deviceData
},
success: function(_device) {
callback(null);
},
error: function(parsedError) {
if (parsedError.error === '402') {
error();
return;
}
error: function() {
callback(true);
},
onChargesCancelled: function() {
// Allow to complete without errors, although the device won't be created
callback(null);
}
});
}
],
function(err) {
if (err) {
error();
args.error();
return;
}
success(data);
args.success(data);
});
},
@ -4193,21 +4211,31 @@ define(function(require) {
});
},
/**
* Creates a device for a user
* @param {Object} args
* @param {Object} args.data Data to be sent by the SDK to the API
* @param {Object} args.data.data Data provided for the device to be created
* @param {Function} [args.success] Success callback
* @param {Function} [args.error] Error callback
* @param {Function} [args.onChargesCancelled] Callback to be executed when charges are
* not accepted
*/
usersAddUserDevice: function(args) {
var self = this,
dataDevice = args.data;
var self = this;
self.callApi({
resource: 'device.create',
data: {
accountId: self.accountId,
data: dataDevice
data: _.merge({
accountId: self.accountId
}, args.data),
success: function(data) {
args.hasOwnProperty('success') && args.success(data.data);
},
success: function(device) {
args.hasOwnProperty('success') && args.success(device);
error: function(parsedError) {
args.hasOwnProperty('error') && args.error(parsedError);
},
error: function(error) {
args.hasOwnProperty('error') && args.error(error);
onChargesCancelled: function() {
args.hasOwnProperty('onChargesCancelled') && args.onChargesCancelled();
}
});
},
@ -4422,10 +4450,13 @@ define(function(require) {
/**
* Creates a Voicemail Box
* @param {Object} args
* @param {Object} args.data Data to be sent by the SDK to the API
* @param {Object} args.data.data Data provided for the Voicemail Box to be created
* @param {Function} args.success Success callback
* @param {Function} args.error Error callback
* @param {Object} args.data Data to be sent by the SDK to the API
* @param {Object} args.data.data Data provided for the Voicemail Box to be
* created
* @param {Function} [args.success] Success callback
* @param {Function} [args.error] Error callback
* @param {Function} [args.onChargesCancelled] Callback to be executed when charges are
* not accepted
*/
usersCreateVMBox: function(args) {
var self = this;
@ -4440,6 +4471,9 @@ define(function(require) {
},
error: function(parsedError) {
args.hasOwnProperty('error') && args.error(parsedError);
},
onChargesCancelled: function() {
args.hasOwnProperty('onChargesCancelled') && args.onChargesCancelled();
}
});
},


Loading…
Cancel
Save