From a622de01595ece27e29ae0631eb0b88d987bd932 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Mon, 10 Jul 2017 11:13:33 +0000
Subject: [PATCH] SSDM-4032 : Force sample space

SVN: 38511
---
 .../html/js/views/SampleTable/SampleTableView.js         | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js
index 3a81f2e37d3..4224b5ad881 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js
@@ -202,8 +202,12 @@ function SampleTableView(sampleTableController, sampleTableModel) {
 	this.registerSamples = function(experimentIdentifier) {
 		var _this = this;
 		var allowedSampleTypes = null;
+		var forcedSpace = null;
 		if(this._sampleTableModel.sampleTypeCodeToUse) {
 			allowedSampleTypes = [this._sampleTableModel.sampleTypeCodeToUse, "STORAGE_POSITION"];
+			if(experimentIdentifier) {
+				forcedSpace = experimentIdentifier.split("/")[1];
+			}
 		}
 		var typeAndFileController = new TypeAndFileController('Register ' + ELNDictionary.Samples + '', "REGISTRATION", function(type, file) {
 			Util.blockUI();
@@ -227,6 +231,11 @@ function SampleTableView(sampleTableController, sampleTableModel) {
 					
 					if(infoData.result.identifiersPressent) {
 						mainController.serverFacade.registerSamples(typeAndFileController.getSampleTypeCode(), "sample-file-upload", null, finalCallback);
+					} else if(forcedSpace || typeAndFileController.getSampleTypeCode() === "STORAGE_POSITION") {
+						if(typeAndFileController.getSampleTypeCode() === "STORAGE_POSITION") {
+							forcedSpace = "STORAGE";
+						}
+						mainController.serverFacade.registerSamples(typeAndFileController.getSampleTypeCode(), "sample-file-upload", '/' + forcedSpace, finalCallback);
 					} else {
 						mainController.serverFacade.registerSamples(typeAndFileController.getSampleTypeCode(), "sample-file-upload", '/' + space, finalCallback);
 						
-- 
GitLab