From 58845c1a32eb74ea2e5dd86b72e1f300fbeca8a5 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Wed, 1 Feb 2017 12:37:25 +0000
Subject: [PATCH] SSDM-4727 : Fix to avoid V3 API Bug until is fixed.

SVN: 37658
---
 .../SampleTable/SampleTableController.js      | 38 ++++++++++++-------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableController.js
index 76202417ca7..61f189ee67f 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableController.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableController.js
@@ -81,23 +81,33 @@ function SampleTableController(parentController, title, experimentIdentifier, pr
 					Util.showError("Please select at least one sample to delete!");
 				} else {
 					var warningText = "The next " + ELNDictionary.samples + " will be deleted: ";
-					var sampleTechIds = [];
+					
+					var sampleIdentifiers = [];
 					for(var sIdx = 0; sIdx < selected.length; sIdx++) {
-						sampleTechIds.push(selected[sIdx].id);
-						warningText += selected[sIdx].identifier + " ";
+						sampleIdentifiers.push(selected[sIdx].identifier);
 					}
 					
-					var modalView = new DeleteEntityController(function(reason) {
-						mainController.serverFacade.deleteSamples(sampleTechIds, reason, function(data) {
-							if(data.error) {
-								Util.showError(data.error.message);
-							} else {
-								Util.showSuccess("" + ELNDictionary.Sample + "/s Deleted");
-								mainController.refreshView();
-							}
-						});
-					}, true, warningText);
-					modalView.init();
+					Util.blockUI();
+					mainController.serverFacade.searchWithIdentifiers(sampleIdentifiers, function(selectedFinal) {
+						var sampleTechIds = [];
+						for(var sIdx = 0; sIdx < selectedFinal.length; sIdx++) {
+							sampleTechIds.push(selectedFinal[sIdx].id);
+							warningText += selectedFinal[sIdx].identifier + " ";
+						}
+						var modalView = new DeleteEntityController(function(reason) {
+							mainController.serverFacade.deleteSamples(sampleTechIds, reason, function(data) {
+								if(data.error) {
+									Util.showError(data.error.message);
+								} else {
+									Util.showSuccess("" + ELNDictionary.Sample + "/s Deleted");
+									mainController.refreshView();
+								}
+							});
+						}, true, warningText);
+						modalView.init();
+					});
+					
+					
 				}
 			}});
 			
-- 
GitLab