Add new API procedures to move and duplicate tasks to another project
This commit is contained in:
@@ -6,7 +6,7 @@ New features:
|
|||||||
* Forgot Password
|
* Forgot Password
|
||||||
* Add dropdown menu on each board column title to close all tasks
|
* Add dropdown menu on each board column title to close all tasks
|
||||||
* Add Malay language
|
* Add Malay language
|
||||||
* Add new API procedures for groups, roles and project permissions
|
* Add new API procedures for groups, roles, project permissions and to move/duplicate tasks to another project
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,16 @@ class Task extends Base
|
|||||||
return $this->taskPosition->movePosition($project_id, $task_id, $column_id, $position, $swimlane_id);
|
return $this->taskPosition->movePosition($project_id, $task_id, $column_id, $position, $swimlane_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function moveTaskToProject($task_id, $project_id, $swimlane_id = null, $column_id = null, $category_id = null, $owner_id = null)
|
||||||
|
{
|
||||||
|
return $this->taskDuplication->moveToProject($task_id, $project_id, $swimlane_id, $column_id, $category_id, $owner_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function duplicateTaskToProject($task_id, $project_id, $swimlane_id = null, $column_id = null, $category_id = null, $owner_id = null)
|
||||||
|
{
|
||||||
|
return $this->taskDuplication->duplicateToProject($task_id, $project_id, $swimlane_id, $column_id, $category_id, $owner_id);
|
||||||
|
}
|
||||||
|
|
||||||
public function createTask($title, $project_id, $color_id = '', $column_id = 0, $owner_id = 0, $creator_id = 0,
|
public function createTask($title, $project_id, $color_id = '', $column_id = 0, $owner_id = 0, $creator_id = 0,
|
||||||
$date_due = '', $description = '', $category_id = 0, $score = 0, $swimlane_id = 0,
|
$date_due = '', $description = '', $category_id = 0, $score = 0, $swimlane_id = 0,
|
||||||
$recurrence_status = 0, $recurrence_trigger = 0, $recurrence_factor = 0, $recurrence_timeframe = 0,
|
$recurrence_status = 0, $recurrence_trigger = 0, $recurrence_factor = 0, $recurrence_timeframe = 0,
|
||||||
|
|||||||
@@ -525,7 +525,7 @@ Response example:
|
|||||||
|
|
||||||
### moveTaskPosition
|
### moveTaskPosition
|
||||||
|
|
||||||
- Purpose: **Move a task to another column or another position**
|
- Purpose: **Move a task to another column, position or swimlane inside the same board**
|
||||||
- Parameters:
|
- Parameters:
|
||||||
- **project_id** (integer, required)
|
- **project_id** (integer, required)
|
||||||
- **task_id** (integer, required)
|
- **task_id** (integer, required)
|
||||||
@@ -560,3 +560,77 @@ Response example:
|
|||||||
"result": true
|
"result": true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### moveTaskToProject
|
||||||
|
|
||||||
|
- Purpose: **Move a task to another project**
|
||||||
|
- Parameters:
|
||||||
|
- **task_id** (integer, required)
|
||||||
|
- **project_id** (integer, required)
|
||||||
|
- **swimlane_id** (integer, optional)
|
||||||
|
- **column_id** (integer, optional)
|
||||||
|
- **category_id** (integer, optional)
|
||||||
|
- **owner_id** (integer, optional)
|
||||||
|
- Result on success: **true**
|
||||||
|
- Result on failure: **false**
|
||||||
|
|
||||||
|
Request example:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"method": "moveTaskToProject",
|
||||||
|
"id": 15775829,
|
||||||
|
"params": [
|
||||||
|
4,
|
||||||
|
5
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Response example:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"id": 15775829,
|
||||||
|
"result": true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### duplicateTaskToProject
|
||||||
|
|
||||||
|
- Purpose: **Move a task to another column or another position**
|
||||||
|
- Parameters:
|
||||||
|
- **task_id** (integer, required)
|
||||||
|
- **project_id** (integer, required)
|
||||||
|
- **swimlane_id** (integer, optional)
|
||||||
|
- **column_id** (integer, optional)
|
||||||
|
- **category_id** (integer, optional)
|
||||||
|
- **owner_id** (integer, optional)
|
||||||
|
- Result on success: **task_id**
|
||||||
|
- Result on failure: **false**
|
||||||
|
|
||||||
|
Request example:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"method": "duplicateTaskToProject",
|
||||||
|
"id": 1662458687,
|
||||||
|
"params": [
|
||||||
|
5,
|
||||||
|
7
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Response example:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"id": 1662458687,
|
||||||
|
"result": 6
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -55,4 +55,42 @@ class TaskTest extends Base
|
|||||||
$task = $this->app->getTask($task_id);
|
$task = $this->app->getTask($task_id);
|
||||||
$this->assertEquals(0, $task['owner_id']);
|
$this->assertEquals(0, $task['owner_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testMoveTaskToAnotherProject()
|
||||||
|
{
|
||||||
|
$project_id1 = $this->app->createProject('My project');
|
||||||
|
$this->assertNotFalse($project_id1);
|
||||||
|
|
||||||
|
$project_id2 = $this->app->createProject('My project');
|
||||||
|
$this->assertNotFalse($project_id2);
|
||||||
|
|
||||||
|
$task_id = $this->app->createTask(array('project_id' => $project_id1, 'title' => 'My task'));
|
||||||
|
$this->assertNotFalse($task_id);
|
||||||
|
|
||||||
|
$this->assertTrue($this->app->moveTaskToProject($task_id, $project_id2));
|
||||||
|
|
||||||
|
$task = $this->app->getTask($task_id);
|
||||||
|
$this->assertEquals($project_id2, $task['project_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMoveCopyToAnotherProject()
|
||||||
|
{
|
||||||
|
$project_id1 = $this->app->createProject('My project');
|
||||||
|
$this->assertNotFalse($project_id1);
|
||||||
|
|
||||||
|
$project_id2 = $this->app->createProject('My project');
|
||||||
|
$this->assertNotFalse($project_id2);
|
||||||
|
|
||||||
|
$task_id1 = $this->app->createTask(array('project_id' => $project_id1, 'title' => 'My task'));
|
||||||
|
$this->assertNotFalse($task_id1);
|
||||||
|
|
||||||
|
$task_id2 = $this->app->duplicateTaskToProject($task_id1, $project_id2);
|
||||||
|
$this->assertNotFalse($task_id2);
|
||||||
|
|
||||||
|
$task = $this->app->getTask($task_id1);
|
||||||
|
$this->assertEquals($project_id1, $task['project_id']);
|
||||||
|
|
||||||
|
$task = $this->app->getTask($task_id2);
|
||||||
|
$this->assertEquals($project_id2, $task['project_id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user