allow autocomplete for models without explicit filter model
authorMichael Spahn <m.spahn@metaways.de>
Mon, 7 Aug 2017 06:58:16 +0000 (08:58 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 7 Aug 2017 10:47:06 +0000 (12:47 +0200)
Change-Id: I23f02baeb14674df06f786e8e68863bf5dd76930
Reviewed-on: http://gerrit.tine20.com/customers/5403
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Jenkins CI (http://ci.tine20.com/) <tine20-jenkins@metaways.de>
tine20/Tinebase/Frontend/Json.php

index e46e216..707c411 100644 (file)
@@ -1432,18 +1432,14 @@ class Tinebase_Frontend_Json extends Tinebase_Frontend_Json_Abstract
             throw new Tinebase_Exception_InvalidArgument('A controller for the given appName and modelName does not exist!');
         }
         
-        if (! class_exists($filterClassName)) {
-            throw new Tinebase_Exception_InvalidArgument('A filter for the given appName and modelName does not exist!');
-        }
-        
         if (! in_array($property, $recordClassName::getAutocompleteFields())) {
             throw new Tinebase_Exception_UnexpectedValue('bad property name');
         }
-        
-        $filter = new $filterClassName(array(
+
+        $filter = Tinebase_Model_Filter_FilterGroup::getFilterForModel($recordClassName, array(
             array('field' => $property, 'operator' => 'startswith', 'value' => $startswith),
         ));
-        
+
         $paging = new Tinebase_Model_Pagination(array('sort' => $property));
         
         $values = array_unique($controller->search($filter, $paging)->{$property});