Skip to content
Snippets Groups Projects
Commit 06788ec7 authored by juanf's avatar juanf
Browse files

SSDM-4678 : Requests can only have one product

SVN: 38108
parent 63ee4012
No related branches found
No related tags found
No related merge requests found
......@@ -297,7 +297,8 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, {
"SAMPLE_PARENTS_HINT" : [{
"LABEL" : "Products",
"TYPE": "PRODUCT",
"MIN_COUNT" : 0,
"MIN_COUNT" : 1,
"MAX_COUNT" : 1,
"ANNOTATION_PROPERTIES" : [{"TYPE" : "QUANTITY_OF_ITEMS", "MANDATORY" : true }, {"TYPE" : "COMMENTS", "MANDATORY" : false }]
}]
},
......
......@@ -164,6 +164,24 @@ function SampleFormController(mainController, mode, sample) {
sample.parents = _this._sampleFormModel.sampleLinksParents.getSamples();
var continueSampleCreation = function(sample, newSampleParents, samplesToDelete) {
//
// TODO : Remove this hack without removing the New Producs Widget
//
if(sample.sampleTypeCode === "REQUEST") {
var maxProducts;
if(profile.sampleTypeDefinitionsExtension &&
profile.sampleTypeDefinitionsExtension["REQUEST"] &&
profile.sampleTypeDefinitionsExtension["REQUEST"]["SAMPLE_PARENTS_HINT"] &&
profile.sampleTypeDefinitionsExtension["REQUEST"]["SAMPLE_PARENTS_HINT"][0]) {
maxProducts = profile.sampleTypeDefinitionsExtension["REQUEST"]["SAMPLE_PARENTS_HINT"][0]["MAX_COUNT"];
}
if(maxProducts && (sampleParentsFinal.length + newSampleParents.length) > maxProducts) {
Util.showError("There is more than " + maxProducts + " product.");
return;
}
}
//
//Identification Info
//
......
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