Browse Source
fix issue error Undefined index: xxx_task_ids by checking with isset
pull/46/head
Muhammad Irwan Andriawan
6 years ago
No known key found for this signature in database
GPG Key ID: EDE1CC7FF1BA6212
1 changed files with
10 additions and
6 deletions
-
app/Entities/Projects/JobsRepository.php
|
|
|
@ -49,13 +49,17 @@ class JobsRepository extends BaseRepository |
|
|
|
$newJob->project_id = $projectId; |
|
|
|
$newJob->save(); |
|
|
|
|
|
|
|
$selectedTasks = $job->tasks()->whereIn('id', $jobsData[$job->id.'_task_ids'])->get(); |
|
|
|
if(isset($jobsData[$job->id.'_task_ids'])){ |
|
|
|
|
|
|
|
$selectedTasks = $job->tasks()->whereIn('id', $jobsData[$job->id.'_task_ids'])->get(); |
|
|
|
|
|
|
|
foreach ($selectedTasks as $task) { |
|
|
|
$newTask = $task->replicate(); |
|
|
|
$newTask->progress = 0; |
|
|
|
$newTask->job_id = $newJob->id; |
|
|
|
$newTask->save(); |
|
|
|
} |
|
|
|
|
|
|
|
foreach ($selectedTasks as $task) { |
|
|
|
$newTask = $task->replicate(); |
|
|
|
$newTask->progress = 0; |
|
|
|
$newTask->job_id = $newJob->id; |
|
|
|
$newTask->save(); |
|
|
|
} |
|
|
|
} |
|
|
|
DB::commit(); |
|
|
|
|