File tree Expand file tree Collapse file tree 4 files changed +20
-0
lines changed Expand file tree Collapse file tree 4 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ module Validations
12
12
validate :valid_rank_for_ranked_relations
13
13
validate :unique_pref_labels
14
14
validate :exclusive_pref_and_alt_labels_per_concept
15
+ validate :exclusive_hidden_labels_per_concept
15
16
validate :unique_alt_labels
16
17
validate :exclusive_broader_and_narrower_concepts
17
18
validate :no_self_reference_concept_relation
@@ -101,6 +102,19 @@ def exclusive_pref_and_alt_labels_per_concept
101
102
end
102
103
end
103
104
105
+ def exclusive_hidden_labels_per_concept
106
+ if self . validatable_for_publishing?
107
+ relevant_labels = self . labelings . reject { |lbl | lbl . is_a? ( Iqvoc ::Concept . hidden_labeling_class ) } . collect ( &:target )
108
+
109
+ self . hidden_labels . each do |hidden_label |
110
+ if relevant_labels . include? hidden_label
111
+ errors . add :base , I18n . t ( 'txt.models.concept.hidden_label_defined_in_other_labels' , label : hidden_label . value )
112
+ end
113
+ end
114
+
115
+ end
116
+ end
117
+
104
118
def unique_alt_labels
105
119
if validatable_for_publishing?
106
120
alt_labels = alt_labelings . collect { |l | l . target }
Original file line number Diff line number Diff line change 461
461
pref_label_not_unique : " Das PrefLabel %{label} ist bereits in Verwendung."
462
462
pref_labels_not_unique : " Die PrefLabels %{label} sind bereits in Verwendung."
463
463
pref_label_defined_in_alt_labels : " Das AltLabel %{label} wird bereits als PrefLabel verwendet."
464
+ hidden_label_defined_in_other_labels : " Das HiddenLabel %{label} wird bereits als Pref- oder AltLabel verwendet."
464
465
alt_labels_not_unique : " Das AltLabel %{label} wird zweimal als AltLabel verwendet."
465
466
collection :
466
467
uri : " Kollektion-URI"
Original file line number Diff line number Diff line change 471
471
pref_label_not_unique : " The preferred label '%{label}' is already in use."
472
472
pref_labels_not_unique : " The preferred labels '%{label}' are already in use."
473
473
pref_label_defined_in_alt_labels : " The alternative label %{label} is already used as a preferred label."
474
+ hidden_label_defined_in_other_labels : " The hidden label %{label} is already used as a preferred or alternative label."
474
475
alt_labels_not_unique : " The alternative label %{label} is used twice."
475
476
collection :
476
477
uri : " Collection URI"
Original file line number Diff line number Diff line change @@ -83,6 +83,10 @@ def alt_labeling_class
83
83
alt_labeling_class_name . constantize
84
84
end
85
85
86
+ def hidden_labeling_class
87
+ hidden_labeling_class_name . constantize
88
+ end
89
+
86
90
def labeling_class_names
87
91
{ pref_labeling_class_name => pref_labeling_languages } . merge ( further_labeling_class_names )
88
92
end
You can’t perform that action at this time.
0 commit comments