From a7a91bd3a3f0821f4b37a419b72a9ef17a825eff Mon Sep 17 00:00:00 2001
From: felmer <franz-josef.elmer@id.ethz.ch>
Date: Sun, 18 Jun 2023 15:32:37 +0200
Subject: [PATCH] SSDM-12531: Contain type codes in the template file name only
 if there are not more tham two

---
 .../eln-lims/html/js/views/SampleTable/widgets/BatchView.js    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/widgets/BatchView.js b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/widgets/BatchView.js
index bcd3cdf4c69..ea45af96175 100644
--- a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/widgets/BatchView.js
+++ b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/widgets/BatchView.js
@@ -62,7 +62,8 @@ function BatchView(controller, model) {
             var templateType = _this._model.allowSampleTypeSelection ? "GENERAL" : "COLLECTION";
             mainController.serverFacade.getSamplesImportTemplate(allowedSampleTypes, templateType, importMode, function(result) {
                 var mimeType = "application/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
-                var filename = "SAMPLE-" + templateType + "-" + importMode + "-" + allowedSampleTypes.join("-") + "-template.xlsx";
+                var joinedTypes = allowedSampleTypes.length <= 2 ? "-" + allowedSampleTypes.join("-") : "";
+                var filename = "SAMPLE-" + templateType + "-" + importMode + joinedTypes + "-template.xlsx";
                 Util.download(result, mimeType, true, filename);
             });
         });
-- 
GitLab