From ffcbbe3d025e088c890d6cf9d92c9c9f0c432fba Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Mon, 30 Aug 2021 23:21:16 +0200 Subject: [PATCH] building status is now set with workflow finish value (configurable) --- application/Pipework/PipeworkController.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/application/Pipework/PipeworkController.php b/application/Pipework/PipeworkController.php index bd4efa6d0..384564051 100644 --- a/application/Pipework/PipeworkController.php +++ b/application/Pipework/PipeworkController.php @@ -192,6 +192,20 @@ class PipeworkController extends mfBaseController { } } + // set building status if Status field was set + if(defined("TT_WORKFLOW_ITEM_STATUS_FIELD") && defined("TT_WORKFLOW_ITEM_STATUS_VALUE_PASSED") && defined("TT_WORKFLOW_ITEM_STATUS_VALUE_CONNECTED")) { + $status_value = $building->workflowitems[TT_WORKFLOW_ITEM_STATUS_FIELD]->value->value_string; + //var_dump($status_value);exit; + if($status_value == TT_WORKFLOW_ITEM_STATUS_VALUE_PASSED) { + $building->status_id = 4; + $building->save(); + } + if($status_value == TT_WORKFLOW_ITEM_STATUS_VALUE_CONNECTED) { + $building->status_id = 5; + $building->save(); + } + } + // file upload if(array_key_exists("PipeworkFileUpload", $_FILES) && !$_FILES['PipeworkFileUpload']['error']) {