MFB: Set an alarm to one minute, if users try to set an alarm without time.
authorJan Schneider <jan@horde.org>
Mon, 26 Apr 2010 15:50:56 +0000 (17:50 +0200)
committerJan Schneider <jan@horde.org>
Tue, 27 Apr 2010 09:33:15 +0000 (11:33 +0200)
nag/docs/CHANGES
nag/lib/Forms/task.php
nag/lib/Ui/VarRenderer/Nag.php

index f5e8a49..9fa8ef8 100644 (file)
@@ -15,6 +15,7 @@ v3.0-git
 v2.3.5-cvs
 ----------
 
+[jan] Set an alarm to one minute, if users try to set an alarm without time.
 [jan] Add missing preference for not sending update notifications to yourself
       (Joel Smith <js-horde@jk1.net>, Request #8978).
 [gwr] Fix organizer field not saved in tasks (kolab/issue3888).
index 6639838..878d3b2 100644 (file)
@@ -215,8 +215,14 @@ class Horde_Form_Type_nag_alarm extends Horde_Form_Type {
         $info = $var->getValue($vars);
         if (!$info['on']) {
             $info = 0;
+        } else {
+            $value = $info['value'];
+            $unit = $info['unit'];
+            if ($value == 0) {
+                $value = $unit = 1;
+            }
+            $info = $value * $unit;
         }
-        $info = $info['value'] * $info['unit'];
     }
 
     function isValid(&$var, &$vars, $value, &$message)
@@ -226,10 +232,6 @@ class Horde_Form_Type_nag_alarm extends Horde_Form_Type {
                 $message = _("A due date must be set to enable alarms.");
                 return false;
             }
-            if (empty($value['value'])) {
-                $message = _("The alarm value must not be empty.");
-                return false;
-            }
         }
 
         return true;
index cc30da3..8d22477 100644 (file)
@@ -11,7 +11,7 @@
 
 /**
  * The Horde_Ui_VarRenderer_Nag class provides additional methods for
- * rendering Horde_Form_Type_alarm fields.
+ * rendering Nag specific fields.
  *
  * @todo    Clean this hack up with Horde_Form/H4
  * @author  Jan Schneider <jan@horde.org>