I guess we're not returning status AND results from ajax calls after all...
authorMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 30 Oct 2009 23:07:24 +0000 (19:07 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 30 Oct 2009 23:12:44 +0000 (19:12 -0400)
ansel/lib/Ajax/Imple/LocationAutoCompleter.php

index 1042c15..f3eadd5 100644 (file)
@@ -60,19 +60,11 @@ class Ansel_Ajax_Imple_LocationAutoCompleter extends Horde_Ajax_Imple_AutoComple
         }
         $locs = $GLOBALS['ansel_storage']->searchLocations($input);
         if (is_a($locs, 'PEAR_Error')) {
-            return array('response' => 0);
+            Horde::logMessage($locs->getMessage(), __FILE__, __LINE__, PEAR_LOG_ERR);
+            $locs = array();
         }
 
-        $results = $locs;
-
-        if (count($results) == 0) {
-            $results = array('response' => 0, 'message' => array());
-        } else {
-            $results = array('response' => count($results),
-                             'message' => Horde_Serialize::serialize($results, Horde_Serialize::JSON, Horde_Nls::getCharset()));
-        }
-
-        return $results;
+        return Horde_Serialize::serialize($locs, Horde_Serialize::JSON, Horde_Nls::getCharset());
     }
 
 }