@@ 239-254 (lines=16) @@ | ||
236 | * |
|
237 | * @return bool |
|
238 | */ |
|
239 | public function remove($category_id) |
|
240 | { |
|
241 | $this->db->startTransaction(); |
|
242 | ||
243 | $this->db->table(TaskModel::TABLE)->eq('category_id', $category_id)->update(['category_id' => 0]); |
|
244 | ||
245 | if (!$this->db->table(self::TABLE)->eq('id', $category_id)->remove()) { |
|
246 | $this->db->cancelTransaction(); |
|
247 | ||
248 | return false; |
|
249 | } |
|
250 | ||
251 | $this->db->closeTransaction(); |
|
252 | ||
253 | return true; |
|
254 | } |
|
255 | ||
256 | /** |
|
257 | * Duplicate categories from a project to another one, must be executed inside a transaction. |
@@ 396-415 (lines=20) @@ | ||
393 | * |
|
394 | * @return bool |
|
395 | */ |
|
396 | public function remove($project_id, $swimlane_id) |
|
397 | { |
|
398 | $this->db->startTransaction(); |
|
399 | ||
400 | // Tasks should not be assigned anymore to this swimlane |
|
401 | $this->db->table(TaskModel::TABLE)->eq('swimlane_id', $swimlane_id)->update(['swimlane_id' => 0]); |
|
402 | ||
403 | if (!$this->db->table(self::TABLE)->eq('id', $swimlane_id)->remove()) { |
|
404 | $this->db->cancelTransaction(); |
|
405 | ||
406 | return false; |
|
407 | } |
|
408 | ||
409 | // Re-order positions |
|
410 | $this->updatePositions($project_id); |
|
411 | ||
412 | $this->db->closeTransaction(); |
|
413 | ||
414 | return true; |
|
415 | } |
|
416 | ||
417 | /** |
|
418 | * Update swimlane positions after disabling or removing a swimlane. |