Skip to content
Snippets Groups Projects
Commit 4b693fc2 authored by Juan Fuentes's avatar Juan Fuentes
Browse files

SSDM-9104 : Better validation on the add-hoc product creation on the request form

parent a2d560ed
No related branches found
No related tags found
No related merge requests found
...@@ -53,6 +53,19 @@ function NewProductsController() { ...@@ -53,6 +53,19 @@ function NewProductsController() {
"ANNOTATION.REQUEST.QUANTITY_OF_ITEMS" : $($($productProperties[5]).children()[0]).val() "ANNOTATION.REQUEST.QUANTITY_OF_ITEMS" : $($($productProperties[5]).children()[0]).val()
} }
} }
if(!newProduct.properties["$NAME"] && !newProduct.properties["$PRODUCT.CATALOG_NUM"]) {
Util.showError("Indicating a name or catalog number is mandatory for new products.");
return;
}
if(!newProduct.annotations["ANNOTATION.REQUEST.QUANTITY_OF_ITEMS"] ||
parseInt(newProduct.annotations["ANNOTATION.REQUEST.QUANTITY_OF_ITEMS"]) <= 0) {
Util.showError("Indicating the quantity of items is mandatory for new requests.");
return;
}
if(!newProduct.parentsIdentifiers[0]) {
Util.showError("Indicating the provider is mandatory for new products.");
return;
}
if(!newProduct.properties["$PRODUCT.CURRENCY"]) { if(!newProduct.properties["$PRODUCT.CURRENCY"]) {
delete newProduct.properties["$PRODUCT.CURRENCY"]; delete newProduct.properties["$PRODUCT.CURRENCY"];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment