ZakFormValidatorCompareDatePrivate *priv = ZAK_FORM_VALIDATOR_COMPARE_DATE_GET_PRIVATE (validator);
+ ret = FALSE;
+
if (!ZAK_FORM_IS_ELEMENT (priv->v1)
|| !ZAK_FORM_IS_ELEMENT (priv->v2))
{
gdt2 = zak_utils_get_gdatetime_from_string (zak_form_element_get_value (priv->v2), priv->format2);
if (gdt1 == NULL
- && gdt2 == NULL)
- {
- return TRUE;
- }
- else if (gdt1 == NULL
|| gdt2 == NULL)
{
- if (priv->type == LESSER
- || priv->type == LESSER_EQUAL)
- {
- ret = (gdt1 == NULL
- && gdt2 != NULL);
- }
- else if (priv->type == EQUAL)
- {
- ret = (gdt1 == NULL
- && gdt2 == NULL);
- }
- else if (priv->type == GREATER
- || priv->type == GREATER_EQUAL)
- {
- ret = (gdt1 != NULL
- && gdt2 == NULL);
- }
+ return TRUE;
}
else
{
{
case -1:
ret = (priv->type == LESSER
- || priv->type == LESSER_EQUAL
- || priv->type == NOT_EQUAL);
+ || priv->type == LESSER_EQUAL
+ || priv->type == NOT_EQUAL);
break;
case 0:
ret = (priv->type == LESSER_EQUAL
- || priv->type == EQUAL
- || priv->type == GREATER_EQUAL);
+ || priv->type == EQUAL
+ || priv->type == GREATER_EQUAL);
break;
case 1:
ret = (priv->type == GREATER
- || priv->type == GREATER_EQUAL
- || priv->type == NOT_EQUAL);
+ || priv->type == GREATER_EQUAL
+ || priv->type == NOT_EQUAL);
break;
};
}
if (!ret)
{
msg = g_strdup_printf (_("«%s» must be %s «%s»"),
- zak_form_element_get_long_name (priv->v1),
- msgs[priv->type],
- zak_form_element_get_long_name (priv->v2));
+ zak_form_element_get_long_name (priv->v1),
+ msgs[priv->type],
+ zak_form_element_get_long_name (priv->v2));
zak_form_validator_set_message (validator, msg);
g_free (msg);
}