Skip to content
This repository has been archived by the owner on Dec 23, 2019. It is now read-only.

Commit

Permalink
fix(easy-mini Pabx): fix tones management
Browse files Browse the repository at this point in the history
  • Loading branch information
Jisay committed Oct 23, 2017
1 parent e94d898 commit 6204a2d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ angular.module("managerApp").controller("TelecomTelephonyAliasConfigurationTones
tones: [
"None",
"Custom sound"
],
onHold: [
"None",
"Predefined 1",
"Predefined 2",
"Custom sound"
]
};

Expand Down Expand Up @@ -64,7 +58,8 @@ angular.module("managerApp").controller("TelecomTelephonyAliasConfigurationTones
};

self.hasChanges = function () {
return !angular.equals(self.tones, _.pick(self.formOptions, ["ringback", "onHold", "endCall"]));
var attrs = ["ringback", "onHold", "endCall"];
return !angular.equals(_.pick(self.tones, attrs), _.pick(self.formOptions, attrs));
};

self.isFormValid = function () {
Expand Down Expand Up @@ -120,7 +115,7 @@ angular.module("managerApp").controller("TelecomTelephonyAliasConfigurationTones
self.loaders.save = true;

["ringback", "onHold", "endCall"].forEach(function (toneType) {
if (_.get(self.formOptions, toneType) === "Custom sound") {
if (_.get(self.formOptions, toneType) === "Custom sound" && self.formOptions[toneType + "Custom"]) {
savePromises.push(uploadFile(toneType));
} else {
_.set(otherTypes, toneType, _.get(self.formOptions, toneType));
Expand All @@ -138,6 +133,7 @@ angular.module("managerApp").controller("TelecomTelephonyAliasConfigurationTones
return $q.all(savePromises).then(function () {
self.tones = angular.copy(_.pick(self.formOptions, ["ringback", "onHold", "endCall"]));
Toast.success($translate.instant("telephony_alias_configuration_tones_old_pabx_save_success"));
self.$onInit();
}).catch(function (error) {
Toast.error([$translate.instant("telephony_alias_configuration_tones_old_pabx_save_error"), _.get(error, "data.message")].join(" "));
return $q.reject(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ <h4 data-translate="loading"></h4>
class="form-control"
data-ng-disabled="$ctrl.loading.save"
data-ng-model="$ctrl.formOptions.onHold"
data-ng-options="type as ('telephony_alias_configuration_tones_old_pabx_type_' + (type | snakeCase) | translate) for type in $ctrl.enums.onHold"
data-ng-options="type as ('telephony_alias_configuration_tones_old_pabx_type_' + (type | snakeCase) | translate) for type in $ctrl.enums.tones"
required>
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ angular.module("managerApp").factory("VoipTimeCondition", function ($q, voipTime

// set timeout option for sip feature type and enable state
if (self.featureType === "sip") {
self.timeout = opts.timeout;
self.timeout = opts.timeout || 45;
self.enable = opts.status === "enabled";
} else {
self.enable = opts.enable || false;
Expand Down

0 comments on commit 6204a2d

Please sign in to comment.