Author: jablko
Date: Thu Oct 28 03:26:23 2010
New Revision: 8626
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:06:45 2010 (r8625)
+++ trunk/plugins/sfIsadPlugin/lib/QubitValidatorIsadDates.class.php Thu Oct
28 03:26:23 2010 (r8626)
@@ -19,11 +19,6 @@
class QubitValidatorIsadDates extends sfValidatorBase
{
- protected function configure($options = array(), $messages = array())
- {
- $this->addOption('invalid');
- }
-
protected function doClean($value)
{
foreach ($value->events as $event)
@@ -50,21 +45,21 @@
foreach ($ancestorEvents as $ancestorEvent)
{
$ancestorStartDate = null;
- if (null != $ancestorEvent->startDate)
+ if (isset($ancestorEvent->startDate))
{
$ancestorStartDate = new DateTime($ancestorEvent->startDate);
}
$ancestorEndDate = null;
- if (null != $ancestorEvent->endDate)
+ if (isset($ancestorEvent->endDate))
{
$ancestorEndDate = new DateTime($ancestorEvent->endDate);
}
// Compare startDate with ancestor dates
- if (null != $startDate)
+ if (isset($startDate))
{
- if ((null == $ancestorStartDate || $startDate >=
$ancestorStartDate) && (null == $ancestorEndDate || $startDate <
$ancestorEndDate))
+ if ((!isset($ancestorStartDate) || $startDate >=
$ancestorStartDate) && (!isset($ancestorEndDate) || $startDate <
$ancestorEndDate))
{
$validStartDate = true;
}
@@ -75,9 +70,9 @@
}
// Compare endDate with ancestor dates
- if (null != $endDate)
+ if (isset($endDate))
{
- if ((null == $ancestorStartDate || $endDate >
$ancestorStartDate) && (null == $ancestorEndDate || $endDate <=
$ancestorEndDate))
+ if ((!isset($ancestorStartDate) || $endDate >
$ancestorStartDate) && (!isset($ancestorEndDate || $endDate <=
$ancestorEndDate)))
{
$validEndDate = true;
}
@@ -95,7 +90,7 @@
// If the current dates aren't within at least one of the ranges
// for this ancestor, then throw validation error
- if (!($validStartDate && $validEndDate))
+ 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.