From b693b06d0d6ade3b09df7864eff592aca81d99fb Mon Sep 17 00:00:00 2001
From: felmer <franz-josef.elmer@id.ethz.ch>
Date: Thu, 3 Mar 2022 11:44:52 +0100
Subject: [PATCH] SSDM-12361: Search for templates drop-down modified such that
 any experiment with code that ends with TEMPLATES_COLLECTION in any project
 with code that ends with TEMPLATES is scanned

---
 .../eln-lims/html/js/server/ServerFacade.js      | 16 ++++++++++++++++
 .../html/js/views/SampleForm/SampleFormView.js   |  6 +++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js
index d4c8b759cf0..2a2527aaee7 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js
@@ -1732,6 +1732,9 @@ function ServerFacade(openbisServer) {
                                         case "thatContains":
                                                 criteria.withCode().thatContains(attributeValue);
                                                 break;
+                                        case "thatEndsWith":
+                                                criteria.withCode().thatEndsWith(attributeValue);
+                                                break;
                                     }
                                     break;
                                 case "IDENTIFIER":
@@ -1970,6 +1973,19 @@ function ServerFacade(openbisServer) {
                                         break;
                                 }
                                 break;
+                            case "Project":
+                                switch(fieldNameType) {
+                                case "PROP":
+                                    setPropertyCriteria(setOperator(searchCriteria.withProject(),advancedSearchCriteria.logicalOperator), fieldName, fieldValue, fieldOperator);
+                                    break;
+                                case "ATTR":
+                                    setAttributeCriteria(setOperator(searchCriteria.withProject(),advancedSearchCriteria.logicalOperator), fieldName, fieldValue, fieldOperator);
+                                    break;
+                                case "NULL":
+                                    searchCriteria.withoutProject();
+                                    break;
+                                }
+                                break;
                             case "Parent":
                                 switch(fieldNameType) {
                                     case "PROP":
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js
index 8498168a711..bd5d6fd0c09 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js
@@ -359,9 +359,9 @@ function SampleFormView(sampleFormController, sampleFormModel) {
                         entityKind : "SAMPLE",
                     	logicalOperator : "AND",
                         rules : {
-                            "1" : { type : "Experiment",  name : "ATTR.CODE", value : "TEMPLATES_COLLECTION" },
-                    	    "2" : { type : "Project",     name : "ATTR.CODE", value : "TEMPLATES" },
-                    	    "2" : { type : "Attribute",   name : "SAMPLE_TYPE", value : _this._sampleFormModel.sample.sampleTypeCode },
+                            "1" : { type : "Experiment",  name : "ATTR.CODE", operator : "thatEndsWith", value : "TEMPLATES_COLLECTION" },
+                            "2" : { type : "Project",     name : "ATTR.CODE", operator : "thatEndsWith", value : "TEMPLATES" },
+                            "3" : { type : "Attribute",   name : "SAMPLE_TYPE", value : _this._sampleFormModel.sample.sampleTypeCode },
                         }
                     }
 
-- 
GitLab