Project

General

Profile

Revision 8d02775b

Added by Assos Assos about 4 years ago

Weekly update of contrib modules

View differences:

drupal7/sites/all/modules/webform/includes/webform.conditionals.inc
233 233
        }
234 234
      }
235 235
      foreach ($conditional['rules'] as $rule_key => $rule) {
236
        if (!is_numeric($rule_key)) {
237
          continue;
238
        }
239
        $source_cid = isset($rule['source']['#value']) ? $rule['source']['#value'] : NULL;
236 240
        // Validate component rules, but not conditional_start/end rules.
237
        if (is_numeric($rule_key) && $rule['source_type']['#value'] == 'component' && isset($targets[$rule['source']['#value']])) {
241
        if ($source_cid && $rule['source_type']['#value'] == 'component' && isset($targets[$source_cid])) {
238 242
          form_set_error('conditionals][' . $conditional_key . '][rules][' . $rule_key . '][source',
239 243
            t('The subject of the conditional cannot be the same as the component that is changed (%target).',
240
            array('%target' => $components[$rule['source']['#value']]['name'])));
244
            array('%target' => $components[$source_cid]['name'])));
245
        }
246
        if ($source_cid && $components[$source_cid]['type'] === 'date' && strtotime($rule['value']['#value']) === FALSE) {
247
          form_set_error('conditionals][' . $conditional_key . '][rules][' . $rule_key . '][value', t('The conditional comparison value must be a valid date.'));
241 248
        }
242 249
      }
243 250
    }

Also available in: Unified diff