Merged in victorsl/processmaker (pull request #351)
ProcessMaker "Calendar (endpoints)"
This commit is contained in:
@@ -4,14 +4,29 @@ namespace BusinessModel;
|
||||
class Calendar
|
||||
{
|
||||
private $arrayFieldDefinition = array(
|
||||
"CAL_UID" => array("fieldName" => "CALENDAR_UID", "type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "calendarUid"),
|
||||
"CAL_UID" => array("fieldName" => "CALENDAR_UID", "type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "calendarUid"),
|
||||
|
||||
"CAL_NAME" => array("fieldName" => "CALENDAR_NAME", "type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "calendarName"),
|
||||
"CAL_DESCRIPTION" => array("fieldName" => "CALENDAR_DESCRIPTION", "type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "calendarDescription"),
|
||||
"CAL_CREATE_DATE" => array("fieldName" => "CALENDAR_CREATE_DATE", "type" => "datetime", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "calendarCreateDate"),
|
||||
"CAL_UPDATE_DATE" => array("fieldName" => "CALENDAR_UPDATE_DATE", "type" => "datetime", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "calendarUpdateDate"),
|
||||
"CAL_WORK_DAYS" => array("fieldName" => "CALENDAR_WORK_DAYS", "type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "calendarWorkDays"),
|
||||
"CAL_STATUS" => array("fieldName" => "CALENDAR_STATUS", "type" => "string", "required" => true, "empty" => false, "defaultValues" => array("ACTIVE", "INACTIVE"), "fieldNameAux" => "calendarStatus")
|
||||
"CAL_NAME" => array("fieldName" => "CALENDAR_NAME", "type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "calendarName"),
|
||||
"CAL_DESCRIPTION" => array("fieldName" => "CALENDAR_DESCRIPTION", "type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "calendarDescription"),
|
||||
"CAL_WORK_DAYS" => array("fieldName" => "CALENDAR_WORK_DAYS", "type" => "array", "required" => true, "empty" => false, "defaultValues" => array("SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"), "fieldNameAux" => "calendarWorkDays"),
|
||||
"CAL_STATUS" => array("fieldName" => "CALENDAR_STATUS", "type" => "string", "required" => true, "empty" => false, "defaultValues" => array("ACTIVE", "INACTIVE"), "fieldNameAux" => "calendarStatus"),
|
||||
"CAL_WORK_HOUR" => array("fieldName" => "CALENDAR_WORK_HOUR", "type" => "array", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "calendarWorkHour"),
|
||||
"CAL_HOLIDAY" => array("fieldName" => "CALENDAR_HOLIDAY", "type" => "array", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "calendarHoliday"),
|
||||
|
||||
"CAL_CREATE_DATE" => array("fieldName" => "CALENDAR_CREATE_DATE", "type" => "datetime", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "calendarCreateDate"),
|
||||
"CAL_UPDATE_DATE" => array("fieldName" => "CALENDAR_UPDATE_DATE", "type" => "datetime", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "calendarUpdateDate")
|
||||
);
|
||||
|
||||
private $arrayWorkHourFieldDefinition = array(
|
||||
"DAY" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array("SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT", "ALL"), "fieldNameAux" => "day"),
|
||||
"HOUR_START" => array("type" => "hour", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "hourStart"),
|
||||
"HOUR_END" => array("type" => "hour", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "hourEnd")
|
||||
);
|
||||
|
||||
private $arrayHolidayFieldDefinition = array(
|
||||
"NAME" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "name"),
|
||||
"DATE_START" => array("type" => "date", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "dateStart"),
|
||||
"DATE_END" => array("type" => "date", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "dateEnd")
|
||||
);
|
||||
|
||||
private $formatFieldNameInUppercase = true;
|
||||
@@ -21,6 +36,8 @@ class Calendar
|
||||
"start" => "START",
|
||||
"limit" => "LIMIT"
|
||||
);
|
||||
private $arrayWorkHourFieldNameForException = array();
|
||||
private $arrayHolidayFieldNameForException = array();
|
||||
|
||||
/**
|
||||
* Constructor of the class
|
||||
@@ -33,6 +50,14 @@ class Calendar
|
||||
foreach ($this->arrayFieldDefinition as $key => $value) {
|
||||
$this->arrayFieldNameForException[$value["fieldNameAux"]] = $key;
|
||||
}
|
||||
|
||||
foreach ($this->arrayWorkHourFieldDefinition as $key => $value) {
|
||||
$this->arrayWorkHourFieldNameForException[$value["fieldNameAux"]] = $key;
|
||||
}
|
||||
|
||||
foreach ($this->arrayHolidayFieldDefinition as $key => $value) {
|
||||
$this->arrayHolidayFieldNameForException[$value["fieldNameAux"]] = $key;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -51,6 +76,8 @@ class Calendar
|
||||
$this->formatFieldNameInUppercase = $flag;
|
||||
|
||||
$this->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||
$this->setArrayWorkHourFieldNameForException($this->arrayWorkHourFieldNameForException);
|
||||
$this->setArrayHolidayFieldNameForException($this->arrayHolidayFieldNameForException);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -74,6 +101,42 @@ class Calendar
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set exception messages for fields
|
||||
*
|
||||
* @param array $arrayData Data with the fields
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function setArrayWorkHourFieldNameForException($arrayData)
|
||||
{
|
||||
try {
|
||||
foreach ($arrayData as $key => $value) {
|
||||
$this->arrayWorkHourFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set exception messages for fields
|
||||
*
|
||||
* @param array $arrayData Data with the fields
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function setArrayHolidayFieldNameForException($arrayData)
|
||||
{
|
||||
try {
|
||||
foreach ($arrayData as $key => $value) {
|
||||
$this->arrayHolidayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the field according to the format
|
||||
*
|
||||
@@ -90,6 +153,199 @@ class Calendar
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if exists the name of a Calendar
|
||||
*
|
||||
* @param string $calendarName Name
|
||||
* @param string $calendarUidExclude Unique id of Calendar to exclude
|
||||
*
|
||||
* return bool Return true if exists the name of a Calendar, false otherwise
|
||||
*/
|
||||
public function existsName($calendarName, $calendarUidExclude = "")
|
||||
{
|
||||
try {
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\CalendarDefinitionPeer::CALENDAR_UID);
|
||||
$criteria->add(\CalendarDefinitionPeer::CALENDAR_STATUS, "DELETED", \Criteria::NOT_EQUAL);
|
||||
|
||||
if ($calendarUidExclude != "") {
|
||||
$criteria->add(\CalendarDefinitionPeer::CALENDAR_UID, $calendarUidExclude, \Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
$criteria->add(\CalendarDefinitionPeer::CALENDAR_NAME, $calendarName, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \CalendarDefinitionPeer::doSelectRS($criteria);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace and Get Work Days
|
||||
*
|
||||
* @param string $workDays Work days
|
||||
* @param bool $toNumber If is true replace to numbers, replace to string otherwise
|
||||
*
|
||||
* return string Return Work days
|
||||
*/
|
||||
public function workDaysReplaceData($workDays, $toNumber = true)
|
||||
{
|
||||
try {
|
||||
$arrayDayString = array("SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT", "ALL");
|
||||
$arrayDayNumber = array(0, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
||||
return ($toNumber)? str_replace($arrayDayString, $arrayDayNumber, $workDays) : str_replace($arrayDayNumber, $arrayDayString, $workDays);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if doesn't exists the Calendar in table CALENDAR_DEFINITION
|
||||
*
|
||||
* @param string $calendarUid Unique id of Calendar
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
*
|
||||
* return void Throw exception if doesn't exists the Calendar in table CALENDAR_DEFINITION
|
||||
*/
|
||||
public function throwExceptionIfNotExistsCalendar($calendarUid, $fieldNameForException)
|
||||
{
|
||||
try {
|
||||
$obj = \CalendarDefinitionPeer::retrieveByPK($calendarUid);
|
||||
|
||||
if (!(is_object($obj) && get_class($obj) == "CalendarDefinition")) {
|
||||
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $calendarUid), "The calendar with {0}: {1} does not exists");
|
||||
|
||||
throw (new \Exception($msg));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if exists the name of a Calendar
|
||||
*
|
||||
* @param string $calendarName Name
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
* @param string $calendarUidExclude Unique id of Calendar to exclude
|
||||
*
|
||||
* return void Throw exception if exists the name of a Calendar
|
||||
*/
|
||||
public function throwExceptionIfExistsName($calendarName, $fieldNameForException, $calendarUidExclude = "")
|
||||
{
|
||||
try {
|
||||
if ($this->existsName($calendarName, $calendarUidExclude)) {
|
||||
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $calendarName), "The calendar name with {0}: \"{1}\" already exists");
|
||||
|
||||
throw (new \Exception($msg));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Group
|
||||
*
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data of the new Group created
|
||||
*/
|
||||
public function create($arrayData)
|
||||
{
|
||||
try {
|
||||
$arrayData = \G::array_change_key_case2($arrayData, CASE_UPPER);
|
||||
|
||||
unset($arrayData["CAL_UID"]);
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true);
|
||||
|
||||
$this->throwExceptionIfExistsName($arrayData["CAL_NAME"], $this->arrayFieldNameForException["calendarName"]);
|
||||
|
||||
if (!(count($arrayData["CAL_WORK_DAYS"]) >= 3)) {
|
||||
throw (new \Exception(\G::LoadTranslation("ID_MOST_AT_LEAST_3_DAY")));
|
||||
}
|
||||
|
||||
if (isset($arrayData["CAL_WORK_HOUR"])) {
|
||||
foreach ($arrayData["CAL_WORK_HOUR"] as $value) {
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($value, $this->arrayWorkHourFieldDefinition, $this->arrayWorkHourFieldNameForException, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arrayData["CAL_HOLIDAY"])) {
|
||||
foreach ($arrayData["CAL_HOLIDAY"] as $value) {
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($value, $this->arrayHolidayFieldDefinition, $this->arrayHolidayFieldNameForException, true);
|
||||
}
|
||||
}
|
||||
|
||||
//Set variables
|
||||
$arrayCalendarWorkHour = array();
|
||||
|
||||
if (isset($arrayData["CAL_WORK_HOUR"])) {
|
||||
foreach ($arrayData["CAL_WORK_HOUR"] as $value) {
|
||||
$arrayCalendarWorkHour[] = array(
|
||||
"CALENDAR_BUSINESS_DAY" => $this->workDaysReplaceData($value["DAY"]),
|
||||
"CALENDAR_BUSINESS_START" => $value["HOUR_START"],
|
||||
"CALENDAR_BUSINESS_END" => $value["HOUR_END"]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$arrayCalendarHoliday = array();
|
||||
|
||||
if (isset($arrayData["CAL_HOLIDAY"])) {
|
||||
foreach ($arrayData["CAL_HOLIDAY"] as $value) {
|
||||
$arrayCalendarHoliday[] = array(
|
||||
"CALENDAR_HOLIDAY_NAME" => $value["NAME"],
|
||||
"CALENDAR_HOLIDAY_START" => $value["DATE_START"],
|
||||
"CALENDAR_HOLIDAY_END" => $value["DATE_END"]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$arrayDataAux = array();
|
||||
$arrayDataAux["CALENDAR_UID"] = \G::generateUniqueID();
|
||||
$arrayDataAux["CALENDAR_NAME"] = $arrayData["CAL_NAME"];
|
||||
|
||||
if (isset($arrayData["CAL_DESCRIPTION"])) {
|
||||
$arrayDataAux["CALENDAR_DESCRIPTION"] = $arrayData["CAL_DESCRIPTION"];
|
||||
}
|
||||
|
||||
$arrayDataAux["CALENDAR_WORK_DAYS"] = explode("|", $this->workDaysReplaceData(implode("|", $arrayData["CAL_WORK_DAYS"])));
|
||||
$arrayDataAux["CALENDAR_STATUS"] = $arrayData["CAL_STATUS"];
|
||||
|
||||
$arrayDataAux["BUSINESS_DAY"] = $arrayCalendarWorkHour;
|
||||
$arrayDataAux["HOLIDAY"] = $arrayCalendarHoliday;
|
||||
|
||||
//Create
|
||||
$calendarDefinition = new \CalendarDefinition();
|
||||
|
||||
$calendarDefinition->saveCalendarInfo($arrayDataAux);
|
||||
|
||||
//Return
|
||||
$arrayData = array_merge(array("CAL_UID" => $arrayDataAux["CALENDAR_UID"]), $arrayData);
|
||||
|
||||
if (!$this->formatFieldNameInUppercase) {
|
||||
$arrayData = \G::array_change_key_case2($arrayData, CASE_LOWER);
|
||||
}
|
||||
|
||||
return $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get criteria for Calendar
|
||||
*
|
||||
@@ -103,10 +359,10 @@ class Calendar
|
||||
$criteria->addSelectColumn(\CalendarDefinitionPeer::CALENDAR_UID);
|
||||
$criteria->addSelectColumn(\CalendarDefinitionPeer::CALENDAR_NAME);
|
||||
$criteria->addSelectColumn(\CalendarDefinitionPeer::CALENDAR_DESCRIPTION);
|
||||
$criteria->addSelectColumn(\CalendarDefinitionPeer::CALENDAR_CREATE_DATE);
|
||||
$criteria->addSelectColumn(\CalendarDefinitionPeer::CALENDAR_UPDATE_DATE);
|
||||
$criteria->addSelectColumn(\CalendarDefinitionPeer::CALENDAR_WORK_DAYS);
|
||||
$criteria->addSelectColumn(\CalendarDefinitionPeer::CALENDAR_STATUS);
|
||||
$criteria->addSelectColumn(\CalendarDefinitionPeer::CALENDAR_CREATE_DATE);
|
||||
$criteria->addSelectColumn(\CalendarDefinitionPeer::CALENDAR_UPDATE_DATE);
|
||||
$criteria->add(\CalendarDefinitionPeer::CALENDAR_STATUS, "DELETED", \Criteria::NOT_EQUAL);
|
||||
|
||||
return $criteria;
|
||||
@@ -125,14 +381,41 @@ class Calendar
|
||||
public function getCalendarDataFromRecord($record)
|
||||
{
|
||||
try {
|
||||
$calendarBusinessHours = new \CalendarBusinessHours();
|
||||
$calendarHolidays = new \CalendarHolidays();
|
||||
|
||||
$arrayCalendarWorkHour = array();
|
||||
$arrayData = $calendarBusinessHours->getCalendarBusinessHours($record["CALENDAR_UID"]);
|
||||
|
||||
foreach ($arrayData as $value) {
|
||||
$arrayCalendarWorkHour[] = array(
|
||||
$this->getFieldNameByFormatFieldName("DAY") => $this->workDaysReplaceData($value["CALENDAR_BUSINESS_DAY"] . "", false),
|
||||
$this->getFieldNameByFormatFieldName("HOUR_START") => $value["CALENDAR_BUSINESS_START"] . "",
|
||||
$this->getFieldNameByFormatFieldName("HOUR_END") => $value["CALENDAR_BUSINESS_END"] . "",
|
||||
);
|
||||
}
|
||||
|
||||
$arrayCalendarHoliday = array();
|
||||
$arrayData = $calendarHolidays->getCalendarHolidays($record["CALENDAR_UID"]);
|
||||
|
||||
foreach ($arrayData as $value) {
|
||||
$arrayCalendarHoliday[] = array(
|
||||
$this->getFieldNameByFormatFieldName("NAME") => $value["CALENDAR_HOLIDAY_NAME"] . "",
|
||||
$this->getFieldNameByFormatFieldName("DATE_START") => $value["CALENDAR_HOLIDAY_START"] . "",
|
||||
$this->getFieldNameByFormatFieldName("DATE_END") => $value["CALENDAR_HOLIDAY_END"] . "",
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
$this->getFieldNameByFormatFieldName("CAL_UID") => $record["CALENDAR_UID"],
|
||||
$this->getFieldNameByFormatFieldName("CAL_NAME") => $record["CALENDAR_NAME"],
|
||||
$this->getFieldNameByFormatFieldName("CAL_DESCRIPTION") => $record["CALENDAR_DESCRIPTION"] . "",
|
||||
$this->getFieldNameByFormatFieldName("CAL_WORK_DAYS") => explode("|", $this->workDaysReplaceData($record["CALENDAR_WORK_DAYS"] . "", false)),
|
||||
$this->getFieldNameByFormatFieldName("CAL_STATUS") => $record["CALENDAR_STATUS"],
|
||||
$this->getFieldNameByFormatFieldName("CAL_WORK_HOUR") => $arrayCalendarWorkHour,
|
||||
$this->getFieldNameByFormatFieldName("CAL_HOLIDAY") => $arrayCalendarHoliday,
|
||||
$this->getFieldNameByFormatFieldName("CAL_CREATE_DATE") => $record["CALENDAR_CREATE_DATE"] . "",
|
||||
$this->getFieldNameByFormatFieldName("CAL_UPDATE_DATE") => $record["CALENDAR_UPDATE_DATE"] . "",
|
||||
$this->getFieldNameByFormatFieldName("CAL_WORK_DAYS") => $record["CALENDAR_WORK_DAYS"] . "",
|
||||
$this->getFieldNameByFormatFieldName("CAL_STATUS") => $record["CALENDAR_STATUS"],
|
||||
$this->getFieldNameByFormatFieldName("CAL_TOTAL_USERS") => (int)($record["CALENDAR_TOTAL_USERS"]),
|
||||
$this->getFieldNameByFormatFieldName("CAL_TOTAL_PROCESSES") => (int)($record["CALENDAR_TOTAL_PROCESSES"]),
|
||||
$this->getFieldNameByFormatFieldName("CAL_TOTAL_TASKS") => (int)($record["CALENDAR_TOTAL_TASKS"])
|
||||
@@ -205,10 +488,10 @@ class Calendar
|
||||
case "CALENDAR_UID":
|
||||
case "CALENDAR_NAME":
|
||||
case "CALENDAR_DESCRIPTION":
|
||||
case "CALENDAR_CREATE_DATE":
|
||||
case "CALENDAR_UPDATE_DATE":
|
||||
case "CALENDAR_WORK_DAYS":
|
||||
case "CALENDAR_STATUS":
|
||||
case "CALENDAR_CREATE_DATE":
|
||||
case "CALENDAR_UPDATE_DATE":
|
||||
$sortField = \CalendarDefinitionPeer::TABLE_NAME . "." . $sortField;
|
||||
break;
|
||||
default:
|
||||
@@ -252,5 +535,49 @@ class Calendar
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data of a Calendar
|
||||
*
|
||||
* @param string $calendarUid Unique id of Calendar
|
||||
*
|
||||
* return array Return an array with data of a Calendar
|
||||
*/
|
||||
public function getCalendar($calendarUid)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsCalendar($calendarUid, $this->arrayFieldNameForException["calendarUid"]);
|
||||
|
||||
//Get data
|
||||
//Set variables
|
||||
$calendar = new \CalendarDefinition();
|
||||
|
||||
$arrayTotalUsersByCalendar = $calendar->getAllCounterByCalendar("USER");
|
||||
$arrayTotalProcessesByCalendar = $calendar->getAllCounterByCalendar("PROCESS");
|
||||
$arrayTotalTasksByCalendar = $calendar->getAllCounterByCalendar("TASK");
|
||||
|
||||
//SQL
|
||||
$criteria = $this->getCalendarCriteria();
|
||||
|
||||
$criteria->add(\CalendarDefinitionPeer::CALENDAR_UID, $calendarUid, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \CalendarDefinitionPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$rsCriteria->next();
|
||||
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$row["CALENDAR_TOTAL_USERS"] = (isset($arrayTotalUsersByCalendar[$calendarUid]))? $arrayTotalUsersByCalendar[$calendarUid] : 0;
|
||||
$row["CALENDAR_TOTAL_PROCESSES"] = (isset($arrayTotalProcessesByCalendar[$calendarUid]))? $arrayTotalProcessesByCalendar[$calendarUid] : 0;
|
||||
$row["CALENDAR_TOTAL_TASKS"] = (isset($arrayTotalTasksByCalendar[$calendarUid]))? $arrayTotalTasksByCalendar[$calendarUid] : 0;
|
||||
|
||||
//Return
|
||||
return $this->getCalendarDataFromRecord($row);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -360,7 +360,7 @@ class DynaForm
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfNoExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
$process->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true);
|
||||
|
||||
@@ -507,7 +507,7 @@ class DynaForm
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfNoExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
$process->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true);
|
||||
|
||||
@@ -542,7 +542,7 @@ class DynaForm
|
||||
$dynaFormUidCopyImport = $arrayData["COPY_IMPORT"]["DYN_UID"];
|
||||
|
||||
//Verify data
|
||||
$process->throwExceptionIfNoExistsProcess($processUidCopyImport, $this->getFieldNameByFormatFieldName("COPY_IMPORT.PRJ_UID"));
|
||||
$process->throwExceptionIfNotExistsProcess($processUidCopyImport, $this->getFieldNameByFormatFieldName("COPY_IMPORT.PRJ_UID"));
|
||||
|
||||
$this->throwExceptionIfNotExistsDynaForm($dynaFormUidCopyImport, $processUidCopyImport, $this->getFieldNameByFormatFieldName("COPY_IMPORT.DYN_UID"));
|
||||
|
||||
@@ -710,7 +710,7 @@ class DynaForm
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfNoExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
$process->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true);
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ class Group
|
||||
*
|
||||
* return void Throw exception if doesn't exists the Group in table GROUP
|
||||
*/
|
||||
public function throwExceptionIfNoExistsGroup($groupUid, $fieldNameForException)
|
||||
public function throwExceptionIfNotExistsGroup($groupUid, $fieldNameForException)
|
||||
{
|
||||
try {
|
||||
$group = new \Groupwf();
|
||||
@@ -229,7 +229,7 @@ class Group
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
|
||||
$this->throwExceptionIfNoExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, false);
|
||||
|
||||
@@ -268,7 +268,7 @@ class Group
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
|
||||
//Delete
|
||||
$group = new \Groupwf();
|
||||
@@ -340,7 +340,7 @@ class Group
|
||||
|
||||
//Verif data
|
||||
if ($groupUid != "") {
|
||||
$this->throwExceptionIfNoExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
}
|
||||
|
||||
//Get data
|
||||
@@ -387,7 +387,7 @@ class Group
|
||||
|
||||
//Verif data
|
||||
if ($groupUid != "") {
|
||||
$this->throwExceptionIfNoExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
}
|
||||
|
||||
//Get data
|
||||
@@ -555,7 +555,7 @@ class Group
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
|
||||
//Get data
|
||||
$arrayTotalUsersByGroup = $this->getTotalUsersByGroup($groupUid);
|
||||
@@ -673,7 +673,7 @@ class Group
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
|
||||
$this->throwExceptionIfNoExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
|
||||
$process->throwExceptionIfDataNotMetPagerVarDefinition(array("start" => $start, "limit" => $limit), $this->arrayFieldNameForException);
|
||||
|
||||
|
||||
@@ -147,11 +147,11 @@ class User
|
||||
$process = new \BusinessModel\Process();
|
||||
$group = new \BusinessModel\Group();
|
||||
|
||||
$group->throwExceptionIfNoExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
$group->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true);
|
||||
|
||||
$process->throwExceptionIfNoExistsUser($arrayData["USR_UID"], $this->arrayFieldNameForException["userUid"]);
|
||||
$process->throwExceptionIfNotExistsUser($arrayData["USR_UID"], $this->arrayFieldNameForException["userUid"]);
|
||||
|
||||
$this->throwExceptionIfExistsGroupUser($groupUid, $arrayData["USR_UID"], $this->arrayFieldNameForException["userUid"]);
|
||||
|
||||
@@ -188,9 +188,9 @@ class User
|
||||
$process = new \BusinessModel\Process();
|
||||
$group = new \BusinessModel\Group();
|
||||
|
||||
$group->throwExceptionIfNoExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
$group->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
|
||||
$process->throwExceptionIfNoExistsUser($userUid, $this->arrayFieldNameForException["userUid"]);
|
||||
$process->throwExceptionIfNotExistsUser($userUid, $this->arrayFieldNameForException["userUid"]);
|
||||
|
||||
$this->throwExceptionIfNotExistsGroupUser($groupUid, $userUid, $this->arrayFieldNameForException["userUid"]);
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ class InputDocument
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfNoExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
$process->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true);
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ class Process
|
||||
//
|
||||
} else {
|
||||
$eregDate = "[1-9]\d{3}\-(?:0[1-9]|1[012])\-(?:[0][1-9]|[12][0-9]|3[01])";
|
||||
$eregHour = "(?:[0-1]\d|2[0-3])\:(?:[0-5]\d)\:(?:[0-5]\d)";
|
||||
$eregHour = "(?:[0-1]\d|2[0-3])\:(?:[0-5]\d)(?:\:[0-5]\d)?";
|
||||
$eregDatetime = $eregDate . "\s" . $eregHour;
|
||||
|
||||
switch ($arrayFieldDefinition[$fieldName]["type"]) {
|
||||
@@ -237,14 +237,50 @@ class Process
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
//type
|
||||
switch ($arrayFieldDefinition[$fieldName]["type"]) {
|
||||
case "array":
|
||||
//type
|
||||
if (!is_array($fieldValue)) {
|
||||
if ((!preg_match("/^\s*array\s*\(.*\)\s*$/", $fieldValue)) && $fieldValue != '') {
|
||||
if ($fieldValue != "" && !preg_match("/^\s*array\s*\(.*\)\s*$/", $fieldValue)) {
|
||||
throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "The \"{0}\" attribute is not array")));
|
||||
}
|
||||
}
|
||||
|
||||
//empty
|
||||
if (!$arrayFieldDefinition[$fieldName]["empty"]) {
|
||||
$arrayAux = array();
|
||||
|
||||
if (is_array($fieldValue)) {
|
||||
$arrayAux = $fieldValue;
|
||||
}
|
||||
|
||||
if (is_string($fieldValue) && trim($fieldValue) . "" != "") {
|
||||
eval("\$arrayAux = $fieldValue;");
|
||||
}
|
||||
|
||||
if (count($arrayAux) == 0) {
|
||||
throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "The \"{0}\" attribute is empty")));
|
||||
}
|
||||
}
|
||||
|
||||
//defaultValues
|
||||
if (count($arrayFieldDefinition[$fieldName]["defaultValues"]) > 0) {
|
||||
$arrayAux = array();
|
||||
|
||||
if (is_array($fieldValue)) {
|
||||
$arrayAux = $fieldValue;
|
||||
}
|
||||
|
||||
if (is_string($fieldValue) && trim($fieldValue) . "" != "") {
|
||||
eval("\$arrayAux = $fieldValue;");
|
||||
}
|
||||
|
||||
foreach ($arrayAux as $value) {
|
||||
if (!in_array($value, $arrayFieldDefinition[$fieldName]["defaultValues"])) {
|
||||
throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value specified for \"{0}\"")));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -287,7 +323,7 @@ class Process
|
||||
*
|
||||
* return void Throw exception if doesn't exists the Process in table PROCESS
|
||||
*/
|
||||
public function throwExceptionIfNoExistsProcess($processUid, $fieldNameForException)
|
||||
public function throwExceptionIfNotExistsProcess($processUid, $fieldNameForException)
|
||||
{
|
||||
try {
|
||||
$process = new \Process();
|
||||
@@ -310,7 +346,7 @@ class Process
|
||||
*
|
||||
* return void Throw exception if doesn't exists the User in table USERS
|
||||
*/
|
||||
public function throwExceptionIfNoExistsUser($userUid, $fieldNameForException)
|
||||
public function throwExceptionIfNotExistsUser($userUid, $fieldNameForException)
|
||||
{
|
||||
try {
|
||||
$user = new \Users();
|
||||
@@ -347,29 +383,6 @@ class Process
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if doesn't exists the Calendar Definition in table CALENDAR_DEFINITION
|
||||
*
|
||||
* @param string $calendarDefinitionUid Unique id of Calendar Definition
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
*
|
||||
* return void Throw exception if doesn't exists the Calendar Definition in table CALENDAR_DEFINITION
|
||||
*/
|
||||
public function throwExceptionIfNotExistsCalendarDefinition($calendarDefinitionUid, $fieldNameForException)
|
||||
{
|
||||
try {
|
||||
$obj = \CalendarDefinitionPeer::retrieveByPK($calendarDefinitionUid);
|
||||
|
||||
if (!(is_object($obj) && get_class($obj) == "CalendarDefinition")) {
|
||||
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $calendarDefinitionUid), "The calendar definition with {0}: {1}, does not exist");
|
||||
|
||||
throw (new \Exception($msg));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if doesn't exists the Process Category in table PROCESS_CATEGORY
|
||||
*
|
||||
@@ -498,7 +511,7 @@ class Process
|
||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
$this->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
$this->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, false);
|
||||
|
||||
@@ -507,7 +520,9 @@ class Process
|
||||
}
|
||||
|
||||
if (isset($arrayData["PRO_CALENDAR"]) && $arrayData["PRO_CALENDAR"] . "" != "") {
|
||||
$this->throwExceptionIfNotExistsCalendarDefinition($arrayData["PRO_CALENDAR"], $this->arrayFieldNameForException["processCalendar"]);
|
||||
$calendar = new \BusinessModel\Calendar();
|
||||
|
||||
$calendar->throwExceptionIfNotExistsCalendar($arrayData["PRO_CALENDAR"], $this->arrayFieldNameForException["processCalendar"]);
|
||||
}
|
||||
|
||||
if (isset($arrayData["PRO_CATEGORY"]) && $arrayData["PRO_CATEGORY"] . "" != "") {
|
||||
@@ -543,11 +558,11 @@ class Process
|
||||
}
|
||||
|
||||
if (isset($arrayData["PRO_PARENT"])) {
|
||||
$this->throwExceptionIfNoExistsProcess($arrayData["PRO_PARENT"], $this->arrayFieldNameForException["processParent"]);
|
||||
$this->throwExceptionIfNotExistsProcess($arrayData["PRO_PARENT"], $this->arrayFieldNameForException["processParent"]);
|
||||
}
|
||||
|
||||
if (isset($arrayData["PRO_CREATE_USER"]) && $arrayData["PRO_CREATE_USER"] . "" != "") {
|
||||
$this->throwExceptionIfNoExistsUser($arrayData["PRO_CREATE_USER"], $this->arrayFieldNameForException["processCreateUser"]);
|
||||
$this->throwExceptionIfNotExistsUser($arrayData["PRO_CREATE_USER"], $this->arrayFieldNameForException["processCreateUser"]);
|
||||
}
|
||||
|
||||
//Update
|
||||
@@ -598,7 +613,7 @@ class Process
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
$this->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
//Get data
|
||||
//Load Process
|
||||
@@ -1372,7 +1387,7 @@ class Process
|
||||
$arrayDynaForm = array();
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
$this->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
//Get data
|
||||
$dynaForm = new \BusinessModel\DynaForm();
|
||||
@@ -1413,7 +1428,7 @@ class Process
|
||||
$arrayInputDocument = array();
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
$this->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
//Get data
|
||||
$inputDocument = new \BusinessModel\InputDocument();
|
||||
@@ -1545,7 +1560,7 @@ class Process
|
||||
$arrayVariable = array();
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
$this->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
//Get data
|
||||
switch ($option) {
|
||||
@@ -1602,7 +1617,7 @@ class Process
|
||||
$arrayLibrary = array();
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
$this->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
//Get data
|
||||
\G::LoadClass("triggerLibrary");
|
||||
|
||||
@@ -196,7 +196,7 @@ class Step
|
||||
*
|
||||
* return void Throw exception if doesn't exist the Step in table STEP
|
||||
*/
|
||||
public function throwExceptionIfNoExistsStep($stepUid)
|
||||
public function throwExceptionIfNotExistsStep($stepUid)
|
||||
{
|
||||
$step = new \Step();
|
||||
|
||||
@@ -217,7 +217,7 @@ class Step
|
||||
*
|
||||
* return void Throw exception if doesn't exist the Task in table TASK
|
||||
*/
|
||||
public function throwExceptionIfNoExistsTask($taskUid)
|
||||
public function throwExceptionIfNotExistsTask($taskUid)
|
||||
{
|
||||
$task = new \Task();
|
||||
|
||||
@@ -238,7 +238,7 @@ class Step
|
||||
*
|
||||
* return void Throw exception if doesn't exist the Process in table PROCESS
|
||||
*/
|
||||
public function throwExceptionIfNoExistsProcess($processUid)
|
||||
public function throwExceptionIfNotExistsProcess($processUid)
|
||||
{
|
||||
$process = new \Process();
|
||||
|
||||
@@ -269,9 +269,9 @@ class Step
|
||||
unset($arrayData["STEP_UID"]);
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsTask($taskUid);
|
||||
$this->throwExceptionIfNotExistsTask($taskUid);
|
||||
|
||||
$this->throwExceptionIfNoExistsProcess($processUid);
|
||||
$this->throwExceptionIfNotExistsProcess($processUid);
|
||||
|
||||
if (!isset($arrayData["STEP_TYPE_OBJ"])) {
|
||||
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "The \"{0}\" attribute is not defined")));
|
||||
@@ -361,7 +361,7 @@ class Step
|
||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsStep($stepUid);
|
||||
$this->throwExceptionIfNotExistsStep($stepUid);
|
||||
|
||||
//Load Step
|
||||
$step = new \Step();
|
||||
@@ -460,7 +460,7 @@ class Step
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsStep($stepUid);
|
||||
$this->throwExceptionIfNotExistsStep($stepUid);
|
||||
|
||||
//Get position
|
||||
$criteria = new \Criteria("workflow");
|
||||
@@ -503,7 +503,7 @@ class Step
|
||||
$step->setArrayParamException($this->arrayParamException);
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsTask($taskUid);
|
||||
$this->throwExceptionIfNotExistsTask($taskUid);
|
||||
|
||||
//Get data
|
||||
$criteria = new \Criteria("workflow");
|
||||
@@ -544,7 +544,7 @@ class Step
|
||||
$arrayStep = array();
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsStep($stepUid);
|
||||
$this->throwExceptionIfNotExistsStep($stepUid);
|
||||
|
||||
//Get data
|
||||
//Call plugin
|
||||
@@ -642,11 +642,11 @@ class Step
|
||||
|
||||
//Verify data
|
||||
if ($stepUid != "") {
|
||||
$this->throwExceptionIfNoExistsStep($stepUid);
|
||||
$this->throwExceptionIfNotExistsStep($stepUid);
|
||||
}
|
||||
|
||||
if ($stepUid == "") {
|
||||
$this->throwExceptionIfNoExistsTask($taskUid);
|
||||
$this->throwExceptionIfNotExistsTask($taskUid);
|
||||
}
|
||||
|
||||
//Get data
|
||||
@@ -757,11 +757,11 @@ class Step
|
||||
|
||||
//Verify data
|
||||
if ($stepUid != "") {
|
||||
$this->throwExceptionIfNoExistsStep($stepUid);
|
||||
$this->throwExceptionIfNotExistsStep($stepUid);
|
||||
}
|
||||
|
||||
if ($stepUid == "") {
|
||||
$this->throwExceptionIfNoExistsTask($taskUid);
|
||||
$this->throwExceptionIfNotExistsTask($taskUid);
|
||||
}
|
||||
|
||||
//Get data
|
||||
|
||||
@@ -70,7 +70,7 @@ class Task
|
||||
*
|
||||
* return void Throw exception if doesn't exist the Task in table TASK
|
||||
*/
|
||||
public function throwExceptionIfNoExistsTask($taskUid)
|
||||
public function throwExceptionIfNotExistsTask($taskUid)
|
||||
{
|
||||
$task = new \Task();
|
||||
|
||||
@@ -438,7 +438,7 @@ class Task
|
||||
$arrayAvailableStep = array();
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsTask($taskUid);
|
||||
$this->throwExceptionIfNotExistsTask($taskUid);
|
||||
|
||||
//Load Task
|
||||
$task = new \Task();
|
||||
@@ -641,7 +641,7 @@ class Task
|
||||
$step->setArrayParamException($this->arrayParamException);
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNoExistsTask($taskUid);
|
||||
$this->throwExceptionIfNotExistsTask($taskUid);
|
||||
|
||||
//Get data
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
@@ -676,7 +676,7 @@ class TriggerWizard
|
||||
|
||||
$this->throwExceptionIfNotExistsMethodInLibrary($libraryName, $methodName, $this->arrayFieldNameForException["libraryName"], $this->arrayFieldNameForException["methodName"]);
|
||||
|
||||
$process->throwExceptionIfNoExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
$process->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true);
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ class WebEntry
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfNoExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
$process->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
if ($taskUid != "") {
|
||||
$process->throwExceptionIfNotExistsTask($processUid, $taskUid, $this->arrayFieldNameForException["taskUid"]);
|
||||
@@ -279,7 +279,7 @@ class WebEntry
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfNoExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
$process->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true);
|
||||
|
||||
|
||||
@@ -29,5 +29,47 @@ class Calendar extends Api
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:cal_uid
|
||||
*
|
||||
* @param string $cal_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGet($cal_uid)
|
||||
{
|
||||
try {
|
||||
$calendar = new \BusinessModel\Calendar();
|
||||
$calendar->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
|
||||
$response = $calendar->getCalendar($cal_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST
|
||||
*
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPost($request_data)
|
||||
{
|
||||
try {
|
||||
$calendar = new \BusinessModel\Calendar();
|
||||
$calendar->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
|
||||
$arrayData = $calendar->create($request_data);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user