public function Evaluate(CBPActivity $ownerActivity) { if ($this->condition == null || !is_array($this->condition) || count($this->condition) <= 0) { return true; } if (!is_array($this->condition[0])) { $this->condition = array($this->condition); } $rootActivity = $ownerActivity->GetRootActivity(); $result = array(0 => true); $i = 0; foreach ($this->condition as $cond) { $r = true; $joiner = empty($cond[3]) ? static::CONDITION_JOINER_AND : static::CONDITION_JOINER_OR; if ($rootActivity->IsPropertyExists($cond[0])) { if (!$this->CheckCondition($rootActivity->{$cond[0]}, $cond[1], $cond[2], $rootActivity->GetPropertyBaseType($cond[0]), $rootActivity)) { $r = false; } } elseif ($rootActivity->IsVariableExists($cond[0])) { if (!$this->CheckCondition($rootActivity->GetVariable($cond[0]), $cond[1], $cond[2], $rootActivity->GetVariableBaseType($cond[0]), $rootActivity)) { $r = false; } } if ($joiner == static::CONDITION_JOINER_OR) { ++$i; $result[$i] = $r; } elseif (!$r) { $result[$i] = false; } } $result = array_filter($result); return sizeof($result) > 0 ? true : false; }
public function Evaluate(CBPActivity $ownerActivity) { if ($this->condition == null || !is_array($this->condition) || count($this->condition) <= 0) { return true; } if (!is_array($this->condition[0])) { $this->condition = array($this->condition); } $rootActivity = $ownerActivity->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); $documentService = $ownerActivity->workflow->GetService("DocumentService"); $document = $documentService->GetDocument($documentId); $documentFields = $documentService->GetDocumentFields($documentService->GetDocumentType($documentId)); $result = false; foreach ($this->condition as $cond) { $result = true; if (array_key_exists($cond[0], $document)) { $fld = isset($document[$cond[0] . "_XML_ID"]) ? $document[$cond[0] . "_XML_ID"] : $document[$cond[0]]; if (!$this->CheckCondition($fld, $cond[1], $cond[2], $documentFields[$cond[0]]["BaseType"], $rootActivity)) { $result = false; break; } } else { throw new Exception("Field '" . $cond[0] . "' is not found in document (if/else condition)"); $result = false; break; } } return $result; }
public function Evaluate(CBPActivity $ownerActivity) { if ($this->condition == null || !is_array($this->condition) || count($this->condition) <= 0) { return true; } if (!is_array($this->condition[0])) { $this->condition = array($this->condition); } $rootActivity = $ownerActivity->GetRootActivity(); $result = true; foreach ($this->condition as $cond) { if ($rootActivity->IsPropertyExists($cond[0])) { if (!$this->CheckCondition($rootActivity->{$cond[0]}, $cond[1], $cond[2], $rootActivity->GetPropertyBaseType($cond[0]), $rootActivity)) { $result = false; break; } } elseif ($rootActivity->IsVariableExists($cond[0])) { if (!$this->CheckCondition($rootActivity->GetVariable($cond[0]), $cond[1], $cond[2], $rootActivity->GetVariableBaseType($cond[0]), $rootActivity)) { $result = false; break; } } } return $result; }
public function UnlockWorkflow(CBPActivity $rootActivity) { global $DB; if ($rootActivity == null) { throw new Exception("rootActivity"); } $DB->Query("UPDATE b_bp_instance_state SET " . "\tOWNER_ID = NULL, " . "\tOWNED_UNTIL = NULL " . "WHERE ID = '" . $DB->ForSql($rootActivity->GetWorkflowInstanceId()) . "' " . "\tAND ( " . "\t\t(OWNER_ID = '" . $DB->ForSql($this->serviceInstanceId) . "' " . "\t\t\tAND OWNED_UNTIL >= " . $DB->CurrentTimeFunction() . ") " . "\t\tOR " . "\t\t(OWNER_ID IS NULL) " . "\t\tOR " . "\t\t(OWNER_ID IS NOT NULL " . "\t\t\tAND OWNED_UNTIL < " . $DB->CurrentTimeFunction() . ") " . "\t)"); }
public function OnEvent(CBPActivity $sender, $arEventParameters = array()) { if ($sender == null) { throw new Exception("sender"); } $sender->RemoveStatusChangeHandler(self::ClosedEvent, $this); if (!$this->TryNextIteration()) { $this->workflow->CloseActivity($this); } }
public function OnEvent(CBPActivity $sender, $arEventParameters = array()) { $sender->RemoveStatusChangeHandler(self::ClosedEvent, $this); $bCloseActivity = false; if (is_a($sender, "CBPStateInitializationActivity")) { if (strlen($this->nextStateName) > 0) { $stateFinalization = null; for ($i = 0, $s = sizeof($this->arActivities); $i < $s; $i++) { if (is_a($this->arActivities[$i], "CBPStateFinalizationActivity")) { $stateFinalization = $this->arActivities[$i]; } } if ($stateFinalization != null) { $stateFinalization->AddStatusChangeHandler(self::ClosedEvent, $this); $this->workflow->ExecuteActivity($stateFinalization); } else { $bCloseActivity = true; } } else { //$stateService = $this->workflow->GetService("StateService"); //$stateService->SetStateParameters($this->GetWorkflowInstanceId(), $this->GetAvailableStateEvents()); $status = $this->ExecuteState(); if ($status != CBPActivityExecutionStatus::Executing) { $bCloseActivity = true; } } } elseif (is_a($sender, "CBPStateFinalizationActivity")) { $bCloseActivity = true; } else { $stateFinalization = null; if (strlen($this->nextStateName) > 0) { for ($i = 0, $s = sizeof($this->arActivities); $i < $s; $i++) { if (is_a($this->arActivities[$i], "CBPStateFinalizationActivity")) { $stateFinalization = $this->arActivities[$i]; } } } if ($stateFinalization != null) { $stateFinalization->AddStatusChangeHandler(self::ClosedEvent, $this); $this->workflow->ExecuteActivity($stateFinalization); } else { $bCloseActivity = true; } } if ($bCloseActivity) { $this->arActivityState = array(); $this->isListenTrigerred = false; $arEP = array(); if (strlen($this->nextStateName) > 0) { $arEP["NextStateName"] = $this->nextStateName; } $this->workflow->CloseActivity($this, $arEP); } }
public function OnEvent(CBPActivity $sender, $arEventParameters = array()) { $sender->RemoveStatusChangeHandler(self::ClosedEvent, $this); if ($this->executionStatus == CBPActivityExecutionStatus::Canceling || $this->executionStatus == CBPActivityExecutionStatus::Faulting) { $this->workflow->CloseActivity($this); } else { if ($this->executionStatus == CBPActivityExecutionStatus::Executing && !$this->TryScheduleNextChild($context)) { $this->OnSequenceComplete(); $this->workflow->CloseActivity($this); } } }
public function OnEvent(CBPActivity $sender, $arEventParameters = array()) { $sender->RemoveStatusChangeHandler(self::ClosedEvent, $this); $flag = true; for ($i = 0; $i < count($this->arActivities); $i++) { $activity = $this->arActivities[$i]; if ($activity->executionStatus != CBPActivityExecutionStatus::Initialized && $activity->executionStatus != CBPActivityExecutionStatus::Closed) { $flag = false; break; } } if ($flag) { $this->workflow->CloseActivity($this); } }
public function OnEvent(CBPActivity $sender, $arEventParameters = array()) { $sender->RemoveStatusChangeHandler(self::ClosedEvent, $this); if (array_key_exists("NextStateName", $arEventParameters) && strlen($arEventParameters["NextStateName"]) > 0) { $nextStateActivity = $this->GetStateActivityByName($arEventParameters["NextStateName"]); if ($nextStateActivity == null) { throw new Exception("nextStateActivity"); } $nextStateActivity->ReInitialize(); $nextStateActivity->AddStatusChangeHandler(self::ClosedEvent, $this); $this->workflow->ExecuteActivity($nextStateActivity); } else { $this->workflow->CloseActivity($this); } }
public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); if (strlen($arTestProperties["Text"]) <= 0) { $arErrors[] = array("code" => "emptyText", "message" => GetMessage("BPCAL_EMPTY_TEXT")); } return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); }
public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); if (strlen($arTestProperties["TargetStateName"]) <= 0) { $arErrors[] = array("code" => "emptyState", "parameter" => "TargetStateName", "message" => GetMessage('BPSSA_ERROR_EMPTY_STATE')); } return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); }
public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); if (!is_array($arTestProperties) || !array_key_exists("VariableValue", $arTestProperties) || !is_array($arTestProperties["VariableValue"]) || count($arTestProperties["VariableValue"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "VariableValue", "message" => GetMessage("BPSVA_EMPTY_VARS")); } return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); }
public static function ValidateProperties($testProperties = array(), CBPWorkflowTemplateUser $user = null) { $errors = array(); try { CBPHelper::ParseDocumentId($testProperties['DocumentType']); } catch (Exception $e) { $errors[] = array("code" => "NotExist", "parameter" => "DocumentType", "message" => GetMessage("BPCLDA_ERROR_DT")); } return array_merge($errors, parent::ValidateProperties($testProperties, $user)); }
public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); /* if (strlen($arTestProperties["TargetStateTitle"]) <= 0) { $arErrors[] = array("code" => "emptyState", "parameter" => "TargetStateTitle", "message" => "Bad target state."); } */ return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); }
public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); if (!array_key_exists('EventType', $arTestProperties) || strlen($arTestProperties['EventType']) <= 0) { $arErrors[] = array('code' => 'NotExist', 'parameter' => 'EventType', 'message' => GetMessage('BPEAA_EMPTY_TYPE')); } if (!array_key_exists('EventText', $arTestProperties) || strlen($arTestProperties['EventText']) <= 0) { $arErrors[] = array('code' => 'NotExist', 'EventText' => 'MessageText', 'message' => GetMessage('BPEAA_EMPTY_MESSAGE')); } return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); }
public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); if ($user == null || !$user->IsAdmin()) { $arErrors[] = array("code" => "perm", "message" => GetMessage("BPCA_NO_PERMS")); } if (strlen($arTestProperties["ExecuteCode"]) <= 0) { $arErrors[] = array("code" => "emptyCode", "message" => GetMessage("BPCA_EMPTY_CODE")); } return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); }
public function Evaluate(CBPActivity $ownerActivity) { if ($this->condition == null || !is_array($this->condition) || count($this->condition) <= 0) { return true; } if (!is_array($this->condition[0])) { $this->condition = array($this->condition); } $rootActivity = $ownerActivity->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); $documentService = $ownerActivity->workflow->GetService("DocumentService"); $document = $documentService->GetDocument($documentId); $documentFields = $documentService->GetDocumentFields($documentService->GetDocumentType($documentId)); $result = array(0 => true); $i = 0; foreach ($this->condition as $cond) { $r = true; $joiner = empty($cond[3]) ? static::CONDITION_JOINER_AND : static::CONDITION_JOINER_OR; if (!isset($document[$cond[0]]) && substr($cond[0], -strlen('_PRINTABLE')) == '_PRINTABLE') { $cond[0] = substr($cond[0], 0, strlen($cond[0]) - strlen('_PRINTABLE')); } if (array_key_exists($cond[0], $document)) { $fld = isset($document[$cond[0] . "_XML_ID"]) ? $document[$cond[0] . "_XML_ID"] : $document[$cond[0]]; if (!$this->CheckCondition($cond[0], $fld, $cond[1], $cond[2], $documentFields[$cond[0]]["BaseType"], $rootActivity)) { $r = false; } } else { throw new Exception("Field '" . $cond[0] . "' is not found in document (if/else condition)"); } if ($joiner == static::CONDITION_JOINER_OR) { ++$i; $result[$i] = $r; } elseif (!$r) { $result[$i] = false; } } $result = array_filter($result); return sizeof($result) > 0 ? true : false; }
public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); if (!array_key_exists("CalendarUser", $arTestProperties) || count($arTestProperties["CalendarUser"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "CalendarUser", "message" => GetMessage("BPSNMA_EMPTY_CALENDARUSER")); } if (!array_key_exists("CalendarName", $arTestProperties) || $arTestProperties["CalendarName"] == '') { $arErrors[] = array("code" => "NotExist", "parameter" => "CalendarName", "message" => GetMessage("BPSNMA_EMPTY_CALENDARNAME")); } if (!array_key_exists("CalendarFrom", $arTestProperties) || $arTestProperties["CalendarFrom"] == '') { $arErrors[] = array("code" => "NotExist", "parameter" => "CalendarFrom", "message" => GetMessage("BPSNMA_EMPTY_CALENDARFROM")); } return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); }
public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); if (!array_key_exists("GroupName", $arTestProperties) || strlen($arTestProperties["GroupName"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "GroupName", "message" => GetMessage("BPCWG_EMPTY_GROUP_NAME")); } if (!array_key_exists("OwnerId", $arTestProperties) || count($arTestProperties["OwnerId"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "OwnerId", "message" => GetMessage("BPCWG_EMPTY_OWNER")); } if (!array_key_exists("Users", $arTestProperties) || count($arTestProperties["Users"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "Users", "message" => GetMessage("BPCWG_EMPTY_USERS")); } return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); }
public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); if (!array_key_exists("MessageUserFrom", $arTestProperties) || count($arTestProperties["MessageUserFrom"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "MessageUserFrom", "message" => GetMessage("BPSNMA_EMPTY_FROM")); } if (!array_key_exists("MessageUserTo", $arTestProperties) || count($arTestProperties["MessageUserTo"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "MessageUserTo", "message" => GetMessage("BPSNMA_EMPTY_TO")); } if (!array_key_exists("MessageText", $arTestProperties) || strlen($arTestProperties["MessageText"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "MessageText", "message" => GetMessage("BPSNMA_EMPTY_MESSAGE")); } return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); }
public function Evaluate(CBPActivity $ownerActivity) { if ($this->condition == null || !is_array($this->condition) || count($this->condition) <= 0) { return true; } if (!is_array($this->condition[0])) { $this->condition = array($this->condition); } $rootActivity = $ownerActivity->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); $documentService = $ownerActivity->workflow->GetService("DocumentService"); $document = $documentService->GetDocument($documentId); $documentFields = $documentService->GetDocumentFields($documentService->GetDocumentType($documentId)); $result = true; foreach ($this->condition as $cond) { if (array_key_exists($cond[0], $document)) { if (!$this->CheckCondition($document[$cond[0]], $cond[1], $cond[2], $documentFields[$cond[0]]["BaseType"], $rootActivity)) { $result = false; break; } } } return $result; }
public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); if (!array_key_exists("MessageUserFrom", $arTestProperties) || count($arTestProperties["MessageUserFrom"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "MessageUserFrom", "message" => GetMessage("BPSNMA_EMPTY_FROM")); } if (!array_key_exists("MessageUserTo", $arTestProperties) || count($arTestProperties["MessageUserTo"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "MessageUserTo", "message" => GetMessage("BPSNMA_EMPTY_TO")); } if (!array_key_exists("MessageText", $arTestProperties) || strlen($arTestProperties["MessageText"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "MessageText", "message" => GetMessage("BPSNMA_EMPTY_MESSAGE")); } global $USER; if ($arTestProperties["MessageUserFrom"] != "user_" . $USER->GetID() && !$USER->IsAdmin() && !(CModule::IncludeModule("bitrix24") && CBitrix24::IsPortalAdmin($USER->GetID()))) { $arErrors[] = array("code" => "NotExist", "parameter" => "MessageUserFrom", "message" => GetMessage("BPSNMA_EMPTY_FROM")); } return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); }
public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); if (!array_key_exists("TaskAssignedTo", $arTestProperties) || count($arTestProperties["TaskAssignedTo"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "TaskAssignedTo", "message" => GetMessage("BPSNMA_EMPTY_TASKASSIGNEDTO")); } if (!array_key_exists("TaskName", $arTestProperties) || count($arTestProperties["TaskName"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "TaskName", "message" => GetMessage("BPSNMA_EMPTY_TASKNAME")); } if (!array_key_exists("TaskPriority", $arTestProperties) || strlen($arTestProperties["TaskPriority"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "TaskPriority", "message" => GetMessage("BPSNMA_EMPTY_TASKPRIORITY")); } if (!array_key_exists("TaskType", $arTestProperties) || strlen($arTestProperties["TaskType"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "TaskType", "message" => GetMessage("BPSNMA_EMPTY_TASKTYPE")); } //if (!array_key_exists("TaskOwnerId", $arTestProperties) || strlen($arTestProperties["TaskOwnerId"]) <= 0) // $arErrors[] = array("code" => "NotExist", "parameter" => "TaskOwnerId", "message" => GetMessage("BPSNMA_EMPTY_TASKOWNERID")); return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); }
/** * @param FieldType $fieldType * @param array $field * @param array $request * @return null|int */ protected static function extractValue(FieldType $fieldType, array $field, array $request) { $value = Base::extractValue($fieldType, $field, $request); if ($value !== null && is_string($value) && strlen($value) > 0) { if (\CBPActivity::isExpression($value)) { return $value; } $value = str_replace(' ', '', $value); if (preg_match('#^[0-9\\-]+$#', $value)) { $value = (int) $value; } else { $value = null; static::addError(array('code' => 'ErrorValue', 'message' => Loc::getMessage('BPDT_INT_INVALID'), 'parameter' => static::generateControlName($field))); } } else { $value = null; } return $value; }
public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); if (!array_key_exists("AbsenceUser", $arTestProperties) || count($arTestProperties["AbsenceUser"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "AbsenceUser", "message" => GetMessage("BPSNMA_EMPTY_ABSENCEUSER")); } if (!array_key_exists("AbsenceName", $arTestProperties) || count($arTestProperties["AbsenceName"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "AbsenceName", "message" => GetMessage("BPSNMA_EMPTY_ABSENCENAME")); } if (!array_key_exists("AbsenceFrom", $arTestProperties) || strlen($arTestProperties["AbsenceFrom"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "AbsenceFrom", "message" => GetMessage("BPSNMA_EMPTY_ABSENCEFROM")); } if (!array_key_exists("AbsenceTo", $arTestProperties) || strlen($arTestProperties["AbsenceTo"]) <= 0) { $arErrors[] = array("code" => "NotExist", "parameter" => "AbsenceTo", "message" => GetMessage("BPSNMA_EMPTY_ABSENCETO")); } $absenceIblockId = COption::GetOptionInt("intranet", 'iblock_absence', 0); $iblockPerm = CIBlock::GetPermission($absenceIblockId); if ($iblockPerm < "W") { $arErrors[] = array("code" => "perm", "message" => GetMessage("BPAA2_NO_PERMS")); } return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); }
private static function ImportTemplateChecker($arActivity, $user) { $arErrors = CBPActivity::CallStaticMethod($arActivity["Type"], "ValidateProperties", array($arActivity["Properties"], $user)); if (count($arErrors) > 0) { $m = ""; foreach ($arErrors as $er) { $m .= $er["message"] . ". "; } throw new Exception($m); return false; } return true; }
public function __construct($name) { parent::__construct($name); $this->arProperties = array("Title" => ""); }
public static function ValidateProperties($testProperties = array(), CBPWorkflowTemplateUser $user = null) { $errors = array(); $activityData = self::getRestActivityData(); $properties = isset($activityData['PROPERTIES']) && is_array($activityData['PROPERTIES']) ? $activityData['PROPERTIES'] : array(); foreach ($properties as $name => $property) { $value = isset($property['DEFAULT']) ? $property['DEFAULT'] : null; if (isset($testProperties[$name])) { $value = $testProperties[$name]; } if (CBPHelper::getBool($property['REQUIRED']) && CBPHelper::isEmptyValue($value)) { $errors[] = array('code' => 'NotExist', 'parameter' => $name, 'message' => Loc::getMessage('BPRA_PD_ERROR_EMPTY_PROPERTY', array('#NAME#' => RestActivityTable::getLocalization($property['NAME'], LANGUAGE_ID)))); } } if (isset($testProperties['AuthUserId']) && (string) $testProperties['AuthUserId'] !== $activityData['AUTH_USER_ID'] && !static::checkAdminPermissions()) { $errors[] = array('code' => 'NotExist', 'parameter' => 'AuthUserId', 'message' => Loc::getMessage('BPRA_PD_ERROR_EMPTY_PROPERTY', array('#NAME#' => Loc::getMessage('BPRA_PD_USER_ID')))); } return array_merge($errors, parent::ValidateProperties($testProperties, $user)); }
public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null) { $arErrors = array(); if (!array_key_exists("UserParameter", $arTestProperties)) { $bUsersFieldEmpty = true; } else { if (!is_array($arTestProperties["UserParameter"])) { $arTestProperties["UserParameter"] = array($arTestProperties["UserParameter"]); } $bUsersFieldEmpty = true; foreach ($arTestProperties["UserParameter"] as $userId) { if (!is_array($userId) && strlen(trim($userId)) > 0 || is_array($userId) && count($userId) > 0) { $bUsersFieldEmpty = false; break; } } } if ($bUsersFieldEmpty) { $arErrors[] = array("code" => "NotExist", "parameter" => "UserParameter", "message" => GetMessage("BPARGUA_ACT_PROP_EMPTY1")); } if (!array_key_exists("ReserveUserParameter", $arTestProperties)) { $bUsersFieldEmpty = true; } else { if (!is_array($arTestProperties["ReserveUserParameter"])) { $arTestProperties["ReserveUserParameter"] = array($arTestProperties["ReserveUserParameter"]); } $bUsersFieldEmpty = true; foreach ($arTestProperties["ReserveUserParameter"] as $userId) { if (!is_array($userId) && strlen(trim($userId)) > 0 || is_array($userId) && count($userId) > 0) { $bUsersFieldEmpty = false; break; } } } if ($bUsersFieldEmpty) { $arErrors[] = array("code" => "NotExist", "parameter" => "ReserveUserParameter", "message" => GetMessage("BPARGUA_ACT_PROP_EMPTY2")); } return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user)); }
private function RunQueuedItem(CBPActivity $activity, $activityOperation, Exception $exception = null) { if ($activityOperation == CBPActivityExecutorOperationType::Execute) { if ($activity->executionStatus == CBPActivityExecutionStatus::Executing) { try { $trackingService = $this->GetService("TrackingService"); $trackingService->Write($this->GetInstanceId(), CBPTrackingType::ExecuteActivity, $activity->GetName(), $activity->executionStatus, $activity->executionResult, $activity->IsPropertyExists("Title") ? $activity->Title : "", ""); $newStatus = $activity->Execute(); if ($newStatus == CBPActivityExecutionStatus::Closed) { $this->CloseActivity($activity); } elseif ($newStatus != CBPActivityExecutionStatus::Executing) { throw new Exception("InvalidExecutionStatus"); } } catch (Exception $e) { throw $e; } } } elseif ($activityOperation == CBPActivityExecutorOperationType::Cancel) { if ($activity->executionStatus == CBPActivityExecutionStatus::Canceling) { try { $trackingService = $this->GetService("TrackingService"); $trackingService->Write($this->GetInstanceId(), CBPTrackingType::CancelActivity, $activity->GetName(), $activity->executionStatus, $activity->executionResult, $activity->IsPropertyExists("Title") ? $activity->Title : "", ""); $newStatus = $activity->Cancel(); if ($newStatus == CBPActivityExecutionStatus::Closed) { $this->CloseActivity($activity); } elseif ($newStatus != CBPActivityExecutionStatus::Canceling) { throw new Exception("InvalidExecutionStatus"); } } catch (Exception $e) { throw $e; } } } elseif ($activityOperation == CBPActivityExecutorOperationType::HandleFault) { if ($activity->executionStatus == CBPActivityExecutionStatus::Faulting) { try { $trackingService = $this->GetService("TrackingService"); $trackingService->Write($this->GetInstanceId(), CBPTrackingType::FaultActivity, $activity->GetName(), $activity->executionStatus, $activity->executionResult, $activity->IsPropertyExists("Title") ? $activity->Title : "", $exception != null ? "[" . $exception->getCode() . "] " . $exception->getMessage() : ""); $newStatus = $activity->HandleFault($exception); if ($newStatus == CBPActivityExecutionStatus::Closed) { $this->CloseActivity($activity); } elseif ($newStatus != CBPActivityExecutionStatus::Faulting) { throw new Exception("InvalidExecutionStatus"); } } catch (Exception $e) { throw $e; } } } }