Author: jablko
Date: Thu Oct 28 03:35:09 2010
New Revision: 8628

Log:
Cosmetic change

Modified:
   trunk/plugins/sfIsadPlugin/lib/QubitValidatorIsadDates.class.php

Modified: trunk/plugins/sfIsadPlugin/lib/QubitValidatorIsadDates.class.php
==============================================================================
--- trunk/plugins/sfIsadPlugin/lib/QubitValidatorIsadDates.class.php    Thu Oct 
28 03:30:37 2010        (r8627)
+++ trunk/plugins/sfIsadPlugin/lib/QubitValidatorIsadDates.class.php    Thu Oct 
28 03:35:09 2010        (r8628)
@@ -23,19 +23,6 @@
   {
     foreach ($value->events as $event)
     {
-      $startDate = null;
-      if (isset($event->startDate))
-      {
-        $startDate = new DateTime($event->startDate);
-      }
-
-      $endDate = null;
-      if (isset($event->endDate))
-      {
-        $endDate = new DateTime($event->endDate);
-      }
-
-      // Check ancestors
       foreach ($value->ancestors as $ancestor)
       {
         if (0 < count($ancestorEvents = $ancestor->getDates(array('type_id' => 
$event->type->id))))
@@ -44,22 +31,9 @@
 
           foreach ($ancestorEvents as $ancestorEvent)
           {
-            $ancestorStartDate = null;
-            if (isset($ancestorEvent->startDate))
-            {
-              $ancestorStartDate = new DateTime($ancestorEvent->startDate);
-            }
-
-            $ancestorEndDate = null;
-            if (isset($ancestorEvent->endDate))
-            {
-              $ancestorEndDate = new DateTime($ancestorEvent->endDate);
-            }
-
-            // Compare startDate with ancestor dates
             if (isset($event->startDate))
             {
-              if ((!isset($ancestor->startDate) || $startDate >= 
$ancestorStartDate) && (!isset($ancestor->endDate) || $startDate < 
$ancestorEndDate))
+              if ((!isset($ancestor->startDate) || new 
DateTime($event->startDate) >= new DateTime($ancestor->startDate)) && 
(!isset($ancestor->endDate) || new DateTime($event->startDate) < new 
DateTime($ancestor->endDate)))
               {
                 $validStartDate = true;
               }
@@ -69,10 +43,9 @@
               $validStartDate = true;
             }
 
-            // Compare endDate with ancestor dates
             if (isset($endDate))
             {
-              if ((!isset($ancestor->startDate) || $endDate > 
$ancestorStartDate) && (!isset($ancestor->endDate || $endDate <= 
$ancestorEndDate)))
+              if ((!isset($ancestor->startDate) || new 
DateTime($event->endDate) > new DateTime($ancestor->startDate)) && 
(!isset($ancestor->endDate) || new DateTime($event->endDate) <= new 
DateTime($ancestor->endDate)))
               {
                 $validEndDate = true;
               }
@@ -88,8 +61,8 @@
             }
           }
 
-          // If the current dates aren't within at least one of the ranges
-          // for this ancestor, then throw validation error
+          // If current dates aren't within at least one of the ranges for this
+          // ancestor, then throw validation error
           if (!$validStartDate || !$validEndDate)
           {
             throw new sfValidatorError($this, 'invalid', array('ancestor' => 
sfContext::getInstance()->routing->generate(null, array($ancestor, 'module' => 
'informationobject'))));

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to