Explorar o código

fixed ViewTableAjax export

Piotr Labudda %!s(int64=9) %!d(string=hai) anos
pai
achega
654bb56a93
Modificáronse 1 ficheiros con 10 adicións e 3 borrados
  1. 10 3
      SE/se-lib/Route/ViewTableAjax.php

+ 10 - 3
SE/se-lib/Route/ViewTableAjax.php

@@ -499,9 +499,16 @@ class Route_ViewTableAjax extends RouteBase {
 				$params[$k] = $v;
 			}
 		}
-		$total = $acl->getTotal($params);
-		// if ($total > $exportLimit) $params['limit'] = $exportLimit;
-		$items = $acl->getItems($params);
+		try {
+			$queryFeatures = $acl->buildQuery($params);
+			$total = $queryFeatures->getTotal();
+			$listItems = $queryFeatures->getItems();
+			$primaryKeyField = $acl->getPrimaryKeyField();
+			$items = []; foreach ($listItems as $item) $items[ $item[$primaryKeyField] ] = $item;
+		} catch (Exception $e) {
+			DBG::log($e);
+			throw $e;
+		}
 
 		$format = V::get('format', 'html', $_GET);
 		switch ($format) {