@@ -218,7 +218,8 @@ def prov_copy
218
218
)
219
219
220
220
if req . kind_of? ( ServiceTemplateProvisionRequest )
221
- @dialog_replace_data = req . options [ :dialog ] . map { |key , val | { :name => key . split ( 'dialog_' ) . last , :value => val } } . to_json
221
+ @dialog_replace_data = req . options [ :dialog ] . map { |key , val | { :name => key . split ( 'dialog_' ) . last , :value => parse_val ( key , val ) } } . to_json
222
+ # req.options[:dialog]["Array::dialog_param_test1"][1] =="\u001F"
222
223
@new_dialog = true
223
224
template = find_record_with_rbac ( ServiceTemplate , req . source_id )
224
225
resource_action = template . resource_actions . find { |r | r . action . downcase == 'provision' && r . dialog_id }
@@ -338,6 +339,38 @@ def menu_section_id(parms = {})
338
339
339
340
private
340
341
342
+ def parse_val ( key , val )
343
+ if val . kind_of? ( Integer ) # Handle integer values
344
+ if key . include? ( "Array::" ) # Handle multi select with integers
345
+ val = [ val ]
346
+ else # Handle single select with integers
347
+ return val
348
+ end
349
+ end
350
+
351
+ # TODO: Tag Control Field currently does not handle default values
352
+ if val . include? ( "Classification::" ) # Handle tag control default values
353
+ if val . include? ( "\u001F " ) # Array of tags
354
+ val = val . split ( "\u001F " )
355
+ tags = [ ]
356
+ val . each do |tag |
357
+ tags . push ( Classification . find_by ( :id => tag . split ( '::' ) . second ) . description )
358
+ end
359
+ val = tags
360
+ else # Single tag
361
+ val = Classification . find_by ( :id => val . split ( '::' ) . second ) . description
362
+ end
363
+ elsif key . include? ( "Array::" ) # Handle drop down with multi select default values
364
+ if val . kind_of? ( String ) && val . include? ( "\u001F " ) # Check if string is an array of values
365
+ val = val . split ( "\u001F " ) # Split the string into an array
366
+ else
367
+ val = [ val ] # Handle single string value
368
+ end
369
+ end
370
+
371
+ val # Handles all other conditions such as non-multi-select drop downs, text fields, etc.
372
+ end
373
+
341
374
def replace_gtl
342
375
render :update do |page |
343
376
page << javascript_prologue
0 commit comments