当前位置: 首页>>代码示例>>PHP>>正文


PHP CBPDocument::StartWorkflowParametersValidate方法代码示例

本文整理汇总了PHP中CBPDocument::StartWorkflowParametersValidate方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPDocument::StartWorkflowParametersValidate方法的具体用法?PHP CBPDocument::StartWorkflowParametersValidate怎么用?PHP CBPDocument::StartWorkflowParametersValidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBPDocument的用法示例。


在下文中一共展示了CBPDocument::StartWorkflowParametersValidate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processActionCheckDataElementCreation


//.........这里部分代码省略.........
                         $props[$field["ID"]][$fileId]["del"] = "Y";
                     }
                 }
             }
         } elseif ($field["PROPERTY_TYPE"] == "N") {
             if (is_array($_POST[$fieldId]) && !array_key_exists("VALUE", $_POST[$fieldId])) {
                 $props[$field["ID"]] = array();
                 foreach ($_POST[$fieldId] as $key => $value) {
                     if (is_array($value)) {
                         if (strlen($value["VALUE"])) {
                             $value = str_replace(" ", "", str_replace(",", ".", $value["VALUE"]));
                             if (!is_numeric($value)) {
                                 $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
                                 $this->sendJsonErrorResponse();
                             }
                             $props[$field["ID"]][$key] = doubleval($value);
                         }
                     } else {
                         if (strlen($value)) {
                             $value = str_replace(" ", "", str_replace(",", ".", $value));
                             if (!is_numeric($value)) {
                                 $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
                                 $this->sendJsonErrorResponse();
                             }
                             $props[$field["ID"]][$key] = doubleval($value);
                         }
                     }
                 }
             } else {
                 if (is_array($_POST[$fieldId])) {
                     if (strlen($_POST[$fieldId]["VALUE"])) {
                         $value = str_replace(" ", "", str_replace(",", ".", $_POST[$fieldId]["VALUE"]));
                         if (!is_numeric($value)) {
                             $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
                             $this->sendJsonErrorResponse();
                         }
                         $props[$field["ID"]] = doubleval($value);
                     }
                 } else {
                     if (strlen($_POST[$fieldId])) {
                         $value = str_replace(" ", "", str_replace(",", ".", $_POST[$fieldId]));
                         if (!is_numeric($value)) {
                             $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
                             $this->sendJsonErrorResponse();
                         }
                         $props[$field["ID"]] = doubleval($value);
                     }
                 }
             }
         } else {
             $props[$field["ID"]] = $_POST[$fieldId];
         }
     }
     $elementData["MODIFIED_BY"] = $this->getUser()->getID();
     unset($elementData["TIMESTAMP_X"]);
     if (!empty($props)) {
         $elementData["PROPERTY_VALUES"] = $props;
     }
     $documentStates = CBPDocument::GetDocumentStates($documentType, null);
     $userId = $this->getUser()->getId();
     $write = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $userId, $documentType, array('AllUserGroups' => array(), 'DocumentStates' => $documentStates));
     if (!$write) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_ACCESS_DENIED_STATUS'))));
         $this->sendJsonErrorResponse();
     }
     $bizprocParametersValues = array();
     foreach ($documentStates as $documentState) {
         if (strlen($documentState["ID"]) <= 0) {
             $errors = array();
             $bizprocParametersValues[$documentState['TEMPLATE_ID']] = CBPDocument::StartWorkflowParametersValidate($documentState['TEMPLATE_ID'], $documentState['TEMPLATE_PARAMETERS'], $documentType, $errors);
             $stringError = '';
             foreach ($errors as $e) {
                 $stringError .= $e['message'] . '<br />';
             }
         }
     }
     if (!empty($stringError)) {
         $this->errorCollection->add(array(new Error($stringError)));
         $this->sendJsonErrorResponse();
     }
     $objectElement = new CIBlockElement();
     $idElement = $objectElement->Add($elementData, false, true, true);
     if ($idElement) {
         $bizProcWorkflowId = array();
         foreach ($documentStates as $documentState) {
             if (strlen($documentState["ID"]) <= 0) {
                 $errorsTmp = array();
                 $bizProcWorkflowId[$documentState['TEMPLATE_ID']] = CBPDocument::StartWorkflow($documentState['TEMPLATE_ID'], array('lists', 'BizprocDocument', $idElement), array_merge($bizprocParametersValues[$documentState['TEMPLATE_ID']], array('TargetUser' => 'user_' . intval($this->getUser()->getID()))), $errorsTmp);
             }
         }
         if (!empty($errorsTmp)) {
             $documentStates = null;
             CBPDocument::AddDocumentToHistory(array('lists', 'BizprocDocument', $idElement), $elementData['NAME'], $this->getUser()->getID());
         }
     } else {
         $this->errorCollection->add(array(new Error($objectElement->LAST_ERROR)));
         $this->sendJsonErrorResponse();
     }
     $this->sendJsonSuccessResponse(array());
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:ajax.php

示例2: CheckFields

 public function CheckFields($ID = false, $bAutoExec = false, $CreatedBy = 0, $arEntityAttr = array())
 {
     global $USER;
     $this->LAST_ERROR = '';
     if (!CModule::IncludeModule('bizproc')) {
         return true;
     }
     $this->arDocumentStates = CBPDocument::GetDocumentStates(array('crm', $this->sDocument, $this->sEntityType), $ID == false ? null : array('crm', $this->sDocument, $this->sEntityType . '_' . $ID));
     $arCurrentUserGroups = $this->arCurrentUserGroups;
     if (is_object($USER)) {
         if ($ID == false) {
             $arCurrentUserGroups[] = 'Author';
             $bCanWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), array('crm', $this->sDocument, $this->sEntityType), array('AllUserGroups' => $arCurrentUserGroups, 'DocumentStates' => $this->arDocumentStates, 'UserIsAdmin' => $USER->IsAdmin()));
         } else {
             if ($USER->GetID() == $CreatedBy) {
                 $arCurrentUserGroups[] = 'Author';
             }
             $bCanWrite = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), array('crm', $this->sDocument, $this->sEntityType . '_' . $ID), array('AllUserGroups' => $arCurrentUserGroups, 'DocumentStates' => $this->arDocumentStates, 'CreatedBy' => $CreatedBy != 0 ? $CreatedBy : 0, 'UserIsAdmin' => $USER->IsAdmin(), 'CRMEntityAttr' => $arEntityAttr));
         }
     } else {
         $bCanWrite = true;
     }
     if (!$bCanWrite) {
         $this->LAST_ERROR = GetMessage('CRM_PERMISSION_DENIED');
         return false;
     }
     $arBizProcParametersValues = array();
     foreach ($this->arDocumentStates as $arDocumentState) {
         if (strlen($arDocumentState['ID']) <= 0) {
             if ($bAutoExec) {
                 foreach ($arDocumentState['TEMPLATE_PARAMETERS'] as $parameterKey => $arParam) {
                     if ($arParam['Required'] && !isset($_REQUEST['bizproc' . $arDocumentState['TEMPLATE_ID'] . '_' . $parameterKey]) && strlen($arParam['Default']) > 0) {
                         $_REQUEST['bizproc' . $arDocumentState['TEMPLATE_ID'] . '_' . $parameterKey] = $arParam['Default'];
                     }
                 }
             }
             $arErrorsTmp = array();
             $arBizProcParametersValues[$arDocumentState['TEMPLATE_ID']] = CBPDocument::StartWorkflowParametersValidate($arDocumentState['TEMPLATE_ID'], $arDocumentState['TEMPLATE_PARAMETERS'], array('crm', $this->sDocument, $ID == false ? $this->sEntityType : $this->sEntityType . '_' . $ID), $arErrorsTmp);
             if (count($arErrorsTmp) > 0) {
                 $this->LAST_ERROR = '';
                 foreach ($arErrorsTmp as $e) {
                     $this->LAST_ERROR .= $e['message'] . '<br />';
                 }
                 return false;
             }
         }
     }
     return $arBizProcParametersValues;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:49,代码来源:crm_bizproc.php

示例3: array

 }
 if ($arResult["ELEMENT_ID"]) {
     $canWrite = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), BizProcDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], $arResult["ELEMENT_ID"]), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
 } else {
     $canWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), $documentType, array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
 }
 if (!$canWrite) {
     $strError = GetMessage("CC_BLEE_ACCESS_DENIED_STATUS");
 }
 if (!$strError) {
     $arBizProcParametersValues = array();
     foreach ($arDocumentStates as $arDocumentState) {
         if (strlen($arDocumentState["ID"]) <= 0) {
             $templatesOnStartup = true;
             $arErrorsTmp = array();
             $arBizProcParametersValues[$arDocumentState["TEMPLATE_ID"]] = CBPDocument::StartWorkflowParametersValidate($arDocumentState["TEMPLATE_ID"], $arDocumentState["TEMPLATE_PARAMETERS"], $documentType, $arErrorsTmp);
             foreach ($arErrorsTmp as $e) {
                 $strError .= $e["message"] . "<br />";
             }
         }
     }
     $templates = array_merge(\CBPWorkflowTemplateLoader::SearchTemplatesByDocumentType($documentType, CBPDocumentEventType::Create), \CBPWorkflowTemplateLoader::SearchTemplatesByDocumentType($documentType, CBPDocumentEventType::Edit));
     $error = false;
     foreach ($templates as $template) {
         if (!CBPWorkflowTemplateLoader::isConstantsTuned($template["ID"]) && !$error) {
             $error = true;
             $strError .= GetMessage('CC_BLEE_IS_CONSTANTS_TUNED') . "<br />";
             $arResult["isConstantsTuned"] = true;
         }
     }
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例4: array

					}
				}
				if ($bBizproc)
				{
					if($canWrite)
					{
						$arBizProcParametersValues = array();
						foreach ($arDocumentStates as $arDocumentState)
						{
							if (strlen($arDocumentState["ID"]) <= 0)
							{
								$arErrorsTmp = array();

								$arBizProcParametersValues[$arDocumentState["TEMPLATE_ID"]] = CBPDocument::StartWorkflowParametersValidate(
									$arDocumentState["TEMPLATE_ID"],
									$arDocumentState["TEMPLATE_PARAMETERS"],
									array(MODULE_ID, ENTITY, DOCUMENT_TYPE),
									$arErrorsTmp
								);

								if (!empty($arErrorsTmp))
								{
									foreach ($arErrorsTmp as $e)
										$strWarning .= $e["message"]."<br />";
								}
							}
						}
					}
					else
					{
						$strWarning .= GetMessage("IBLOCK_ACCESS_DENIED_STATUS")."<br />";
					}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:32,代码来源:iblock_element_edit.php

示例5: array

         $arCurrentUserGroups[] = "Author";
     }
     if ($arParams["ID"]) {
         $canWrite = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), array("iblock", "CIBlockDocument", $arParams["ID"]), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
     } else {
         $canWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), array("iblock", "CIBlockDocument", $DOCUMENT_TYPE), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
     }
     if (!$canWrite) {
         $arResult["ERRORS"][] = GetMessage("CC_BIEAF_ACCESS_DENIED_STATUS");
     }
     if (count($arResult["ERRORS"]) == 0) {
         $arBizProcParametersValues = array();
         foreach ($arDocumentStates as $arDocumentState) {
             if (strlen($arDocumentState["ID"]) <= 0) {
                 $arErrorsTmp = array();
                 $arBizProcParametersValues[$arDocumentState["TEMPLATE_ID"]] = CBPDocument::StartWorkflowParametersValidate($arDocumentState["TEMPLATE_ID"], $arDocumentState["TEMPLATE_PARAMETERS"], array("iblock", "CIBlockDocument", $DOCUMENT_TYPE), $arErrorsTmp);
                 foreach ($arErrorsTmp as $e) {
                     $arResult["ERRORS"][] = $e["message"];
                 }
             }
         }
     }
 }
 if (count($arResult["ERRORS"]) == 0) {
     if ($arParams["ELEMENT_ASSOC"] == "PROPERTY_ID") {
         $arUpdatePropertyValues[$arParams["ELEMENT_ASSOC_PROPERTY"]] = $USER->GetID();
     }
     $arUpdateValues["MODIFIED_BY"] = $USER->GetID();
     $arUpdateValues["PROPERTY_VALUES"] = $arUpdatePropertyValues;
     if ($bWorkflowIncluded && strlen($arParams["STATUS_NEW"]) > 0) {
         $arUpdateValues["WF_STATUS_ID"] = $arParams["STATUS_NEW"];
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:31,代码来源:component.php

示例6: StartWorkflowsParametersValidate

 /**
  * Метод - просто агрегатор действий по проверке корректности входных данных
  *
  * @param string $documentType - тип документа.
  * @param array $arDocumentStates - массив шаблонов БП документа.
  * @param array $arBizProcParametersValues - массив входных параметров для шаблонов.
  * @param array $arErrors - массив ошибок.
  */
 public function StartWorkflowsParametersValidate($documentType, $arDocumentStates, &$arBizProcParametersValues, &$arErrors)
 {
     $arBizProcParametersValues = array();
     $arDocumentStates = is_array($arDocumentStates) ? $arDocumentStates : array();
     foreach ($arDocumentStates as $arDocumentState) {
         if (strlen($arDocumentState["ID"]) <= 0) {
             $arErrorsTmp = array();
             $arBizProcParametersValues[$arDocumentState["TEMPLATE_ID"]] = CBPDocument::StartWorkflowParametersValidate($arDocumentState["TEMPLATE_ID"], $arDocumentState["TEMPLATE_PARAMETERS"], $documentType, $arErrorsTmp);
             foreach ($arErrorsTmp as $e) {
                 $arErrors[] = array("id" => "bizproc_validate", "text" => $e["message"]);
             }
         }
     }
     return empty($arErrors);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:23,代码来源:iblockbizproc.php


注:本文中的CBPDocument::StartWorkflowParametersValidate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。