Add mandatory argument "project_id" to API method "updateSwimlane()"
This commit is contained in:
@@ -49,15 +49,28 @@ class SwimlaneProcedure extends BaseProcedure
|
||||
return $this->swimlaneModel->create($project_id, $name, $description);
|
||||
}
|
||||
|
||||
public function updateSwimlane($swimlane_id, $name, $description = null)
|
||||
public function updateSwimlane($project_id, $swimlane_id, $name, $description = null)
|
||||
{
|
||||
$values = array('id' => $swimlane_id, 'name' => $name);
|
||||
ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'updateSwimlane', $project_id);
|
||||
|
||||
if (!is_null($description)) {
|
||||
$values = array(
|
||||
'project_id' => $project_id,
|
||||
'id' => $swimlane_id,
|
||||
'name' => $name,
|
||||
);
|
||||
|
||||
if (! is_null($description)) {
|
||||
$values['description'] = $description;
|
||||
}
|
||||
|
||||
return $this->swimlaneModel->update($values);
|
||||
list($valid, $errors) = $this->swimlaneValidator->validateModification($values);
|
||||
|
||||
if (! $valid) {
|
||||
$this->logger->debug(__METHOD__.': Validation error: '.var_export($errors, true));
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->swimlaneModel->update($swimlane_id, $values);
|
||||
}
|
||||
|
||||
public function removeSwimlane($project_id, $swimlane_id)
|
||||
|
||||
@@ -125,7 +125,7 @@ class SwimlaneController extends BaseController
|
||||
list($valid, $errors) = $this->swimlaneValidator->validateModification($values);
|
||||
|
||||
if ($valid) {
|
||||
if ($this->swimlaneModel->update($values)) {
|
||||
if ($this->swimlaneModel->update($values['id'], $values)) {
|
||||
$this->flash->success(t('Swimlane updated successfully.'));
|
||||
return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
|
||||
} else {
|
||||
|
||||
@@ -216,14 +216,18 @@ class SwimlaneModel extends Base
|
||||
* Update a swimlane
|
||||
*
|
||||
* @access public
|
||||
* @param array $values Form values
|
||||
* @param integer $swimlaneId
|
||||
* @param array $values
|
||||
* @return bool
|
||||
*/
|
||||
public function update(array $values)
|
||||
public function update($swimlaneId, array $values)
|
||||
{
|
||||
unset($values['id']);
|
||||
unset($values['project_id']);
|
||||
|
||||
return $this->db
|
||||
->table(self::TABLE)
|
||||
->eq('id', $values['id'])
|
||||
->eq('id', $swimlaneId)
|
||||
->update($values);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user