From 36d08e251bedf60454ec26ce2d1779e6786256b0 Mon Sep 17 00:00:00 2001 From: yisaka117 Date: Wed, 20 Apr 2022 12:33:13 +0900 Subject: [PATCH] Issue #1146 bugfix form priority cond of workflow --- src/ConditionItems/WorkflowItem.php | 8 +++++++- src/Model/Condition.php | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/ConditionItems/WorkflowItem.php b/src/ConditionItems/WorkflowItem.php index aec8e36e3..d1d877795 100644 --- a/src/ConditionItems/WorkflowItem.php +++ b/src/ConditionItems/WorkflowItem.php @@ -79,6 +79,12 @@ protected function getWorkflow() : ?Model\Workflow protected function getWorkflowStatus(Condition $condition) : ?string { - return Model\WorkflowStatus::getWorkflowStatusName($condition->condition_value); + $this->custom_table = $condition->getCustomTable(); + $workflow = $this->getWorkflow(); + + return collect($condition->condition_value)->map(function ($v) use($workflow) { + return Model\WorkflowStatus::getWorkflowStatusName($v, $workflow); + })->implode(","); + //return Model\WorkflowStatus::getWorkflowStatusName($condition->condition_value); } } diff --git a/src/Model/Condition.php b/src/Model/Condition.php index 1b8f9cc6a..7ef0e8cd3 100644 --- a/src/Model/Condition.php +++ b/src/Model/Condition.php @@ -17,6 +17,17 @@ class Condition extends ModelBase protected $condition_type_key = 'condition_type'; protected $condition_column_key = 'target_column_id'; + public function getCustomTable() + { + if ($this->morph_type == 'custom_form_priority') { + $parent_table = CustomFormPriority::find($this->morph_id); + if (isset($parent_table)) { + return $parent_table->custom_form->custom_table; + } + } + return null; + } + public function getConditionTargetAttribute() { return $this->getConditionTarget(); @@ -52,6 +63,7 @@ public function getConditionTextAttribute() return null; } + //$this->condition_item->setCustomTable($parent_table->custom_form->custom_table); return $this->condition_item->getConditionLabel($this) . ' : ' . $this->condition_item->getConditionText($this); }