added validation for area of shopfloor, space, store and tenant in API
parent
b9c8352b00
commit
32256396ac
|
@ -122,7 +122,7 @@ app.controller('RuleController', function($scope, $uibModal, $translate, RuleSer
|
|||
toaster.pop({
|
||||
type: "success",
|
||||
title: $translate.instant("TOASTER.SUCCESS_TITLE"),
|
||||
body: $translate.instant(popBody, {template: $translate.instant("FDD.RULE")}),
|
||||
body: $translate.instant("TOASTER.SUCCESS_DELETE_BODY", { template: $translate.instant("FDD.RULE") }),
|
||||
showCloseButton: true,
|
||||
});
|
||||
$scope.getAllRules();
|
||||
|
|
|
@ -160,7 +160,7 @@ app.controller('CombinedEquipmentParameterController', function ($scope, $uibMod
|
|||
} else {
|
||||
toaster.pop({
|
||||
type: "error",
|
||||
title: $translate.instant(popBody, { template: $translate.instant("COMBINED_EQUIPMENT.PARAMETER") }),
|
||||
title: $translate.instant("TOASTER.ERROR_DELETE_BODY", { template: $translate.instant("COMBINED_EQUIPMENT.PARAMETER") }),
|
||||
body: $translate.instant(response.data.description),
|
||||
showCloseButton: true,
|
||||
});
|
||||
|
|
|
@ -76,7 +76,7 @@ app.controller('ShopfloorController', function ($scope, $translate, $uibModal, C
|
|||
});
|
||||
};
|
||||
|
||||
$scope.editShopfloor = function (shopfloor) {
|
||||
$scope.editShopfloor = function(shopfloor) {
|
||||
var modalInstance = $uibModal.open({
|
||||
windowClass: "animated fadeIn",
|
||||
templateUrl: 'views/settings/shopfloor/shopfloor.model.html',
|
||||
|
@ -92,7 +92,8 @@ app.controller('ShopfloorController', function ($scope, $translate, $uibModal, C
|
|||
}
|
||||
});
|
||||
|
||||
modalInstance.result.then(function (modifiedShopfloor) {
|
||||
modalInstance.result.then(function(modifiedShopfloor) {
|
||||
console.log(modifiedShopfloor);
|
||||
modifiedShopfloor.cost_center_id = modifiedShopfloor.cost_center.id;
|
||||
modifiedShopfloor.contact_id = modifiedShopfloor.contact.id;
|
||||
if (angular.isDefined(shopfloor.is_input_counted) == false) {
|
||||
|
@ -185,7 +186,7 @@ app.controller('ModalEditShopfloorCtrl', function ($scope, $uibModalInstance, pa
|
|||
$scope.contacts = params.contacts;
|
||||
|
||||
$scope.ok = function () {
|
||||
$uibModalInstance.close($scope.tenant);
|
||||
$uibModalInstance.close($scope.shopfloor);
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
|
|
|
@ -76,7 +76,7 @@ $scope.getAllStoreTypes = function() {
|
|||
} else {
|
||||
toaster.pop({
|
||||
type: "error",
|
||||
title: $translate.instant(popBody,{"TOASTER.ERROR_ADD_BODY": $translate.instant("COMMON.STORE")}),
|
||||
title: $translate.instant("TOASTER.ERROR_ADD_BODY", { template: $translate.instant("COMMON.STORE") }),
|
||||
body: $translate.instant(response.data.description),
|
||||
showCloseButton: true,
|
||||
});
|
||||
|
@ -105,7 +105,7 @@ $scope.getAllStoreTypes = function() {
|
|||
});
|
||||
|
||||
modalInstance.result.then(function(modifiedStore) {
|
||||
modifiedStore.store_type_id=modifiedStore.store_type.id;
|
||||
modifiedStore.store_type_id=modifiedStore.store_type.id;
|
||||
modifiedStore.cost_center_id=modifiedStore.cost_center.id;
|
||||
modifiedStore.contact_id=modifiedStore.contact.id;
|
||||
if (angular.isDefined(store.is_input_counted) == false) {
|
||||
|
|
|
@ -111,7 +111,7 @@ app.controller('StoreMeterController', function($scope,$timeout, $translate,
|
|||
toaster.pop({
|
||||
type: "success",
|
||||
title: $translate.instant("TOASTER.SUCCESS_TITLE"),
|
||||
body: $translate.instant(popBody),
|
||||
body: $translate.instant("TOASTER.BIND_METER_SUCCESS"),
|
||||
showCloseButton: true,
|
||||
});
|
||||
$scope.getMetersByStoreID($scope.currentStore.id);
|
||||
|
|
|
@ -104,7 +104,8 @@ class ShopfloorCollection:
|
|||
|
||||
if 'area' not in new_values['data'].keys() or \
|
||||
not (isinstance(new_values['data']['area'], float) or
|
||||
isinstance(new_values['data']['area'], int)):
|
||||
isinstance(new_values['data']['area'], int)) or \
|
||||
new_values['data']['area'] <= 0.0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_AREA_VALUE')
|
||||
area = new_values['data']['area']
|
||||
|
@ -419,7 +420,8 @@ class ShopfloorItem:
|
|||
|
||||
if 'area' not in new_values['data'].keys() or \
|
||||
not (isinstance(new_values['data']['area'], float) or
|
||||
isinstance(new_values['data']['area'], int)):
|
||||
isinstance(new_values['data']['area'], int)) or \
|
||||
new_values['data']['area'] <= 0.0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_AREA_VALUE')
|
||||
area = new_values['data']['area']
|
||||
|
|
|
@ -131,7 +131,8 @@ class SpaceCollection:
|
|||
|
||||
if 'area' not in new_values['data'].keys() or \
|
||||
not (isinstance(new_values['data']['area'], float) or
|
||||
isinstance(new_values['data']['area'], int)):
|
||||
isinstance(new_values['data']['area'], int)) or \
|
||||
new_values['data']['area'] <= 0.0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_AREA_VALUE')
|
||||
area = new_values['data']['area']
|
||||
|
@ -549,7 +550,8 @@ class SpaceItem:
|
|||
|
||||
if 'area' not in new_values['data'].keys() or \
|
||||
not (isinstance(new_values['data']['area'], float) or
|
||||
isinstance(new_values['data']['area'], int)):
|
||||
isinstance(new_values['data']['area'], int)) or \
|
||||
new_values['data']['area'] <= 0.0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_AREA_VALUE')
|
||||
area = new_values['data']['area']
|
||||
|
|
|
@ -117,21 +117,26 @@ class StoreCollection:
|
|||
|
||||
if 'latitude' not in new_values['data'].keys() or \
|
||||
not (isinstance(new_values['data']['latitude'], float) or
|
||||
isinstance(new_values['data']['latitude'], int)):
|
||||
isinstance(new_values['data']['latitude'], int)) or \
|
||||
new_values['data']['latitude'] < -90.0 or \
|
||||
new_values['data']['latitude'] > 90.0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_LATITUDE_VALUE')
|
||||
latitude = new_values['data']['latitude']
|
||||
|
||||
if 'longitude' not in new_values['data'].keys() or \
|
||||
not (isinstance(new_values['data']['longitude'], float) or
|
||||
isinstance(new_values['data']['longitude'], int)):
|
||||
isinstance(new_values['data']['longitude'], int)) or \
|
||||
new_values['data']['longitude'] < -180.0 or \
|
||||
new_values['data']['longitude'] > 180.0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_LONGITUDE_VALUE')
|
||||
longitude = new_values['data']['longitude']
|
||||
|
||||
if 'area' not in new_values['data'].keys() or \
|
||||
not (isinstance(new_values['data']['area'], float) or
|
||||
isinstance(new_values['data']['area'], int)):
|
||||
isinstance(new_values['data']['area'], int)) or \
|
||||
new_values['data']['area'] <= 0.0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_AREA_VALUE')
|
||||
area = new_values['data']['area']
|
||||
|
@ -462,21 +467,26 @@ class StoreItem:
|
|||
|
||||
if 'latitude' not in new_values['data'].keys() or \
|
||||
not (isinstance(new_values['data']['latitude'], float) or
|
||||
isinstance(new_values['data']['latitude'], int)):
|
||||
isinstance(new_values['data']['latitude'], int)) or \
|
||||
new_values['data']['latitude'] < -90.0 or \
|
||||
new_values['data']['latitude'] > 90.0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_LATITUDE_VALUE')
|
||||
latitude = new_values['data']['area']
|
||||
latitude = new_values['data']['latitude']
|
||||
|
||||
if 'longitude' not in new_values['data'].keys() or \
|
||||
not (isinstance(new_values['data']['longitude'], float) or
|
||||
isinstance(new_values['data']['longitude'], int)):
|
||||
isinstance(new_values['data']['longitude'], int)) or \
|
||||
new_values['data']['longitude'] < -180.0 or \
|
||||
new_values['data']['longitude'] > 180.0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_LONGITUDE_VALUE')
|
||||
longitude = new_values['data']['longitude']
|
||||
|
||||
if 'area' not in new_values['data'].keys() or \
|
||||
not (isinstance(new_values['data']['area'], float) or
|
||||
isinstance(new_values['data']['area'], int)):
|
||||
isinstance(new_values['data']['area'], int)) or \
|
||||
new_values['data']['area'] <= 0.0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_AREA_VALUE')
|
||||
area = new_values['data']['area']
|
||||
|
|
|
@ -148,7 +148,8 @@ class TenantCollection:
|
|||
|
||||
if 'area' not in new_values['data'].keys() or \
|
||||
not (isinstance(new_values['data']['area'], float) or
|
||||
isinstance(new_values['data']['area'], int)):
|
||||
isinstance(new_values['data']['area'], int)) or \
|
||||
new_values['data']['area'] <= 0.0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_AREA_VALUE')
|
||||
area = new_values['data']['area']
|
||||
|
@ -547,7 +548,8 @@ class TenantItem:
|
|||
|
||||
if 'area' not in new_values['data'].keys() or \
|
||||
not (isinstance(new_values['data']['area'], float) or
|
||||
isinstance(new_values['data']['area'], int)):
|
||||
isinstance(new_values['data']['area'], int)) or \
|
||||
new_values['data']['area'] <= 0.0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_AREA_VALUE')
|
||||
area = new_values['data']['area']
|
||||
|
|
Loading…
Reference in New Issue