PluginProbe
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration / 2.1.0
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration v2.1.0
2.1.0 2.0.15 2.0.12 2.0.10 2.0.4 2.0.1 2.0.0 1.95.3 1.95.2 1.95 1.91.6 trunk 1.11 1.12 1.13 1.20 1.21 1.22 1.23 1.30 1.31 1.32 1.35 1.40 1.41 All 42 releases
← All changes | app/Services/StageService.php +26 -0 2.0.42.1.0 View file →
@@ -508,14 +508,21 @@
508 508
509 509 public function moveAllTasks($oldStageId, $newStageId)
510 510 {
511 511 $tasks = Task::where('stage_id', $oldStageId)->whereNull('parent_id')->whereNull('archived_at')->get();
512 + $sourceStage = Stage::findOrFail($oldStageId);
513 + $targetStage = Stage::findOrFail($newStageId);
512 514
515 + // Load shared watcher data once; stage data is injected per task below.
516 + $tasks->load('watchers');
517 +
513 518 // get the last position available of that stage
514 519 $position = (new TaskService())->getLastPositionOfTasks($newStageId);
515 520
516 521 // update tasks stage and position
517 522 foreach ($tasks as $key => $task) {
523 + $taskOldStageId = $task->stage_id;
524 +
518 525 // Clean up archived_by_stage meta when moving to different stage
519 526 TaskMeta::where('task_id', $task->id)
520 527 ->where('key', Constant::META_KEY_ARCHIVED_BY_STAGE)
521 528 ->delete();
@@ -521,10 +528,29 @@
521 528 ->delete();
522 529
523 530 $task->stage_id = $newStageId;
524 531 $task->position = $position + $key;
532 + $task->setRelation('stage', $targetStage);
525 533 $task->save();
534 +
535 + if ((int) $taskOldStageId !== (int) $newStageId) {
536 + do_action('fluent_boards/task_stage_updated', $task, $taskOldStageId, [
537 + 'source' => $sourceStage,
538 + 'target' => $targetStage,
539 + ]);
540 + }
526 541 }
542 +
543 + if ($tasks->count() && (int) $sourceStage->id !== (int) $targetStage->id) {
544 + do_action(
545 + 'fluent_boards/tasks_moved_between_stages',
546 + $sourceStage->board_id,
547 + $sourceStage,
548 + $targetStage,
549 + $tasks->count()
550 + );
551 + }
552 +
527 553 return $tasks;
528 554 }
529 555 public function archiveAllTasksInStage($stage_id, $boardId = null)
530 556 {