ProcessMaker-MA "Web Entry (Fixes)"

- Se han completado validaciones al crear un Web Entry
This commit is contained in:
Victor Saisa Lopez
2014-02-07 14:52:35 -04:00
parent 4d71995da7
commit 52f195a804
4 changed files with 173 additions and 77 deletions

View File

@@ -364,6 +364,40 @@ class Process
}
}
/**
* Verify if doesn't exist the Task in table TASK
*
* @param string $processUid Unique id of Process
* @param string $taskUid Unique id of Task
* @param string $fieldNameForException Field name for the exception
*
* return void Throw exception if doesn't exist the Task in table TASK
*/
public function throwExceptionIfNotExistsTask($processUid, $taskUid, $fieldNameForException)
{
try {
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\TaskPeer::TAS_UID);
if ($processUid != "") {
$criteria->add(\TaskPeer::PRO_UID, $processUid, \Criteria::EQUAL);
}
$criteria->add(\TaskPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
$rsCriteria = \TaskPeer::doSelectRS($criteria);
if (!$rsCriteria->next()) {
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $taskUid), "The activity with {0}: {1}, does not exist");
throw (new \Exception($msg));
}
} catch (\Exception $e) {
throw $e;
}
}
/**
* Verify if doesn't exist the DynaForm in table DYNAFORM
*
@@ -1433,14 +1467,10 @@ class Process
$arrayWebEntry = array();
//Verify data
$process = new \Process();
if (!$process->exists($processUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}")));
}
//Get data
$webEntry = new \BusinessModel\WebEntry();
$webEntry->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
$webEntry->setArrayFieldNameForException($this->arrayFieldNameForException);
$arrayWebEntryData = $webEntry->getData($processUid);