|
@@ -41,6 +41,8 @@ class Webservice
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Retorna el resultado para utilizar en un choice form field
|
|
|
+ *
|
|
|
* @param string $webservice
|
|
|
* @param array $params
|
|
|
*
|
|
@@ -60,6 +62,8 @@ class Webservice
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Retorna el resultado como un array
|
|
|
+ *
|
|
|
* @param string $webservice
|
|
|
* @param array $params
|
|
|
*
|
|
@@ -69,15 +73,12 @@ class Webservice
|
|
|
{
|
|
|
$results = array();
|
|
|
if ($this->serviceContainer->hasParameter($webservice)) {
|
|
|
- $url = $this->serviceContainer->getParameter($webservice);
|
|
|
- $url .= '?filters[qb-criteria]';
|
|
|
- foreach ($params as $param => $value) {
|
|
|
- $url .= "&filters[{$param}]=$value";
|
|
|
- }
|
|
|
try {
|
|
|
+ // Por defecto agrega filters[qb-criteria] y limit=20
|
|
|
+ $url = $this->buildUrl($webservice, $params, true);
|
|
|
$results = json_decode($this->makeGetRequest($url), true);
|
|
|
} catch (\Exception $ex) {
|
|
|
-
|
|
|
+ var_dump($ex->getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -140,6 +141,8 @@ class Webservice
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Similar a getArray pero con mas parametros
|
|
|
+ *
|
|
|
* @param string $url
|
|
|
* @param array $filters
|
|
|
* @param array $order_by
|
|
@@ -162,6 +165,8 @@ class Webservice
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Similar a getData pero la request no hace authentication
|
|
|
+ *
|
|
|
* @param string $url
|
|
|
* @param array $filters
|
|
|
* @param array $order_by
|
|
@@ -188,10 +193,11 @@ class Webservice
|
|
|
* @param array $order_by
|
|
|
* @param int $limit
|
|
|
* @param int $offset
|
|
|
+ * @param boolean $qbCriteria
|
|
|
*
|
|
|
* @return string
|
|
|
*/
|
|
|
- public function buildUrl($webservice, $filters = array(), $order_by = array(), $limit = null, $offset = null)
|
|
|
+ public function buildUrl($webservice, $filters = array(), $qbCriteria = false, $order_by = array(), $limit = 20, $offset = null)
|
|
|
{
|
|
|
$url = $webservice . '?';
|
|
|
if ($this->serviceContainer->hasParameter($webservice)) {
|
|
@@ -213,6 +219,10 @@ class Webservice
|
|
|
if ($offset) {
|
|
|
$url .= "&offset={$offset}";
|
|
|
}
|
|
|
+
|
|
|
+ if ($qbCriteria) {
|
|
|
+ $url .= '&filters[qb-criteria]';
|
|
|
+ }
|
|
|
|
|
|
return $url;
|
|
|
}
|