Merge remote branch 'upstream/master'
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,48 @@ Requirements:
|
||||
Background:
|
||||
Given that I have a valid access_token
|
||||
|
||||
|
||||
#Listado de casos
|
||||
Scenario: Returns a list of the cases for the logged in user (Inbox)
|
||||
Given I request "cases"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 14 records
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Draft)
|
||||
Given I request "cases/draft"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 15 records
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Participated)
|
||||
Given I request "cases/participated"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 30 records
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Unassigned)
|
||||
Given I request "cases/unassigned"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 12 records
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Paused)
|
||||
Given I request "cases/paused"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 12 records
|
||||
|
||||
|
||||
Scenario: Returns information about a given case of the list Inbox
|
||||
Given I request "cases/48177942153275bfa28bd04070312685"
|
||||
Then the response status code should be 200
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,38 +9,38 @@ Scenario: Returns a list of the cases for the logged in user (Inbox)
|
||||
Given I request "cases"
|
||||
Then the response status code should be 400
|
||||
And the response has 4 records
|
||||
And the response status message should have the following text "<records>"
|
||||
And the response status message should have the following text "Records"
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Draft)
|
||||
Given I request "cases/draft"
|
||||
Then the response status code should be 400
|
||||
And the response has 4 records
|
||||
And the response status message should have the following text "<records>"
|
||||
And the response status message should have the following text "Records"
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Participated)
|
||||
Given I request "cases/participated"
|
||||
Then the response status code should be 400
|
||||
And the response has 4 records
|
||||
And the response status message should have the following text "<records>"
|
||||
And the response status message should have the following text "Records"
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Unassigned)
|
||||
Given I request "cases/unassigned"
|
||||
Then the response status code should be 400
|
||||
And the response has 4 records
|
||||
And the response status message should have the following text "<records>"
|
||||
And the response status message should have the following text "Records"
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Paused)
|
||||
Given I request "cases/paused"
|
||||
Then the response status code should be 400
|
||||
And the response has 4 records
|
||||
And the response status message should have the following text "<records>"
|
||||
And the response status message should have the following text "Records"
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Advanced Search)
|
||||
Given I request "cases/advanced-search"
|
||||
Then the response status code should be 400
|
||||
And the response has 4 records
|
||||
And the response status message should have the following text "<records>"
|
||||
And the response status message should have the following text "Records"
|
||||
@@ -2,11 +2,14 @@
|
||||
namespace Maveriks;
|
||||
|
||||
use Maveriks\Util;
|
||||
use ProcessMaker\Services;
|
||||
|
||||
class WebApplication
|
||||
{
|
||||
protected $rootDir = "";
|
||||
protected $workflowDir = "";
|
||||
protected $workspaceDir = "";
|
||||
protected $workspaceCacheDir = "";
|
||||
protected $requestUri = "";
|
||||
protected $responseMultipart = array();
|
||||
|
||||
@@ -79,12 +82,12 @@ class WebApplication
|
||||
$this->loadEnvironment($request["workspace"]);
|
||||
|
||||
Util\Logger::log("API::Dispatching ".$_SERVER["REQUEST_METHOD"]." ".$request["uri"]);
|
||||
if (isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && strtoupper($_SERVER["HTTP_X_REQUESTED_WITH"]) == 'MULTYPART') {
|
||||
if (isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && strtoupper($_SERVER["HTTP_X_REQUESTED_WITH"]) == 'MULTIPART') {
|
||||
$this->multipart($request["uri"], $request["version"]);
|
||||
} else {
|
||||
$this->dispatchApiRequest($request["uri"], $request["version"]);
|
||||
}
|
||||
Util\Logger::log("API::End Dispatching ".$_SERVER["REQUEST_METHOD"]." ".$request["uri"]);
|
||||
Util\Logger::log("API::End Dispatch");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -141,29 +144,43 @@ class WebApplication
|
||||
*/
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
|
||||
require_once $this->rootDir . "framework/src/Maveriks/Extension/Restler/UploadFormat.php";
|
||||
|
||||
// $servicesDir contains directory where Services Classes are allocated
|
||||
$servicesDir = $this->workflowDir . 'engine' . DS . 'src' . DS . 'Services' . DS;
|
||||
$servicesDir = $this->workflowDir . 'engine' . DS . 'src' . DS . 'ProcessMaker' . DS . 'Services' . DS;
|
||||
// $apiDir - contains directory to scan classes and add them to Restler
|
||||
$apiDir = $servicesDir . 'Api' . DS;
|
||||
// $apiIniFile - contains file name of api ini configuration
|
||||
$apiIniFile = $servicesDir . DS . 'api.ini';
|
||||
// $authenticationClass - contains the class name that validate the authentication for Restler
|
||||
$authenticationClass = 'Services\\Api\\OAuth2\\Server';
|
||||
$authenticationClass = 'ProcessMaker\\Services\\OAuth2\\Server';
|
||||
// $pmOauthClientId - contains PM Local OAuth Id (Web Designer)
|
||||
$pmOauthClientId = 'x-pm-local-client';
|
||||
|
||||
/*
|
||||
* Load Api ini file for Rest Service
|
||||
*/
|
||||
$apiIniConf = array();
|
||||
$config = array();
|
||||
|
||||
if (file_exists($apiIniFile)) {
|
||||
$apiIniConf = Util\Common::parseIniFile($apiIniFile);
|
||||
$cachedConfig = $this->workspaceCacheDir . "api-config.php";
|
||||
|
||||
// verify if config cache file exists, is array and the last modification date is the same when cache was created.
|
||||
if (! file_exists($cachedConfig) || ! is_array($config = include($cachedConfig)) || $config["_chk"] != filemtime($apiIniFile)) {
|
||||
$config = Util\Common::parseIniFile($apiIniFile);
|
||||
$config["_chk"] = filemtime($apiIniFile);
|
||||
if (! is_dir(dirname($cachedConfig))) {
|
||||
Util\Common::mk_dir(dirname($cachedConfig));
|
||||
}
|
||||
file_put_contents($cachedConfig, "<?php return " . var_export($config, true).";");
|
||||
Util\Logger::log("Configuration cache was loaded and cached to: $cachedConfig");
|
||||
} else {
|
||||
Util\Logger::log("Loading Api Configuration from: $cachedConfig");
|
||||
}
|
||||
}
|
||||
|
||||
// Setting current workspace to Api class
|
||||
\ProcessMaker\Services\Api::setWorkspace(SYS_SYS);
|
||||
// TODO remove this setting on the future, it is not needed, but if it is not present is throwing a warning
|
||||
//\Luracast\Restler\Format\HtmlFormat::$viewPath = $servicesDir . 'oauth2/views';
|
||||
Services\Api::setWorkspace(SYS_SYS);
|
||||
|
||||
// create a new Restler instance
|
||||
//$rest = new \Luracast\Restler\Restler();
|
||||
@@ -179,20 +196,13 @@ class WebApplication
|
||||
// Setting database connection source
|
||||
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
|
||||
$port = empty($port) ? '' : ";port=$port";
|
||||
\Services\Api\OAuth2\Server::setDatabaseSource(DB_USER, DB_PASS, DB_ADAPTER.":host=$host;dbname=".DB_NAME.$port);
|
||||
Services\OAuth2\Server::setDatabaseSource(DB_USER, DB_PASS, DB_ADAPTER.":host=$host;dbname=".DB_NAME.$port);
|
||||
|
||||
// Setting default OAuth Client id, for local PM Web Designer
|
||||
\Services\Api\OAuth2\Server::setPmClientId($pmOauthClientId);
|
||||
Services\OAuth2\Server::setPmClientId($pmOauthClientId);
|
||||
|
||||
require_once $this->workflowDir . "engine/src/Extension/Restler/UploadFormat.php";
|
||||
//require_once PATH_CORE
|
||||
|
||||
//$rest->setSupportedFormats('JsonFormat', 'XmlFormat', 'UploadFormat');
|
||||
//$rest->setOverridingFormats('UploadFormat', 'JsonFormat', 'XmlFormat', 'HtmlFormat');
|
||||
$rest->setOverridingFormats('JsonFormat', 'UploadFormat');
|
||||
|
||||
// Override $_SERVER['REQUEST_URI'] to Restler handles the current url correctly
|
||||
|
||||
$isPluginRequest = strpos($uri, '/plugin-') !== false ? true : false;
|
||||
|
||||
if ($isPluginRequest) {
|
||||
@@ -204,6 +214,7 @@ class WebApplication
|
||||
$uri = str_replace('/plugin-'.$pluginName, '', $uri);
|
||||
}
|
||||
|
||||
// Override $_SERVER['REQUEST_URI'] to Restler handles the modified url
|
||||
$_SERVER['REQUEST_URI'] = $uri;
|
||||
|
||||
if (! $isPluginRequest) { // if it is not a request for a plugin endpoint
|
||||
@@ -212,19 +223,18 @@ class WebApplication
|
||||
|
||||
foreach ($classesList as $classFile) {
|
||||
if (pathinfo($classFile, PATHINFO_EXTENSION) === 'php') {
|
||||
$namespace = '\\Services\\' . str_replace(
|
||||
DIRECTORY_SEPARATOR,
|
||||
'\\',
|
||||
str_replace('.php', '', str_replace($servicesDir, '', $classFile))
|
||||
);
|
||||
//var_dump($namespace);
|
||||
$namespace = '\\ProcessMaker\\Services\\' . str_replace(
|
||||
DIRECTORY_SEPARATOR,
|
||||
'\\',
|
||||
str_replace('.php', '', str_replace($servicesDir, '', $classFile))
|
||||
);
|
||||
$rest->addAPIClass($namespace);
|
||||
}
|
||||
}
|
||||
|
||||
// adding aliases for Restler
|
||||
if (array_key_exists('alias', $apiIniConf)) {
|
||||
foreach ($apiIniConf['alias'] as $alias => $aliasData) {
|
||||
if (array_key_exists('alias', $config)) {
|
||||
foreach ($config['alias'] as $alias => $aliasData) {
|
||||
if (is_array($aliasData)) {
|
||||
foreach ($aliasData as $label => $namespace) {
|
||||
$namespace = '\\' . ltrim($namespace, '\\');
|
||||
@@ -379,7 +389,10 @@ class WebApplication
|
||||
require_once (PATH_DB . SYS_SYS . "/db.php");
|
||||
|
||||
// defining constant for workspace shared directory
|
||||
define("PATH_WORKSPACE", PATH_DB . SYS_SYS . PATH_SEP);
|
||||
$this->workspaceDir = PATH_DB . SYS_SYS . PATH_SEP;
|
||||
$this->workspaceCacheDir = PATH_DB . SYS_SYS . PATH_SEP . "cache" . PATH_SEP;
|
||||
|
||||
define("PATH_WORKSPACE", $this->workspaceDir);
|
||||
// including workspace shared classes -> particularlly for pmTables
|
||||
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . PATH_WORKSPACE);
|
||||
|
||||
@@ -78,16 +78,16 @@ class Designer extends Controller
|
||||
|
||||
protected function getClientCredentials()
|
||||
{
|
||||
$oauthQuery = new Services\Api\OAuth2\PmPdo($this->getDsn());
|
||||
$oauthQuery = new ProcessMaker\Services\OAuth2\PmPdo($this->getDsn());
|
||||
return $oauthQuery->getClientDetails($this->clientId);
|
||||
}
|
||||
|
||||
protected function getAuthorizationCode($client)
|
||||
{
|
||||
\Services\Api\OAuth2\Server::setDatabaseSource($this->getDsn());
|
||||
\Services\Api\OAuth2\Server::setPmClientId($client['CLIENT_ID']);
|
||||
\ProcessMaker\Services\OAuth2\Server::setDatabaseSource($this->getDsn());
|
||||
\ProcessMaker\Services\OAuth2\Server::setPmClientId($client['CLIENT_ID']);
|
||||
|
||||
$oauthServer = new \Services\Api\OAuth2\Server();
|
||||
$oauthServer = new \ProcessMaker\Services\OAuth2\Server();
|
||||
$userId = $_SESSION['USER_LOGGED'];
|
||||
$authorize = true;
|
||||
$_GET = array_merge($_GET, array(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
class Calendar
|
||||
{
|
||||
@@ -267,13 +267,13 @@ class Calendar
|
||||
unset($arrayData["CAL_UID"]);
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$process = new \ProcessMaker\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)) {
|
||||
if (isset($arrayData["CAL_WORK_DAYS"]) && count($arrayData["CAL_WORK_DAYS"]) < 3) {
|
||||
throw (new \Exception(\G::LoadTranslation("ID_MOST_AT_LEAST_3_DAY")));
|
||||
}
|
||||
|
||||
@@ -294,6 +294,10 @@ class Calendar
|
||||
|
||||
if (isset($arrayData["CAL_WORK_HOUR"])) {
|
||||
foreach ($arrayData["CAL_WORK_HOUR"] as $value) {
|
||||
if ($value["DAY"] != "ALL" && !in_array($value["DAY"], $arrayData["CAL_WORK_DAYS"])) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"]), "Value specified for \"{0}\" does not exists in \"{1}\"")));
|
||||
}
|
||||
|
||||
$arrayCalendarWorkHour[] = array(
|
||||
"CALENDAR_BUSINESS_DAY" => $this->workDaysReplaceData($value["DAY"]),
|
||||
"CALENDAR_BUSINESS_START" => $value["HOUR_START"],
|
||||
@@ -346,6 +350,136 @@ class Calendar
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Calendar
|
||||
*
|
||||
* @param string $calendarUid Unique id of Calendar
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data of the Calendar updated
|
||||
*/
|
||||
public function update($calendarUid, $arrayData)
|
||||
{
|
||||
try {
|
||||
$arrayData = \G::array_change_key_case2($arrayData, CASE_UPPER);
|
||||
|
||||
//Verify data
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$this->throwExceptionIfNotExistsCalendar($calendarUid, $this->arrayFieldNameForException["calendarUid"]);
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, false);
|
||||
|
||||
if (isset($arrayData["CAL_NAME"])) {
|
||||
$this->throwExceptionIfExistsName($arrayData["CAL_NAME"], $this->arrayFieldNameForException["calendarName"], $calendarUid);
|
||||
}
|
||||
|
||||
if (isset($arrayData["CAL_WORK_DAYS"]) && 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
|
||||
$arrayCalendarData = \G::array_change_key_case2($this->getCalendar($calendarUid), CASE_UPPER);
|
||||
|
||||
$calendarWorkDays = (isset($arrayData["CAL_WORK_DAYS"]))? $arrayData["CAL_WORK_DAYS"] : $arrayCalendarData["CAL_WORK_DAYS"];
|
||||
|
||||
$arrayCalendarWorkHour = array();
|
||||
$arrayAux = (isset($arrayData["CAL_WORK_HOUR"]))? $arrayData["CAL_WORK_HOUR"] : $arrayCalendarData["CAL_WORK_HOUR"];
|
||||
|
||||
foreach ($arrayAux as $value) {
|
||||
if (isset($arrayData["CAL_WORK_HOUR"]) && $value["DAY"] != "ALL" && !in_array($value["DAY"], $calendarWorkDays)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"]), "Value specified for \"{0}\" does not exists in \"{1}\"")));
|
||||
}
|
||||
|
||||
$arrayCalendarWorkHour[] = array(
|
||||
"CALENDAR_BUSINESS_DAY" => $this->workDaysReplaceData($value["DAY"]),
|
||||
"CALENDAR_BUSINESS_START" => $value["HOUR_START"],
|
||||
"CALENDAR_BUSINESS_END" => $value["HOUR_END"]
|
||||
);
|
||||
}
|
||||
|
||||
$arrayCalendarHoliday = array();
|
||||
$arrayAux = (isset($arrayData["CAL_HOLIDAY"]))? $arrayData["CAL_HOLIDAY"] : $arrayCalendarData["CAL_HOLIDAY"];
|
||||
|
||||
foreach ($arrayAux 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"] = $calendarUid;
|
||||
$arrayDataAux["CALENDAR_NAME"] = (isset($arrayData["CAL_NAME"]))? $arrayData["CAL_NAME"] : $arrayCalendarData["CAL_NAME"];
|
||||
$arrayDataAux["CALENDAR_DESCRIPTION"] = (isset($arrayData["CAL_DESCRIPTION"]))? $arrayData["CAL_DESCRIPTION"] : $arrayCalendarData["CAL_DESCRIPTION"];
|
||||
$arrayDataAux["CALENDAR_WORK_DAYS"] = explode("|", $this->workDaysReplaceData(implode("|", $calendarWorkDays)));
|
||||
$arrayDataAux["CALENDAR_STATUS"] = (isset($arrayData["CAL_STATUS"]))? $arrayData["CAL_STATUS"] : $arrayCalendarData["CAL_STATUS"];
|
||||
|
||||
$arrayDataAux["BUSINESS_DAY"] = $arrayCalendarWorkHour;
|
||||
$arrayDataAux["HOLIDAY"] = $arrayCalendarHoliday;
|
||||
|
||||
//Update
|
||||
$calendarDefinition = new \CalendarDefinition();
|
||||
|
||||
$calendarDefinition->saveCalendarInfo($arrayDataAux);
|
||||
|
||||
//Return
|
||||
if (!$this->formatFieldNameInUppercase) {
|
||||
$arrayData = \G::array_change_key_case2($arrayData, CASE_LOWER);
|
||||
}
|
||||
|
||||
return $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Calendar
|
||||
*
|
||||
* @param string $calendarUid Unique id of Calendar
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function delete($calendarUid)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$calendarDefinition = new \CalendarDefinition();
|
||||
|
||||
$this->throwExceptionIfNotExistsCalendar($calendarUid, $this->arrayFieldNameForException["calendarUid"]);
|
||||
|
||||
$arrayAux = $calendarDefinition->getAllCounterByCalendar("USER");
|
||||
$nU = (isset($arrayAux[$calendarUid]))? $arrayAux[$calendarUid] : 0;
|
||||
$arrayAux = $calendarDefinition->getAllCounterByCalendar("TASK");
|
||||
$nT = (isset($arrayAux[$calendarUid]))? $arrayAux[$calendarUid] : 0;
|
||||
$arrayAux = $calendarDefinition->getAllCounterByCalendar("PROCESS");
|
||||
$nP = (isset($arrayAux[$calendarUid]))? $arrayAux[$calendarUid] : 0;
|
||||
|
||||
if ($nU + $nT + $nP > 0) {
|
||||
throw (new \Exception(\G::LoadTranslation("ID_MSG_CANNOT_DELETE_CALENDAR")));
|
||||
}
|
||||
|
||||
//Delete
|
||||
$calendarDefinition->deleteCalendar($calendarUid);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get criteria for Calendar
|
||||
*
|
||||
@@ -442,7 +576,7 @@ class Calendar
|
||||
$arrayCalendar = array();
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfDataNotMetPagerVarDefinition(array("start" => $start, "limit" => $limit), $this->arrayFieldNameForException);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
|
||||
@@ -245,7 +245,7 @@ class CaseScheduler
|
||||
public function addCaseScheduler($sProcessUID, $aData, $userUID)
|
||||
{
|
||||
try {
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes". PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php");
|
||||
require_once(PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php");
|
||||
$aData['sch_repeat_stop_if_running'] = '0';
|
||||
$aData['case_sh_plugin_uid'] = null;
|
||||
$aData = array_change_key_case($aData, CASE_UPPER);
|
||||
@@ -530,7 +530,7 @@ class CaseScheduler
|
||||
public function updateCaseScheduler($sProcessUID, $aData, $userUID, $sSchUID = '')
|
||||
{
|
||||
try {
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes". PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php");
|
||||
require_once(PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php");
|
||||
$aData = array_change_key_case($aData, CASE_UPPER);
|
||||
if (empty( $aData )) {
|
||||
die( 'The information sended is empty!' );
|
||||
@@ -827,7 +827,7 @@ class CaseScheduler
|
||||
public function deleteCaseScheduler($sSchUID)
|
||||
{
|
||||
try {
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes". PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php");
|
||||
require_once(PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php");
|
||||
$oCaseScheduler = new \CaseScheduler();
|
||||
if (!isset($sSchUID)) {
|
||||
return;
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
class CaseTracker
|
||||
{
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
class CaseTrackerObject
|
||||
{
|
||||
@@ -81,7 +81,7 @@ class CaseTrackerObject
|
||||
throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_UID_OBJ")), "The \"{0}\" attribute is not defined")));
|
||||
}
|
||||
|
||||
$step = new \BusinessModel\Step();
|
||||
$step = new \ProcessMaker\BusinessModel\Step();
|
||||
|
||||
$msg = $step->existsObjectUid($arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"]);
|
||||
|
||||
@@ -156,7 +156,7 @@ class CaseTrackerObject
|
||||
}
|
||||
|
||||
if (isset($arrayData["CTO_TYPE_OBJ"]) && isset($arrayData["CTO_UID_OBJ"])) {
|
||||
$step = new \BusinessModel\Step();
|
||||
$step = new \ProcessMaker\BusinessModel\Step();
|
||||
|
||||
$msg = $step->existsObjectUid($arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
use \UsersPeer;
|
||||
@@ -61,7 +61,7 @@ class Cases
|
||||
if ($start != 0) {
|
||||
$start--;
|
||||
}
|
||||
if ($limit == 'config' || (abs((int)$limit)) == 0) {
|
||||
if ((abs((int)$limit)) == 0) {
|
||||
G::LoadClass("configuration");
|
||||
$conf = new \Configurations();
|
||||
$generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '');
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel\Cases;
|
||||
namespace ProcessMaker\BusinessModel\Cases;
|
||||
|
||||
class InputDocument
|
||||
{
|
||||
@@ -21,7 +21,7 @@ class InputDocument
|
||||
$fields = $oCase->loadCase( $sApplicationUID );
|
||||
$sProcessUID = $fields['PRO_UID'];
|
||||
$sTaskUID = '';
|
||||
$oCaseRest = new \BusinessModel\Cases();
|
||||
$oCaseRest = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCaseRest->getAllUploadedDocumentsCriteria( $sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID);
|
||||
$result = array ();
|
||||
global $_DBArray;
|
||||
@@ -65,7 +65,7 @@ class InputDocument
|
||||
$fields = $oCase->loadCase( $sApplicationUID );
|
||||
$sProcessUID = $fields['PRO_UID'];
|
||||
$sTaskUID = '';
|
||||
$oCaseRest = new \BusinessModel\Cases();
|
||||
$oCaseRest = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCaseRest->getAllUploadedDocumentsCriteria( $sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID );
|
||||
$result = array ();
|
||||
global $_DBArray;
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel\Cases;
|
||||
namespace ProcessMaker\BusinessModel\Cases;
|
||||
|
||||
class OutputDocument
|
||||
{
|
||||
@@ -19,7 +19,7 @@ class OutputDocument
|
||||
$fields = $oCase->loadCase( $applicationUid );
|
||||
$sProcessUID = $fields['PRO_UID'];
|
||||
$sTaskUID = '';
|
||||
$oCriteria = new \BusinessModel\Cases();
|
||||
$oCriteria = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCriteria->getAllGeneratedDocumentsCriteria( $sProcessUID, $applicationUid, $sTaskUID, $userUid);
|
||||
$result = array ();
|
||||
global $_DBArray;
|
||||
@@ -63,7 +63,7 @@ class OutputDocument
|
||||
$fields = $oCase->loadCase( $sApplicationUID );
|
||||
$sProcessUID = $fields['PRO_UID'];
|
||||
$sTaskUID = '';
|
||||
$oCaseRest = new \BusinessModel\Cases();
|
||||
$oCaseRest = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCaseRest->getAllGeneratedDocumentsCriteria( $sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID );
|
||||
$result = array ();
|
||||
global $_DBArray;
|
||||
@@ -498,11 +498,11 @@ class OutputDocument
|
||||
);
|
||||
}
|
||||
$g_media->set_security($GLOBALS['g_config']['pdfSecurity']);
|
||||
require_once (HTML2PS_DIR . 'pdf.fpdf.encryption.php');
|
||||
require_once(HTML2PS_DIR . 'pdf.fpdf.encryption.php');
|
||||
}
|
||||
$pipeline = new \Pipeline();
|
||||
if (extension_loaded('curl')) {
|
||||
require_once (HTML2PS_DIR . 'fetcher.url.curl.class.php');
|
||||
require_once(HTML2PS_DIR . 'fetcher.url.curl.class.php');
|
||||
$pipeline->fetchers = array(new \FetcherURLCurl());
|
||||
if (isset($proxy)) {
|
||||
if ($proxy != '') {
|
||||
@@ -510,7 +510,7 @@ class OutputDocument
|
||||
}
|
||||
}
|
||||
} else {
|
||||
require_once (HTML2PS_DIR . 'fetcher.url.class.php');
|
||||
require_once(HTML2PS_DIR . 'fetcher.url.class.php');
|
||||
$pipeline->fetchers[] = new \FetcherURL();
|
||||
}
|
||||
$pipeline->data_filters[] = new \DataFilterDoctype();
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
use \DbSource;
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
use \UsersPeer;
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
class DynaForm
|
||||
{
|
||||
@@ -358,7 +358,7 @@ class DynaForm
|
||||
unset($arrayData["PMTABLE"]);
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
@@ -412,7 +412,7 @@ class DynaForm
|
||||
$processUid = $arrayDynaFormData["PRO_UID"];
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, false);
|
||||
|
||||
@@ -505,7 +505,7 @@ class DynaForm
|
||||
unset($arrayData["PMTABLE"]);
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
@@ -708,7 +708,7 @@ class DynaForm
|
||||
unset($arrayData["COPY_IMPORT"]);
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
/**
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
class Group
|
||||
{
|
||||
@@ -189,7 +189,7 @@ class Group
|
||||
unset($arrayData["GRP_UID"]);
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true);
|
||||
|
||||
@@ -227,7 +227,7 @@ class Group
|
||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
|
||||
@@ -459,7 +459,7 @@ class Group
|
||||
$arrayGroup = array();
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfDataNotMetPagerVarDefinition(array("start" => $start, "limit" => $limit), $this->arrayFieldNameForException);
|
||||
|
||||
@@ -671,7 +671,7 @@ class Group
|
||||
$arrayUser = array();
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel\Group;
|
||||
namespace ProcessMaker\BusinessModel\Group;
|
||||
|
||||
class User
|
||||
{
|
||||
@@ -144,8 +144,8 @@ class User
|
||||
unset($arrayData["GRP_UID"]);
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$group = new \BusinessModel\Group();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$group = new \ProcessMaker\BusinessModel\Group();
|
||||
|
||||
$group->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
|
||||
@@ -185,8 +185,8 @@ class User
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$group = new \BusinessModel\Group();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$group = new \ProcessMaker\BusinessModel\Group();
|
||||
|
||||
$group->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
class InputDocument
|
||||
{
|
||||
@@ -209,7 +209,7 @@ class InputDocument
|
||||
unset($arrayData["INP_DOC_UID"]);
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
@@ -278,7 +278,7 @@ class InputDocument
|
||||
$processUid = $arrayInputDocumentData["PRO_UID"];
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
|
||||
@@ -239,7 +239,7 @@ class OutputDocument
|
||||
}
|
||||
}
|
||||
try {
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "OutputDocument.php");
|
||||
require_once(PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "OutputDocument.php");
|
||||
$aData = array_change_key_case($aData, CASE_UPPER);
|
||||
$aData['PRO_UID'] = $sProcessUID;
|
||||
//Verify data
|
||||
@@ -350,9 +350,9 @@ class OutputDocument
|
||||
public function deleteOutputDocument($sProcessUID, $sOutputDocumentUID)
|
||||
{
|
||||
try {
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "OutputDocument.php");
|
||||
require_once(PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "OutputDocument.php");
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "ObjectPermission.php");
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Step.php");
|
||||
require_once(PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Step.php");
|
||||
\G::LoadClass( 'processMap' );
|
||||
$oOutputDocument = new \OutputDocument();
|
||||
$fields = $oOutputDocument->load( $sOutputDocumentUID );
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use G;
|
||||
use Criteria;
|
||||
@@ -520,7 +520,7 @@ class Process
|
||||
}
|
||||
|
||||
if (isset($arrayData["PRO_CALENDAR"]) && $arrayData["PRO_CALENDAR"] . "" != "") {
|
||||
$calendar = new \BusinessModel\Calendar();
|
||||
$calendar = new \ProcessMaker\BusinessModel\Calendar();
|
||||
|
||||
$calendar->throwExceptionIfNotExistsCalendar($arrayData["PRO_CALENDAR"], $this->arrayFieldNameForException["processCalendar"]);
|
||||
}
|
||||
@@ -530,7 +530,7 @@ class Process
|
||||
}
|
||||
|
||||
if (isset($arrayData["PRO_SUMMARY_DYNAFORM"]) && $arrayData["PRO_SUMMARY_DYNAFORM"] . "" != "") {
|
||||
$dynaForm = new \BusinessModel\DynaForm();
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
|
||||
$dynaForm->throwExceptionIfNotExistsDynaForm($arrayData["PRO_SUMMARY_DYNAFORM"], $processUid, $this->arrayFieldNameForException["processSummaryDynaform"]);
|
||||
}
|
||||
@@ -539,7 +539,7 @@ class Process
|
||||
$this->throwExceptionIfNotExistsRoutingScreenTemplate($processUid, $arrayData["PRO_DERIVATION_SCREEN_TPL"], $this->arrayFieldNameForException["processDerivationScreenTpl"]);
|
||||
}
|
||||
|
||||
$trigger = new \BusinessModel\Trigger();
|
||||
$trigger = new \ProcessMaker\BusinessModel\Trigger();
|
||||
|
||||
if (isset($arrayData["PRO_TRI_DELETED"]) && $arrayData["PRO_TRI_DELETED"] . "" != "") {
|
||||
$trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_DELETED"], $processUid, $this->arrayFieldNameForException["processTriDeleted"]);
|
||||
@@ -826,7 +826,7 @@ class Process
|
||||
$arrayDefineProcessData["process"]["tasks"][$index]["TAS_UID_OLD"] = $uidAux;
|
||||
|
||||
//Update task properties
|
||||
$task2 = new \BusinessModel\Task();
|
||||
$task2 = new \ProcessMaker\BusinessModel\Task();
|
||||
|
||||
$arrayResult = $task2->updateProperties($taskUid, $processUid, $arrayData);
|
||||
|
||||
@@ -842,7 +842,7 @@ class Process
|
||||
$result = $task->update($arrayData);
|
||||
|
||||
//Update task properties
|
||||
$task2 = new \BusinessModel\Task();
|
||||
$task2 = new \ProcessMaker\BusinessModel\Task();
|
||||
|
||||
$arrayResult = $task2->updateProperties($arrayData["TAS_UID"], $processUid, $arrayData);
|
||||
break;
|
||||
@@ -1390,7 +1390,7 @@ class Process
|
||||
$this->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
//Get data
|
||||
$dynaForm = new \BusinessModel\DynaForm();
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
$dynaForm->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
$dynaForm->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||
|
||||
@@ -1431,7 +1431,7 @@ class Process
|
||||
$this->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
|
||||
|
||||
//Get data
|
||||
$inputDocument = new \BusinessModel\InputDocument();
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\InputDocument();
|
||||
$inputDocument->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
$inputDocument->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||
|
||||
@@ -1470,7 +1470,7 @@ class Process
|
||||
|
||||
//Verify data
|
||||
//Get data
|
||||
$webEntry = new \BusinessModel\WebEntry();
|
||||
$webEntry = new \ProcessMaker\BusinessModel\WebEntry();
|
||||
$webEntry->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
$webEntry->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||
|
||||
@@ -1575,7 +1575,7 @@ class Process
|
||||
break;
|
||||
case "GRIDVARS":
|
||||
//Verify data
|
||||
$dynaForm = new \BusinessModel\DynaForm();
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
|
||||
$dynaForm->throwExceptionIfNotExistsDynaForm($gridUid, $processUid, $this->arrayFieldNameForException["gridUid"]);
|
||||
$dynaForm->throwExceptionIfNotIsGridDynaForm($gridUid, $this->arrayFieldNameForException["gridUid"]);
|
||||
@@ -1622,7 +1622,7 @@ class Process
|
||||
//Get data
|
||||
\G::LoadClass("triggerLibrary");
|
||||
|
||||
$triggerWizard = new \BusinessModel\TriggerWizard();
|
||||
$triggerWizard = new \ProcessMaker\BusinessModel\TriggerWizard();
|
||||
$triggerWizard->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
$triggerWizard->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
class ProcessCategory
|
||||
{
|
||||
@@ -96,7 +96,6 @@ class ProcessCategory
|
||||
{
|
||||
try {
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\ProcessCategoryPeer::CATEGORY_UID);
|
||||
$criteria->addSelectColumn(\ProcessCategoryPeer::CATEGORY_PARENT);
|
||||
$criteria->addSelectColumn(\ProcessCategoryPeer::CATEGORY_NAME);
|
||||
@@ -146,7 +145,7 @@ class ProcessCategory
|
||||
$arrayProcessCategory = array();
|
||||
|
||||
//Verify data
|
||||
$process = new \BusinessModel\Process();
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfDataNotMetPagerVarDefinition(array("start" => $start, "limit" => $limit), $this->arrayFieldNameForException);
|
||||
|
||||
@@ -232,5 +231,172 @@ class ProcessCategory
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Process Category
|
||||
*
|
||||
* @param string $cat_uid Category Id
|
||||
*
|
||||
* return array Return an object with the Process Category
|
||||
*/
|
||||
public function getCategory($cat_uid)
|
||||
{
|
||||
try {
|
||||
$oProcessCategory = '';
|
||||
$process = new \Process();
|
||||
$oTotalProcessesByCategory = $process->getAllProcessesByCategory();
|
||||
$criteria = $this->getAProcessCategoryCriteria($cat_uid);
|
||||
$criteriaCount = clone $criteria;
|
||||
$criteriaCount->clearSelectColumns();
|
||||
$criteriaCount->addSelectColumn("COUNT(" . \ProcessCategoryPeer::CATEGORY_UID . ") AS NUM_REC");
|
||||
$rsCriteriaCount = \ProcessCategoryPeer::doSelectRS($criteriaCount);
|
||||
$rsCriteriaCount->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteriaCount->next();
|
||||
$rsCriteria = \ProcessCategoryPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
while ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
$row["CATEGORY_TOTAL_PROCESSES"] = (isset($oTotalProcessesByCategory[$row["CATEGORY_UID"]]))? $oTotalProcessesByCategory[$row["CATEGORY_UID"]] : 0;
|
||||
$oProcessCategory = $this->getProcessCategoryDataFromRecord($row);
|
||||
}
|
||||
//Return
|
||||
if ($oProcessCategory != '') {
|
||||
return $oProcessCategory;
|
||||
} else {
|
||||
throw (new \Exception( 'The Category with cat_uid: '.$cat_uid.' doesn\'t exist!'));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Process Category
|
||||
*
|
||||
* @param string $cat_name Name of Category
|
||||
*
|
||||
* return array
|
||||
*/
|
||||
public function addCategory($cat_name)
|
||||
{
|
||||
try {
|
||||
require_once 'classes/model/ProcessCategory.php';
|
||||
$catName = trim( $cat_name );
|
||||
if ($this->existsName( $cat_name )) {
|
||||
throw (new \Exception( 'cat_name. Duplicate Process Category name'));
|
||||
}
|
||||
$catUid = \G::GenerateUniqueID();
|
||||
$pcat = new \ProcessCategory();
|
||||
$pcat->setNew( true );
|
||||
$pcat->setCategoryUid( $catUid );
|
||||
$pcat->setCategoryName( $catName );
|
||||
$pcat->save();
|
||||
$oProcessCategory = array_change_key_case($this->getCategory( $catUid ), CASE_LOWER);
|
||||
//Return
|
||||
return $oProcessCategory;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Put Process Category
|
||||
*
|
||||
* @param string $cat_uid Category id
|
||||
* @param string $cat_name Category Name
|
||||
*
|
||||
* return array
|
||||
*/
|
||||
public function updateCategory($cat_uid, $cat_name)
|
||||
{
|
||||
try {
|
||||
require_once 'classes/model/ProcessCategory.php';
|
||||
$catUID = $cat_uid;
|
||||
$catName = trim( $cat_name );
|
||||
if ($this->existsName( $cat_name )) {
|
||||
throw (new \Exception( 'cat_name. Duplicate Process Category name'));
|
||||
}
|
||||
$pcat = new \ProcessCategory();
|
||||
$pcat->setNew( false );
|
||||
$pcat->setCategoryUid( $catUID );
|
||||
$pcat->setCategoryName( $catName );
|
||||
$pcat->save();
|
||||
$oProcessCategory = array_change_key_case($this->getCategory( $cat_uid ), CASE_LOWER);
|
||||
//Return
|
||||
return $oProcessCategory;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Process Category
|
||||
*
|
||||
* @param string $cat_uid Category id
|
||||
*
|
||||
* return array
|
||||
*/
|
||||
public function deleteCategory($cat_uid)
|
||||
{
|
||||
try {
|
||||
require_once 'classes/model/ProcessCategory.php';
|
||||
$criteria = $this->getAProcessCategoryCriteria($cat_uid);
|
||||
$rsCriteria = \ProcessCategoryPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
$row = $rsCriteria->getRow();
|
||||
if ($row) {
|
||||
$cat = new \ProcessCategory();
|
||||
$cat->setCategoryUid( $cat_uid );
|
||||
$cat->delete();
|
||||
} else {
|
||||
throw (new \Exception( 'The Category with cat_uid: '.$cat_uid.' doesn\'t exist!'));
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get criteria for Process Category
|
||||
*
|
||||
* return object
|
||||
*/
|
||||
public function getAProcessCategoryCriteria($cat_uid)
|
||||
{
|
||||
try {
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\ProcessCategoryPeer::CATEGORY_UID);
|
||||
$criteria->addSelectColumn(\ProcessCategoryPeer::CATEGORY_PARENT);
|
||||
$criteria->addSelectColumn(\ProcessCategoryPeer::CATEGORY_NAME);
|
||||
$criteria->addSelectColumn(\ProcessCategoryPeer::CATEGORY_ICON);
|
||||
$criteria->add(\ProcessCategoryPeer::CATEGORY_UID, $cat_uid);
|
||||
return $criteria;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the name exists
|
||||
*
|
||||
* @param string $name Name
|
||||
*
|
||||
* return bool Return true if the name exists, false otherwise
|
||||
*/
|
||||
public function existsName($name)
|
||||
{
|
||||
try {
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->add(\ProcessCategoryPeer::CATEGORY_NAME, $name, \Criteria::EQUAL);
|
||||
$rsCriteria = \ProcessCategoryPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
return $rsCriteria->getRow();
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
use \Cases;
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
class Step
|
||||
{
|
||||
@@ -498,7 +498,7 @@ class Step
|
||||
try {
|
||||
$arrayStep = array();
|
||||
|
||||
$step = new \BusinessModel\Step();
|
||||
$step = new \ProcessMaker\BusinessModel\Step();
|
||||
$step->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
$step->setArrayParamException($this->arrayParamException);
|
||||
|
||||
@@ -650,7 +650,7 @@ class Step
|
||||
}
|
||||
|
||||
//Get data
|
||||
$trigger = new \BusinessModel\Trigger();
|
||||
$trigger = new \ProcessMaker\BusinessModel\Trigger();
|
||||
|
||||
$flagStepAssignTask = 0;
|
||||
|
||||
@@ -765,8 +765,8 @@ class Step
|
||||
}
|
||||
|
||||
//Get data
|
||||
$bmTrigger = new \BusinessModel\Trigger();
|
||||
$bmStepTrigger = new \BusinessModel\Step\Trigger();
|
||||
$bmTrigger = new \ProcessMaker\BusinessModel\Trigger();
|
||||
$bmStepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger();
|
||||
|
||||
$stepTrigger = new \StepTrigger();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace BusinessModel\Step;
|
||||
namespace ProcessMaker\BusinessModel\Step;
|
||||
|
||||
use \BusinessModel\Step;
|
||||
use \ProcessMaker\BusinessModel\Step;
|
||||
|
||||
class Trigger
|
||||
{
|
||||
@@ -330,7 +330,7 @@ class Trigger
|
||||
}
|
||||
|
||||
//Get data
|
||||
$trigger = new \BusinessModel\Trigger();
|
||||
$trigger = new \ProcessMaker\BusinessModel\Trigger();
|
||||
|
||||
$criteria = $trigger->getTriggerCriteria();
|
||||
|
||||
@@ -373,7 +373,7 @@ class Trigger
|
||||
* @return void
|
||||
*/
|
||||
public function moveStepTriggers($tasUid, $stepUid, $triUid, $type, $newPos) {
|
||||
$stepTrigger = new \BusinessModel\Step();
|
||||
$stepTrigger = new \ProcessMaker\BusinessModel\Step();
|
||||
$tempStep = $stepUid;
|
||||
$typeCompare = $type;
|
||||
if ($tempStep == '-1' || $tempStep == '-2') {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user