* Fix product api.
This commit is contained in:
@@ -29,17 +29,11 @@ class productEntry extends Entry
|
||||
if(!$data or !isset($data->status)) return $this->send400('error');
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
|
||||
|
||||
$product = $this->format($data->data->product, 'createdDate:time');
|
||||
$product = $this->format($data->data->product, 'createdDate:time,whitelist:userList,createdBy:user,PO:user,RD:user,QD:user,feedback:user');
|
||||
|
||||
$this->loadModel('testcase');
|
||||
$product->caseReview = ($this->config->testcase->needReview or !empty($this->config->testcase->forceReview));
|
||||
|
||||
$users = $data->data->users;
|
||||
$product->PO = $this->formatUser($product->PO, $users);
|
||||
$product->QD = $this->formatUser($product->QD, $users);
|
||||
$product->RD = $this->formatUser($product->RD, $users);
|
||||
$product->createdBy = $this->formatUser($product->createdBy, $users);
|
||||
if(isset($product->feedback)) $product->feedback = $this->formatUser($product->feedback, $users);
|
||||
if(!$fields) return $this->send(200, $product);
|
||||
|
||||
/* Set other fields. */
|
||||
|
||||
@@ -59,8 +59,19 @@ class productplanEntry extends Entry
|
||||
$data = $this->getData();
|
||||
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
$plan = $this->productplan->getByID($planID);
|
||||
$this->sendSuccess(200, $this->format($plan, 'begin:date,end:date'));
|
||||
/* Get plan info. */
|
||||
$control = $this->loadController('productplan', 'view');
|
||||
$control->view($planID);
|
||||
|
||||
$data = $this->getData();
|
||||
if(!$data or !isset($data->status)) return $this->send400('error');
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
|
||||
|
||||
$plan = $data->data->plan;
|
||||
$plan->stories = $data->data->planStories;
|
||||
$plan->bugs = $data->data->planBugs;
|
||||
|
||||
$this->send(200, $this->format($plan, 'begin:date,end:date,deleted:bool,stories:array,bugs:array'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,7 @@ class productplansEntry extends entry
|
||||
}
|
||||
else
|
||||
{
|
||||
$result[$plan->id] = $plan;
|
||||
$result[$plan->id] = $this->format($plan, 'begin:date,end:date,deleted:bool,project:int');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,9 @@ class productplansEntry extends entry
|
||||
|
||||
$fields = 'branch,begin,end,title,desc';
|
||||
$this->batchSetPost($fields);
|
||||
$this->setPost('product', $productID);
|
||||
$this->setPost('parent', $this->request('parent', 0));
|
||||
$this->setPost('branch', $this->request('branch', 0));
|
||||
|
||||
$control = $this->loadController('productplan', 'create');
|
||||
$control->create($productID, $this->param('branch', 0), $this->param('parent', 0));
|
||||
@@ -82,7 +85,7 @@ class productplansEntry extends entry
|
||||
$plan = $this->loadModel('productplan')->getByID($data->id);
|
||||
$plan->stories = array();
|
||||
$plan->bugs = array();
|
||||
return $this->send(200, $plan);
|
||||
return $this->send(200, $this->format($plan, 'begin:date,end:date,deleted:bool,project:int'));
|
||||
}
|
||||
|
||||
$this->sendError(400, array('message' => isset($data->message) ? $data->message : 'error'));
|
||||
|
||||
@@ -79,7 +79,7 @@ class productsEntry extends entry
|
||||
}
|
||||
}
|
||||
|
||||
$result[] = $this->format($product, 'createdDate:time');
|
||||
$result[] = $this->format($product, 'createdDate:time,whitelist:userList,createdBy:user,PO:user,RD:user,QD:user');
|
||||
}
|
||||
|
||||
$data = array();
|
||||
@@ -113,11 +113,11 @@ class productsEntry extends entry
|
||||
$control->create($this->request('program', 0));
|
||||
|
||||
$data = $this->getData();
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
|
||||
if(isset($data->result) and $data->result == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
|
||||
|
||||
/* Response */
|
||||
$product = $this->loadModel('product')->getByID($data->id);
|
||||
$product = $this->format($product, 'createdDate:time,whitelist:[]string');
|
||||
$product = $this->format($product, 'createdDate:time,whitelist:userList,createdBy:user,PO:user,RD:user,QD:user');
|
||||
|
||||
$this->send(200, $product);
|
||||
}
|
||||
|
||||
@@ -28,11 +28,12 @@ class projectReleasesEntry extends entry
|
||||
|
||||
/* Response */
|
||||
$data = $this->getData();
|
||||
|
||||
if(isset($data->status) and $data->status == 'success')
|
||||
{
|
||||
$result = array();
|
||||
$releases = $data->data->releases;
|
||||
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date');
|
||||
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date,mailto:userList');
|
||||
|
||||
return $this->send(200, array('total' => count($result), 'releases' => $result));
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class releasesEntry extends entry
|
||||
{
|
||||
$result = array();
|
||||
$releases = $data->data->releases;
|
||||
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date');
|
||||
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date,mailto:userList');
|
||||
|
||||
return $this->send(200, array('total' => count($result), 'releases' => $result));
|
||||
}
|
||||
|
||||
@@ -279,8 +279,8 @@ class projectrelease extends control
|
||||
|
||||
/**
|
||||
* Notify for release.
|
||||
*
|
||||
* @param int $releaseID
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -290,7 +290,7 @@ class projectrelease extends control
|
||||
{
|
||||
if(isset($_POST['notify']))
|
||||
{
|
||||
$notify = implode(',', $this->post->notify);
|
||||
$notify = implode(',', $this->post->notify);
|
||||
$this->dao->update(TABLE_RELEASE)->set('notify')->eq($notify)->where('id')->eq($releaseID)->exec();
|
||||
|
||||
$this->release->sendmail($releaseID);
|
||||
@@ -298,7 +298,7 @@ class projectrelease extends control
|
||||
|
||||
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
|
||||
}
|
||||
|
||||
|
||||
$this->view->release = $this->release->getById($releaseID);
|
||||
$this->view->actions = $this->loadModel('action')->getList('release', $releaseID);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
|
||||
|
||||
Reference in New Issue
Block a user