glexchange 4.18.1 → 4.18.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/glexchange.rb +37 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a403a30d88812d456f7bc93ca205df9a6eb36713
4
- data.tar.gz: bb7b469d5b6766a767154c299bdd506db4a24132
3
+ metadata.gz: 6f1bc70a6bd32c406bb7d2d0ac0a67c7fe6953be
4
+ data.tar.gz: 301c369520979c3afbd211b5d50fdc59e154faf3
5
5
  SHA512:
6
- metadata.gz: b9d0e8f7d24de6f80ebbbd52ea0083d2478d433f1132dfad449bb5bdde77ce2b2eb87b9f92de5695a80776ad7c1a12119114a2cc6616d841698f156cd3650363
7
- data.tar.gz: 0feb41fd559e0c47798f73b9849bf9b5bef65ecbfb6d9fed48f6036418fd35dd6ba54e6c3f92e0174c8f5e93881a2e1f907242b40cea285e1ffe1e7c2b79769d
6
+ metadata.gz: 26b6cd39236411aa868b8feec61c480745f3a8aa5d11d20f2b4c9e63537a6377de8f6ad72132b1bac30e26a258367c6eeee37e27bf4d4ec0a7e1a5aec9d829f0
7
+ data.tar.gz: afdf91f95912d7afac4684fee66761f526a783174b3f78f6e3ad87625926093e7b0f104b221250c1fba026e44af0a0c487c32d4f50a3f5b25b3d4e3fa466f728
data/lib/glexchange.rb CHANGED
@@ -509,13 +509,13 @@ private
509
509
  end
510
510
  end
511
511
 
512
- if submission.project.customAttributes != nil
512
+ if submission.project.customAttributes != nil && submission.project.customAttributes.length > 0
513
513
  for projectCustomAttribute in submission.project.customAttributes
514
514
  if projectCustomAttribute.mandatory
515
515
  isSet = false
516
516
  if submission.customAttributes !=nil
517
- for submissionCustomAttribute in submission.customAttributes
518
- if submissionCustomAttribute.name == projectCustomAttribute.name
517
+ for key in submission.customAttributes.keys
518
+ if key == projectCustomAttribute.name
519
519
  isSet = true
520
520
  break
521
521
  end
@@ -526,6 +526,36 @@ private
526
526
  end
527
527
  end
528
528
  end
529
+ if submission.customAttributes !=nil && submission.customAttributes.length > 0
530
+ for key in submission.customAttributes.keys
531
+ isExists = false
532
+ for projectCustomAttribute in submission.project.customAttributes
533
+ if key == projectCustomAttribute.name
534
+ isExists = true
535
+ if projectCustomAttribute.type=="COMBO" && projectCustomAttribute.values != nil
536
+ comboValueCorrect = false
537
+ va = projectCustomAttribute.values.split(',')
538
+ for option in va
539
+ if option == submission.customAttributes[key]
540
+ comboValueCorrect = true
541
+ break
542
+ end
543
+ end
544
+ if comboValueCorrect == false
545
+ raise "Value '#{submission.customAttributes[key]}' for custom field '#{key}' is not allowed. Allowed values:#{projectCustomAttribute.values}"
546
+ end
547
+ end
548
+ end
549
+ end
550
+ if isExists == false
551
+ raise "Custom field '#{key}' is not allowed in project"
552
+ end
553
+ end
554
+ end
555
+ else
556
+ if submission.customAttributes !=nil && submission.customAttributes.length > 0
557
+ raise "Project doesn't have custom attributes"
558
+ end
529
559
  end
530
560
  end
531
561
 
@@ -562,7 +592,10 @@ private
562
592
  @workflowService = addHeaders(Glexchange::Pdws::WorkflowServicePortType.new(@connectionConfig.url + "/services/WorkflowService_4180"))
563
593
 
564
594
  begin
565
- @projectService.getUserProjects(Glexchange::Pdws::GetUserProjects.new(true))
595
+ projects = @projectService.getUserProjects(Glexchange::Pdws::GetUserProjects.new(true))
596
+ if projects!=nil and projects.length==1 and projects[0]==nil
597
+ raise "Projects is nil"
598
+ end
566
599
  rescue Exception
567
600
  throw "Invalid config. " + $!.to_s
568
601
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glexchange
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.18.1
4
+ version: 4.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - translations.com