mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 18:02:18 +00:00
- 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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user