Set task alarm without value from ajax interface too.
authorJan Schneider <jan@horde.org>
Tue, 27 Apr 2010 08:22:58 +0000 (10:22 +0200)
committerJan Schneider <jan@horde.org>
Tue, 27 Apr 2010 09:33:16 +0000 (11:33 +0200)
kronolith/lib/Ajax/Application.php

index df6f234..8702bf5 100644 (file)
@@ -390,9 +390,16 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base
             $task['due'] = $due->timestamp();
         }
 
-        $task['alarm'] = $task['alarm']['on']
-            ? $task['alarm']['value'] * $task['alarm']['unit']
-            : 0;
+        if ($task['alarm']['on']) {
+            $value = $task['alarm']['value'];
+            $unit = $task['alarm']['unit'];
+            if ($value == 0) {
+                $value = $unit = 1;
+            }
+            $task['alarm'] = $value * $unit;
+        } else {
+            $task['alarm'] = 0;
+        }
 
         $result = new stdClass;
         try {