- Added parameter decode to API /system/UDF/UDF to decode json

- UDF bugfix: now it checks if a table has the column udf_values before
performing an insert or update
This commit is contained in:
Paolo
2017-06-19 12:15:28 +02:00
parent e8d395f4f1
commit 3ac8d7d604
2 changed files with 72 additions and 73 deletions
+25 -4
View File
@@ -32,9 +32,12 @@ class UDF extends APIv1_Controller
*/
public function getUDF()
{
$decode = $this->get('decode');
$schema = $this->get('schema');
$table = $this->get('table');
$result = error();
if (isset($schema) || isset($table))
{
$result = $this->UDFModel->loadWhere(
@@ -43,14 +46,32 @@ class UDF extends APIv1_Controller
'table' => $table
)
);
$this->response($result, REST_Controller::HTTP_OK);
}
else
{
$result = $this->UDFModel->load();
$this->response($result, REST_Controller::HTTP_OK);
}
if ($decode)
{
$this->_jsonDecodeResult($result);
}
$this->response($result, REST_Controller::HTTP_OK);
}
/**
*
*/
private function _jsonDecodeResult(&$result)
{
if (hasData($result))
{
for($i = 0; $i < count($result->retval); $i++)
{
$obj = $result->retval[$i];
$obj->jsons = json_decode($obj->jsons);
}
}
}
}