Invert conditions.

This commit is contained in:
Alexis Lahouze 2016-10-12 19:59:09 +02:00
parent 606cde59f8
commit 5811541722
3 changed files with 9 additions and 9 deletions

View File

@ -110,11 +110,11 @@ angular.module('accountant.accounts', [
* Cancel account edition. Remove it from array if a new one. * Cancel account edition. Remove it from array if a new one.
*/ */
$scope.cancelEdit = function(rowform, account, $index) { $scope.cancelEdit = function(rowform, account, $index) {
if (!account.id) { if (account.id) {
rowform.$cancel();
} else {
// Account not saved, just remove it from array. // Account not saved, just remove it from array.
$scope.accounts.splice($index, 1); $scope.accounts.splice($index, 1);
} else {
rowform.$cancel();
} }
}; };

View File

@ -391,10 +391,10 @@ angular.module('accountant.operations', [
* Cancel edition. * Cancel edition.
*/ */
$scope.cancelEdit = function(operation, rowform, $index) { $scope.cancelEdit = function(operation, rowform, $index) {
if (!operation.id) { if (operation.id) {
$scope.operations.splice($index, 1);
} else {
rowform.$cancel(); rowform.$cancel();
} else {
$scope.operations.splice($index, 1);
} }
}; };

View File

@ -89,10 +89,10 @@ angular.module('accountant.scheduler', [
* Cancel operation edition. Delete if new. * Cancel operation edition. Delete if new.
*/ */
$scope.cancelEdit = function(operation, rowform, $index) { $scope.cancelEdit = function(operation, rowform, $index) {
if (!operation.id) { if (operation.id) {
$scope.operations.splice($index, 1);
} else {
rowform.$cancel(); rowform.$cancel();
} else {
$scope.operations.splice($index, 1);
} }
}; };