From 91b799fb8912659a712f5699c20c2fd38f02b934 Mon Sep 17 00:00:00 2001
From: Stefan Borchert <stefan.borchert@undpaul.de>
Date: Sun, 31 Jul 2011 16:56:43 +0200
Subject: [PATCH] Issue #1190482: Selecting multiple webforms in rules condition.

---
 webform_rules.rules.inc |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/webform_rules.rules.inc b/webform_rules.rules.inc
index abe22a0..ebab45e 100644
--- a/webform_rules.rules.inc
+++ b/webform_rules.rules.inc
@@ -32,8 +32,14 @@ function webform_rules_rules_condition_info() {
     'webform_rules_condition_webform_id' => array(
       'label' => t('Select a webform'),
       'arguments' => array(
-        'form_id' => array('type' => 'value', 'label' => t('The form id of the submitted form')),
-        'selected_webform' => array('label' => t('Webform'), 'type' => 'string'),
+        'form_id' => array(
+          'type' => 'value', 
+          'label' => t('The form id of the submitted form'),
+        ),
+        'selected_webform' => array(
+          'type' => 'string',
+          'label' => t('Webform'), 
+        ),
       ),
       'help' => t('This condition just compares two texts. It returns TRUE, if both texts are equal.'),
       'module' => 'Webform',
@@ -63,7 +69,7 @@ function webform_rules_data_type_info() {
  * form.
  */
 function webform_rules_condition_webform_id($form_id, $selected_webform) {
-  return $form_id == $selected_webform;
+  return isset($selected_webform[$form_id]);
 }
 
 /**
@@ -80,6 +86,7 @@ function webform_rules_condition_webform_id_form($settings, &$form) {
     '#type' => 'select',
     '#title' => t('Webform'),
     '#options' => $options,
+    '#multiple' => TRUE,
     '#default_value' => isset($settings['selected_webform']) ? $settings['selected_webform'] : '',
     '#required' => TRUE,
   );
-- 
1.7.4

