diff --git a/workflow/engine/classes/model/Dynaform.php b/workflow/engine/classes/model/Dynaform.php index 17df6b4eb..caabc423c 100755 --- a/workflow/engine/classes/model/Dynaform.php +++ b/workflow/engine/classes/model/Dynaform.php @@ -170,6 +170,10 @@ class Dynaform extends BaseDynaform $this->setDynType( isset( $aData['DYN_TYPE'] ) ? $aData['DYN_TYPE'] : 'xmlform' ); $this->setDynFilename( $aData['PRO_UID'] . PATH_SEP . $dynUid ); + if (isset($aData["DYN_CONTENT"])) { + $this->setDynContent($aData["DYN_CONTENT"]); + } + if ($this->validate()) { $con->begin(); $res = $this->save(); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php b/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php index 3df12da50..753790aef 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php @@ -8,7 +8,8 @@ class DynaForm "DYN_TITLE" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "dynaFormTitle"), "DYN_DESCRIPTION" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "dynaFormDescription"), - "DYN_TYPE" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array("xmlform", "grid"), "fieldNameAux" => "dynaFormType") + "DYN_TYPE" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array("xmlform", "grid"), "fieldNameAux" => "dynaFormType"), + "DYN_CONTENT" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "dynaFormContent") ); private $formatFieldNameInUppercase = true; @@ -367,10 +368,6 @@ class DynaForm $dynaFormUid = $dynaForm->create($arrayData); - $oDynaform = \DynaformPeer::retrieveByPK( $dynaFormUid ); - $oDynaform->setDynContent( $arrayData['DYN_CONTENT'] ); - $oDynaform->save(); - //Return unset($arrayData["PRO_UID"]); @@ -959,7 +956,7 @@ class DynaForm $this->getFieldNameByFormatFieldName("DYN_TITLE") => $record["DYN_TITLE"], $this->getFieldNameByFormatFieldName("DYN_DESCRIPTION") => $record["DYN_DESCRIPTION"] . "", $this->getFieldNameByFormatFieldName("DYN_TYPE") => $record["DYN_TYPE"] . "", - $this->getFieldNameByFormatFieldName("DYN_CONTENT") => $record["DYN_CONTENT"] . "" + $this->getFieldNameByFormatFieldName("DYN_CONTENT") => $record["DYN_CONTENT"] . "" ); } catch (\Exception $e) { throw $e; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php index 9c4c92d0d..3c74065e7 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php @@ -136,6 +136,68 @@ class InputDocument } } + /** + * Verify if the InputDocument it's assigned in other objects + * + * @param string $inputDocumentUid Unique id of InputDocument + * + * return array Return array (true if it's assigned or false otherwise and data) + */ + public function itsAssignedInOtherObjects($inputDocumentUid) + { + try { + $flagAssigned = false; + $arrayData = array(); + + //Step + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\StepPeer::STEP_UID); + $criteria->add(\StepPeer::STEP_TYPE_OBJ, "INPUT_DOCUMENT", \Criteria::EQUAL); + $criteria->add(\StepPeer::STEP_UID_OBJ, $inputDocumentUid, \Criteria::EQUAL); + + $rsCriteria = \StepPeer::doSelectRS($criteria); + + if ($rsCriteria->next()) { + $flagAssigned = true; + $arrayData[] = \G::LoadTranslation("ID_STEPS"); + } + + //StepSupervisor + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\StepSupervisorPeer::STEP_UID); + $criteria->add(\StepSupervisorPeer::STEP_TYPE_OBJ, "INPUT_DOCUMENT", \Criteria::EQUAL); + $criteria->add(\StepSupervisorPeer::STEP_UID_OBJ, $inputDocumentUid, \Criteria::EQUAL); + + $rsCriteria = \StepSupervisorPeer::doSelectRS($criteria); + + if ($rsCriteria->next()) { + $flagAssigned = true; + $arrayData[] = \G::LoadTranslation("ID_CASES_MENU_ADMIN"); + } + + //ObjectPermission + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\ObjectPermissionPeer::OP_UID); + $criteria->add(\ObjectPermissionPeer::OP_OBJ_TYPE, "INPUT", \Criteria::EQUAL); + $criteria->add(\ObjectPermissionPeer::OP_OBJ_UID, $inputDocumentUid, \Criteria::EQUAL); + + $rsCriteria = \ObjectPermissionPeer::doSelectRS($criteria); + + if ($rsCriteria->next()) { + $flagAssigned = true; + $arrayData[] = \G::LoadTranslation("ID_PROCESS_PERMISSIONS"); + } + + //Return + return array($flagAssigned, $arrayData); + } catch (\Exception $e) { + throw $e; + } + } + /** * Verify if doesn't exists the InputDocument in table INPUT_DOCUMENT * @@ -189,6 +251,27 @@ class InputDocument } } + /** + * Verify if the InputDocument it's assigned in other objects + * + * @param string $inputDocumentUid Unique id of InputDocument + * @param string $fieldNameForException Field name for the exception + * + * return void Throw exception if the InputDocument it's assigned in other objects + */ + public function throwExceptionIfItsAssignedInOtherObjects($inputDocumentUid, $fieldNameForException) + { + try { + list($flagAssigned, $arrayData) = $this->itsAssignedInOtherObjects($inputDocumentUid); + + if ($flagAssigned) { + throw new \Exception(\G::LoadTranslation("ID_INPUT_DOCUMENT_ITS_ASSIGNED", array($fieldNameForException, $inputDocumentUid, implode(", ", $arrayData)))); + } + } catch (\Exception $e) { + throw $e; + } + } + /** * Create InputDocument for a Process * @@ -313,6 +396,8 @@ class InputDocument //Verify data $this->throwExceptionIfNotExistsInputDocument($inputDocumentUid, "", $this->arrayFieldNameForException["inputDocumentUid"]); + $this->throwExceptionIfItsAssignedInOtherObjects($inputDocumentUid, $this->arrayFieldNameForException["inputDocumentUid"]); + //Delete //StepSupervisor $stepSupervisor = new \StepSupervisor(); diff --git a/workflow/engine/templates/services/login_getStarted.html b/workflow/engine/templates/services/login_getStarted.html index ed5e69183..2ccc6f855 100755 --- a/workflow/engine/templates/services/login_getStarted.html +++ b/workflow/engine/templates/services/login_getStarted.html @@ -68,9 +68,8 @@ - Get Started

Welcome to ProcessMaker!

-

To get started, log in using the following credentials. You can change them later:

+

To get started, log in using the following credentials. You can change them later:

Username: {name}
Password: The password introduced at the time of installing the application

We suggest you follow our 7 easy videos to automate your workflow. You can see a demo of each step at http://www.processmaker.com/demos/

diff --git a/workflow/public_html/images/get_started.png b/workflow/public_html/images/get_started.png index 75fc396d3..e82a0e999 100755 Binary files a/workflow/public_html/images/get_started.png and b/workflow/public_html/images/get_started.png differ