### Eclipse Workspace Patch 1.0
#P Date
Index: date_api_elements.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/date/date_api_elements.inc,v
retrieving revision 1.49.2.1.2.7
diff -u -r1.49.2.1.2.7 date_api_elements.inc
--- date_api_elements.inc	22 Jun 2008 12:34:59 -0000	1.49.2.1.2.7
+++ date_api_elements.inc	27 Jun 2008 22:19:59 -0000
@@ -144,14 +144,14 @@
   if (empty($element['date']['#attributes']['class'])) {
     $element['date']['#attributes']['class'] = '';
   }
-  
+
   $element['#tree'] = TRUE;
   $element['date']['#type'] = 'textfield';
   $element['date']['#weight'] = !empty($element['date']['#weight']) ? $element['date']['#weight'] : $element['#weight'];
   $element['date']['#default_value'] = is_object($date) ? date_format($date , $element['#date_format']) : '';
   $element['date']['#attributes']['class'] = $element['date']['#attributes']['class'] .' date-date';
   $element['date']['#description'] .= ' '. t('Format: @date', array('@date' => date($element['#date_format'], time())));
-  
+
   // Keep the system from creating an error message for the sub-element.
   // We'll set our own message on the parent element.
   //$element['date']['#required'] = $element['#required'];
@@ -193,7 +193,7 @@
   $element['#tree'] = TRUE;
   date_increment_round($date, $element['#date_increment']);
   $element += (array) date_parts_element($element, $date, $element['#date_format']);
-  
+
   // Store a hidden value for all date parts not in the current display.
   $granularity = date_format_order($element['#date_format']);
   $formats = array('year' => 'Y', 'month' => 'n', 'day' => 'j', 'hour' => 'H', 'minute' => 'i', 'second' => 's');
@@ -233,7 +233,7 @@
   $count = 0;
   $increment = min(intval($element['#date_increment']), 1);
   foreach ($granularity as $field) {
-    // Allow empty value as option if date is not required 
+    // Allow empty value as option if date is not required
     // or if empty value was provided as a starting point.
     $part_required = ($element['#required'] && is_object($date)) ? TRUE : FALSE;
     $part_type = in_array($field, $element['#date_text_parts']) ? 'textfield' : 'select';
@@ -371,6 +371,7 @@
     $element['#value'] = array();
   }
   $error_field = implode('][', $element['#parents']);
+  $local_error_flag = false;
   $granularity = array_values(date_format_order($element['#date_format']));
   // Strip field labels out of the results.
   foreach ($element['#value'] as $field => $value) {
@@ -390,19 +391,22 @@
     if ($element['#value']['year'] < variable_get('date_min_year', 1) || $element['#value']['year'] > variable_get('date_max_year', 4000)) {
       form_set_error($error_field .'][year', t('year must be a number between %min and %max.', array(
         '%min' => variable_get('date_min_year', 1), '%max' => variable_get('date_max_year', 4000))));
+      $local_error_flag = true;
     }
   }
   if (in_array('month', $granularity) && ($element['#required'] || !empty($element['#value']['month']))) {
     if ($element['#value']['month'] < 1 || $element['#value']['month'] > 12) {
       form_set_error($error_field .'][month', t('month must be a number between 1 and 12.'));
+      $local_error_flag = true;
     }
   }
   if (in_array('day', $granularity) && ($element['#required'] || !empty($element['#value']['day']))) {
     if ($element['#value']['day'] < 1 || $element['#value']['day'] > 31) {
       form_set_error($error_field .'][day', t('day must be a number between 1 and 31.'));
+      $local_error_flag = true;
     }
   }
-  if (!form_get_errors()) {
+  if (!$local_error_flag) {
     // If it creates a valid date, set it.
     $value = date_select_input_value($element);
     if (!empty($value)) {
@@ -446,7 +450,7 @@
   }
   else {
     $error_field = implode('][', $element['#parents']);
-    form_set_error($error_field, t('A valid date is required for %title.', array('%title' => $element['#title']))); 
+    form_set_error($error_field, t('A valid date is required for %title.', array('%title' => $element['#title'])));
   }
 }
 
