* fix for return fields.

This commit is contained in:
王怡栋
2021-10-26 16:18:35 +08:00
parent 001ca0ef8f
commit 089a1204f1
3 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ class executionsEntry extends entry
*/
public function get($projectID = 0)
{
$returnFields = explode(',', $this->param('return', ''));
$returnFields = $this->param('return', '');
$control = $this->loadController('execution', 'all');
$control->all($this->param('status', 'all'), $this->param('project', $projectID), $this->param('order', 'id_desc'), 0, 0, $this->param('limit', 20), $this->param('page', 1));
+1 -1
View File
@@ -21,7 +21,7 @@ class projectsEntry extends entry
public function get($programID = 0)
{
if(!$programID) $programID = $this->param('program', 0);
$returnFields = explode(',', $this->param('return', ''));
$returnFields = $this->param('return', '');
$control = $this->loadController('project', 'browse');
$control->browse($programID, $this->param('status', 'all'), 0, $this->param('order', 'order_asc'), 0, $this->param('limit', 20), $this->param('page', 1));
+2
View File
@@ -532,10 +532,12 @@ class baseEntry
public function filterFields($object, $allowable = '')
{
if(empty($allowable)) return $object;
if(is_string($allowable)) $allowable = explode(',', $allowable);
$filtered = new stdclass();
foreach($allowable as $field)
{
$field = trim($field);
if(!isset($object->$field)) continue;
$filtered->$field = $object->$field;
}