From 35b113c03e9c1309dbb1206f804f74f56c0095d9 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Wed, 25 Jan 2017 12:12:23 +0000
Subject: [PATCH] SSDM-4187: hcs-dropbox.py using new getServerInformation
 method for creating correct sample identifier.

SVN: 37623
---
 .../4/dss/drop-boxes/hcs-dropbox/hcs-dropbox.py       | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/screening/source/core-plugins/screening/4/dss/drop-boxes/hcs-dropbox/hcs-dropbox.py b/screening/source/core-plugins/screening/4/dss/drop-boxes/hcs-dropbox/hcs-dropbox.py
index a123d5889b9..160060fa6c3 100644
--- a/screening/source/core-plugins/screening/4/dss/drop-boxes/hcs-dropbox/hcs-dropbox.py
+++ b/screening/source/core-plugins/screening/4/dss/drop-boxes/hcs-dropbox/hcs-dropbox.py
@@ -12,6 +12,7 @@ EXPERIMENT_ID = "/%(SPACE_CODE)s/%(PROJECT_CODE)s/%(EXPERIMENT_CODE)s" % vars()
 
 PLATE_CODE = "PLATE"
 PLATE_ID = "/%(SPACE_CODE)s/%(PLATE_CODE)s" % vars()
+PLATE_ID_WITH_PROJECT = "/%(SPACE_CODE)s/%(PROJECT_CODE)s/%(PLATE_CODE)s" % vars()
 PLATE_GEOMETRY_PROPERTY_CODE = "$PLATE_GEOMETRY"
 PLATE_GEOMETRY = "384_WELLS_16X24"
 
@@ -43,13 +44,17 @@ def create_experiment_if_needed(transaction):
     
 def create_plate_if_needed(transaction):
     """ Get the specified sample or register it if necessary """
+    if transaction.serverInformation['project-samples-enabled'] == 'true':
+        plate_id = PLATE_ID_WITH_PROJECT
+    else:
+        plate_id = PLATE_ID
 
-    samp = transaction.getSample(PLATE_ID)
+    samp = transaction.getSample(plate_id)
 
     if None == samp:
         exp = create_experiment_if_needed(transaction)
-        samp = transaction.createNewSample(PLATE_ID, 'PLATE')
-        transaction.getLogger().info('Creating new plate: ' + PLATE_ID)
+        samp = transaction.createNewSample(plate_id, 'PLATE')
+        transaction.getLogger().info('Creating new plate: ' + plate_id)
         samp.setPropertyValue(PLATE_GEOMETRY_PROPERTY_CODE, PLATE_GEOMETRY)
         samp.setExperiment(exp)
         
-- 
GitLab