diff --git a/Controller/TrelloJSON2KanboardController.php b/Controller/TrelloJSON2KanboardController.php index a4be717..37a6d9e 100644 --- a/Controller/TrelloJSON2KanboardController.php +++ b/Controller/TrelloJSON2KanboardController.php @@ -86,36 +86,40 @@ public function save() //creating task $task_id = $this->taskCreationModel->create($values); - //getting checklists from JSON file - foreach ($jsonObj->checklists as $checklist) { - //only get checklists that belongs to this card - if ($checklist->idCard == $card->id) { - foreach ($checklist->checkItems as $checkitem) { - $status = $checkitem->state == 'complete' ? 2 : 0; - $values = array( - 'title' => $checkitem->name, - 'task_id' => $task_id, - 'status' => $status, - ); - //creating subtask - $subtask_id = $this->subtaskModel->create($values); + if ($card->badges->checkItems > 0) { + //getting checklists from JSON file + foreach ($jsonObj->checklists as $checklist) { + //only get checklists that belongs to this card + if ($checklist->idCard == $card->id) { + foreach ($checklist->checkItems as $checkitem) { + $status = $checkitem->state == 'complete' ? 2 : 0; + $values = array( + 'title' => $checkitem->name, + 'task_id' => $task_id, + 'status' => $status, + ); + //creating subtask + $subtask_id = $this->subtaskModel->create($values); + } } } } - //getting actions from JSON file - foreach ($jsonObj->actions as $action) { - //only get actions from commentCard type - if ($action->type == 'commentCard') { - //only get comments that belongs to this card - if ($action->data->card->id == $card->id) { - $values = array( - 'task_id' => $task_id, - 'user_id' => $this->userSession->getId(), - 'comment' => $action->data->text, - ); - //creating comment - $comment_id = $this->commentModel->create($values); + if ($card->badges->comments > 0) { + //getting actions from JSON file + foreach ($jsonObj->actions as $action) { + //only get actions from commentCard type + if ($action->type == 'commentCard') { + //only get comments that belongs to this card + if ($action->data->card->id == $card->id) { + $values = array( + 'task_id' => $task_id, + 'user_id' => $this->userSession->getId(), + 'comment' => $action->data->text, + ); + //creating comment + $comment_id = $this->commentModel->create($values); + } } } } diff --git a/Plugin.php b/Plugin.php index 5ca1d78..abc7cbf 100644 --- a/Plugin.php +++ b/Plugin.php @@ -35,7 +35,7 @@ public function getPluginAuthor() public function getPluginVersion() { - return '1.0.2'; + return '1.0.3'; } public function getPluginHomepage()