Index: domain_source.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain_source/domain_source.module,v
retrieving revision 1.3
diff -u -p -r1.3 domain_source.module
--- domain_source.module	3 Feb 2008 19:34:57 -0000	1.3
+++ domain_source.module	11 Mar 2008 00:01:36 -0000
@@ -94,14 +94,15 @@ function domain_source_form_alter($form_
 function domain_source_nodeapi(&$node, $op, $a3, $a4) {
   switch ($op) {
     case 'validate':
-      $key = $node->domain_source;
-      if ($node->domain_site && $key == 0) {
+      // Cast the key from zero to -1 to match the data coming from the input.
+      ($node->domain_source == 0) ? $key = -1 : $key = $node->domain_source;
+      if ($node->domain_site && $key == -1) {
         // This case is acceptable, so we let it pass.
         // I find this code easier to read than a compound IF statement.
       }
       // Here we account for both the 'domains_raw' and 'domains' options.
-      // If selected, these calues will not be zero.
-      else if (!$node->domains[$key] && !$node->domains_raw[$key]) {
+      // If selected, these clauses will not be zero.
+      else if (!$node->domains[$key] && (!empty($node->domains_raw) && !in_array($key, $node->domains_raw))) {
         form_set_error('domain_source', t('The source affiliate must be selected as a publishing option.'));
       }
       break;
@@ -159,13 +160,16 @@ function domain_source_update_nodes($for
  */
 function domain_source_validate($form_id, $form_values) {
   if ($form_values['operation'] == 'domain') {
-    $source = $form_values['domain_source'];
-    if ($form_values['domain_site'] && $source == 0) {    
-      // This case is acceptable.  I find this code easier than a compound IF.
-    }
-    else if (!isset($source) || !$form_values['domains'][$source]) {
-      form_set_error('domain_source', t('The source domain must also be selected as an affiliate publishing option.'));
+    ($form_values['domain_source'] == 0) ? $key = -1 : $key = $form_values['domain_source'];
+    if ($form_values['domain_site'] && $key == -1) {
+      // This case is acceptable, so we let it pass.
+      // I find this code easier to read than a compound IF statement.
     }
+    // Here we account for both the 'domains_raw' and 'domains' options.
+    // If selected, these clauses will not be zero.
+    else if (!$form_values['domains'][$key] && (!empty($form_values['domains_raw']) && !in_array($key, $form_values['domains_raw']))) {
+      form_set_error('domain_source', t('The source affiliate must be selected as a publishing option.'));
+    }    
   }
 }
 
