Solving conflicts updating with last changes in develop branch
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
|
||||
use ProcessMaker\BusinessModel\Task as BusinessModelTask;
|
||||
use ProcessMaker\BusinessModel\User as BusinessModelUser;
|
||||
use ProcessMaker\BusinessModel\WebEntryEvent;
|
||||
@@ -983,22 +984,24 @@ class Cases
|
||||
/** Update case*/
|
||||
$app->update($Fields);
|
||||
|
||||
//Update the reportTables and tables related to the case
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$reportTables = new ReportTables();
|
||||
$additionalTables = new additionalTables();
|
||||
//Update the reportTables and tables related to the case, only for applications with positive application number
|
||||
if ($appFields['APP_NUMBER'] > 0) {
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$reportTables = new ReportTables();
|
||||
$additionalTables = new additionalTables();
|
||||
|
||||
if (!isset($Fields['APP_NUMBER'])) {
|
||||
$Fields['APP_NUMBER'] = $appFields['APP_NUMBER'];
|
||||
}
|
||||
if (!isset($Fields['APP_STATUS'])) {
|
||||
$Fields['APP_STATUS'] = $appFields['APP_STATUS'];
|
||||
}
|
||||
if (!isset($Fields['APP_NUMBER'])) {
|
||||
$Fields['APP_NUMBER'] = $appFields['APP_NUMBER'];
|
||||
}
|
||||
if (!isset($Fields['APP_STATUS'])) {
|
||||
$Fields['APP_STATUS'] = $appFields['APP_STATUS'];
|
||||
}
|
||||
|
||||
$reportTables->updateTables($appFields['PRO_UID'], $appUid, $Fields['APP_NUMBER'], $appData);
|
||||
$additionalTables->updateReportTables(
|
||||
$reportTables->updateTables($appFields['PRO_UID'], $appUid, $Fields['APP_NUMBER'], $appData);
|
||||
$additionalTables->updateReportTables(
|
||||
$appFields['PRO_UID'], $appUid, $Fields['APP_NUMBER'], $appData, $Fields['APP_STATUS']
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
//Update the priority related to the task
|
||||
$delIndex = isset($Fields['DEL_INDEX']) ? trim($Fields['DEL_INDEX']) : '';
|
||||
@@ -2105,199 +2108,201 @@ class Cases
|
||||
* This function start a case using the task for the user $sUsrUid
|
||||
* With this function we can Start a case
|
||||
*
|
||||
* @name startCase
|
||||
* @param string $sTasUid
|
||||
* @param string $sUsrUid
|
||||
* @return Fields
|
||||
* @param string $taskUid
|
||||
* @param string $userUid
|
||||
* @param bool $isSubProcess
|
||||
* @param array $dataPreviousApplication
|
||||
* @param bool $isSelfService
|
||||
* @param string $sequenceType
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function startCase($sTasUid, $sUsrUid, $isSubprocess = false, $dataPreviusApplication = array(), $isSelfService = false)
|
||||
public function startCase($taskUid, $userUid, $isSubProcess = false, $dataPreviousApplication = [], $isSelfService = false, $sequenceType = AppSequence::APP_TYPE_NORMAL)
|
||||
{
|
||||
if ($sTasUid != '') {
|
||||
if ($taskUid != '') {
|
||||
try {
|
||||
$task = TaskPeer::retrieveByPK($sTasUid);
|
||||
$user = UsersPeer::retrieveByPK($sUsrUid);
|
||||
$task = TaskPeer::retrieveByPK($taskUid);
|
||||
$user = UsersPeer::retrieveByPK($userUid);
|
||||
|
||||
if (is_null($task)) {
|
||||
throw new Exception(G::LoadTranslation("ID_TASK_NOT_EXIST", array("TAS_UID", $sTasUid)));
|
||||
throw new Exception(G::LoadTranslation("ID_TASK_NOT_EXIST", ["TAS_UID", $taskUid]));
|
||||
}
|
||||
|
||||
//To allow Self Service as the first task
|
||||
$arrayTaskTypeToExclude = array("START-TIMER-EVENT");
|
||||
// To allow Self Service as the first task
|
||||
$arrayTaskTypeToExclude = ["START-TIMER-EVENT"];
|
||||
|
||||
if (!is_null($task) && !in_array($task->getTasType(), $arrayTaskTypeToExclude) && $task->getTasAssignType() != "SELF_SERVICE" && $sUsrUid == "") {
|
||||
if (!is_null($task) && !in_array($task->getTasType(), $arrayTaskTypeToExclude) && $task->getTasAssignType() != "SELF_SERVICE" && $userUid == "") {
|
||||
throw (new Exception('You tried to start a new case without send the USER UID!'));
|
||||
}
|
||||
|
||||
//Process
|
||||
$sProUid = $task->getProUid();
|
||||
// Process
|
||||
$processUid = $task->getProUid();
|
||||
$this->Process = new Process;
|
||||
$proFields = $this->Process->Load($sProUid);
|
||||
$proFields = $this->Process->Load($processUid);
|
||||
|
||||
//application
|
||||
$Application = new Application;
|
||||
$sAppUid = $Application->create($sProUid, $sUsrUid);
|
||||
// Application
|
||||
$application = new Application;
|
||||
$appUid = $application->create($processUid, $userUid, $sequenceType);
|
||||
|
||||
//appDelegation
|
||||
$AppDelegation = new AppDelegation;
|
||||
$iAppThreadIndex = 1; // Start Thread
|
||||
$iAppDelPrio = 3; // Priority
|
||||
$iDelIndex = $AppDelegation->createAppDelegation(
|
||||
$sProUid,
|
||||
$sAppUid,
|
||||
$sTasUid,
|
||||
$sUsrUid,
|
||||
$iAppThreadIndex,
|
||||
$iAppDelPrio,
|
||||
$isSubprocess,
|
||||
// AppDelegation
|
||||
$appDelegation = new AppDelegation;
|
||||
$appThreadIndex = 1; // Start Thread
|
||||
$appDelPriority = 3; // Priority
|
||||
$delIndex = $appDelegation->createAppDelegation(
|
||||
$processUid,
|
||||
$appUid,
|
||||
$taskUid,
|
||||
$userUid,
|
||||
$appThreadIndex,
|
||||
$appDelPriority,
|
||||
$isSubProcess,
|
||||
-1,
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
$Application->getAppNumber(),
|
||||
$application->getAppNumber(),
|
||||
$task->getTasId(),
|
||||
(empty($user)) ? 0 : $user->getUsrId(),
|
||||
$this->Process->getProId()
|
||||
|
||||
);
|
||||
|
||||
//appThread
|
||||
$AppThread = new AppThread;
|
||||
$iAppThreadIndex = $AppThread->createAppThread($sAppUid, $iDelIndex, 0);
|
||||
// AppThread
|
||||
$appThread = new AppThread;
|
||||
$appThreadIndex = $appThread->createAppThread($appUid, $delIndex, 0);
|
||||
|
||||
$oDerivation = new Derivation();
|
||||
$derivation = new Derivation();
|
||||
|
||||
//Multiple Instance
|
||||
$aUserFields = array();
|
||||
// Multiple Instance
|
||||
$usersFields = [];
|
||||
$taskAssignType = $task->getTasAssignType();
|
||||
$nextTaskAssignVariable = $task->getTasAssignVariable();
|
||||
if ($taskAssignType == "MULTIPLE_INSTANCE" || $taskAssignType == "MULTIPLE_INSTANCE_VALUE_BASED") {
|
||||
switch ($taskAssignType) {
|
||||
case 'MULTIPLE_INSTANCE':
|
||||
$userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($sTasUid));
|
||||
$userFields = $derivation->getUsersFullNameFromArray($derivation->getAllUsersFromAnyTask($taskUid));
|
||||
break;
|
||||
default:
|
||||
throw (new Exception('Invalid Task Assignment method'));
|
||||
break;
|
||||
}
|
||||
$userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($sTasUid));
|
||||
$userFields = $derivation->getUsersFullNameFromArray($derivation->getAllUsersFromAnyTask($taskUid));
|
||||
$count = 0;
|
||||
foreach ($userFields as $rowUser) {
|
||||
if ($rowUser["USR_UID"] != $sUsrUid) {
|
||||
//appDelegation
|
||||
$AppDelegation = new AppDelegation;
|
||||
$iAppThreadIndex ++; // Start Thread
|
||||
$iAppDelPrio = 3; // Priority
|
||||
if ($rowUser["USR_UID"] != $userUid) {
|
||||
// AppDelegation
|
||||
$appDelegation = new AppDelegation;
|
||||
$appThreadIndex ++; // Start Thread
|
||||
$appDelPriority = 3; // Priority
|
||||
$user = UsersPeer::retrieveByPK($rowUser["USR_UID"]);
|
||||
$iDelIndex1 = $AppDelegation->createAppDelegation(
|
||||
$sProUid,
|
||||
$sAppUid,
|
||||
$sTasUid,
|
||||
$delIndex1 = $appDelegation->createAppDelegation(
|
||||
$processUid,
|
||||
$appUid,
|
||||
$taskUid,
|
||||
$rowUser["USR_UID"],
|
||||
$iAppThreadIndex,
|
||||
$iAppDelPrio,
|
||||
$isSubprocess,
|
||||
$appThreadIndex,
|
||||
$appDelPriority,
|
||||
$isSubProcess,
|
||||
-1,
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
$Application->getAppNumber(),
|
||||
$application->getAppNumber(),
|
||||
$task->getTasId(),
|
||||
(empty($user)) ? 0 : $user->getUsrId(),
|
||||
$this->Process->getProId()
|
||||
);
|
||||
//appThread
|
||||
$AppThread = new AppThread;
|
||||
$iAppThreadIndex = $AppThread->createAppThread($sAppUid, $iDelIndex1, 0);
|
||||
//Save Information
|
||||
$aUserFields[$count] = $rowUser;
|
||||
$aUserFields[$count]["DEL_INDEX"] = $iDelIndex1;
|
||||
// AppThread
|
||||
$appThread = new AppThread;
|
||||
$appThreadIndex = $appThread->createAppThread($appUid, $delIndex1, 0);
|
||||
// Save Information
|
||||
$usersFields[$count] = $rowUser;
|
||||
$usersFields[$count]["DEL_INDEX"] = $delIndex1;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//DONE: Al ya existir un delegation, se puede "calcular" el caseTitle.
|
||||
$Fields = $Application->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$aApplicationFields = $Fields['APP_DATA'];
|
||||
$Fields['DEL_INDEX'] = $iDelIndex;
|
||||
$newValues = $this->newRefreshCaseTitleAndDescription($sAppUid, $Fields, $aApplicationFields);
|
||||
$fields = $application->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$applicationFields = $fields['APP_DATA'];
|
||||
$fields['DEL_INDEX'] = $delIndex;
|
||||
$newValues = $this->newRefreshCaseTitleAndDescription($appUid, $fields, $applicationFields);
|
||||
if (!isset($newValues['APP_TITLE'])) {
|
||||
$newValues['APP_TITLE'] = '';
|
||||
}
|
||||
|
||||
$caseNumber = $Fields['APP_NUMBER'];
|
||||
$Application->update($Fields);
|
||||
$caseNumber = $fields['APP_NUMBER'];
|
||||
$application->update($fields);
|
||||
|
||||
//Update the task last assigned (for web entry and web services)
|
||||
$oDerivation->setTasLastAssigned($sTasUid, $sUsrUid);
|
||||
// Update the task last assigned (for web entry and web services)
|
||||
$derivation->setTasLastAssigned($taskUid, $userUid);
|
||||
|
||||
// Execute Events
|
||||
require_once 'classes/model/Event.php';
|
||||
$event = new Event();
|
||||
$event->createAppEvents($sProUid, $sAppUid, $iDelIndex, $sTasUid);
|
||||
$event->createAppEvents($processUid, $appUid, $delIndex, $taskUid);
|
||||
|
||||
//update searchindex
|
||||
// Update search index
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
$this->appSolr->updateApplicationSearchIndex($appUid);
|
||||
}
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$Fields['TAS_UID'] = $sTasUid;
|
||||
$Fields['USR_UID'] = $sUsrUid;
|
||||
$Fields['DEL_INDEX'] = $iDelIndex;
|
||||
$Fields['APP_STATUS'] = 'TO_DO';
|
||||
$Fields['DEL_DELEGATE_DATE'] = $Fields['APP_INIT_DATE'];
|
||||
if (!$isSubprocess) {
|
||||
$Fields['APP_STATUS'] = 'DRAFT';
|
||||
$fields['TAS_UID'] = $taskUid;
|
||||
$fields['USR_UID'] = $userUid;
|
||||
$fields['DEL_INDEX'] = $delIndex;
|
||||
$fields['APP_STATUS'] = 'TO_DO';
|
||||
$fields['DEL_DELEGATE_DATE'] = $fields['APP_INIT_DATE'];
|
||||
if (!$isSubProcess) {
|
||||
$fields['APP_STATUS'] = 'DRAFT';
|
||||
} else {
|
||||
$Fields['APP_INIT_DATE'] = null;
|
||||
$fields['APP_INIT_DATE'] = null;
|
||||
}
|
||||
$inbox = new ListInbox();
|
||||
$inbox->newRow($Fields, $sUsrUid, $isSelfService);
|
||||
$inbox->newRow($fields, $userUid, $isSelfService);
|
||||
|
||||
//Multiple Instance
|
||||
foreach ($aUserFields as $rowUser) {
|
||||
$Fields["USR_UID"] = $rowUser["USR_UID"];
|
||||
$Fields["DEL_INDEX"] = $rowUser["DEL_INDEX"];
|
||||
// Multiple Instance
|
||||
foreach ($usersFields as $rowUser) {
|
||||
$fields["USR_UID"] = $rowUser["USR_UID"];
|
||||
$fields["DEL_INDEX"] = $rowUser["DEL_INDEX"];
|
||||
$inbox = new ListInbox();
|
||||
$inbox->newRow($Fields, $sUsrUid, $isSelfService);
|
||||
$inbox->newRow($fields, $userUid, $isSelfService);
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
} catch (exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
} else {
|
||||
throw (new Exception('You tried to start a new case without send the USER UID or TASK UID!'));
|
||||
}
|
||||
|
||||
//Log
|
||||
// Log
|
||||
$message = 'Create case';
|
||||
$context = $data = [
|
||||
"appUid" => $sAppUid,
|
||||
"usrUid" => $sUsrUid,
|
||||
"tasUid" => $sTasUid,
|
||||
"isSubprocess" => $isSubprocess,
|
||||
"appUid" => $appUid,
|
||||
"usrUid" => $userUid,
|
||||
"tasUid" => $taskUid,
|
||||
"isSubProcess" => $isSubProcess,
|
||||
"appNumber" => $caseNumber,
|
||||
"delIndex" => $iDelIndex,
|
||||
"appInitDate" => $Fields['APP_INIT_DATE']
|
||||
"delIndex" => $delIndex,
|
||||
"appInitDate" => $fields['APP_INIT_DATE']
|
||||
];
|
||||
Log::channel(':CreateCase')->info($message, Bootstrap::context($context));
|
||||
//call plugin
|
||||
// Call plugin
|
||||
if (class_exists('folderData')) {
|
||||
$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $newValues['APP_TITLE'], $sUsrUid);
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
$oPluginRegistry->executeTriggers(PM_CREATE_CASE, $folderData);
|
||||
$folderData = new folderData($processUid, $proFields['PRO_TITLE'], $appUid, $newValues['APP_TITLE'], $userUid);
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
$pluginRegistry->executeTriggers(PM_CREATE_CASE, $folderData);
|
||||
}
|
||||
$this->getExecuteTriggerProcess($sAppUid, 'CREATE');
|
||||
//end plugin
|
||||
return array(
|
||||
'APPLICATION' => $sAppUid,
|
||||
'INDEX' => $iDelIndex,
|
||||
'PROCESS' => $sProUid,
|
||||
$this->getExecuteTriggerProcess($appUid, 'CREATE');
|
||||
// End plugin
|
||||
return [
|
||||
'APPLICATION' => $appUid,
|
||||
'INDEX' => $delIndex,
|
||||
'PROCESS' => $processUid,
|
||||
'CASE_NUMBER' => $caseNumber
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6089,7 +6094,7 @@ class Cases
|
||||
switch ($opType) {
|
||||
case 'ANY':
|
||||
//For dynaforms
|
||||
$listDynaform = $objectPermission->objectPermissionByDynaform(
|
||||
$listDynaform = BusinessModelCases::dynaFormsByApplication(
|
||||
$appUid,
|
||||
$opTaskSource,
|
||||
$opObjUid,
|
||||
@@ -6149,7 +6154,7 @@ class Cases
|
||||
$resultMessages = array_merge($resultMessages, $listMessage);
|
||||
break;
|
||||
case 'DYNAFORM':
|
||||
$listDynaform = $objectPermission->objectPermissionByDynaform(
|
||||
$listDynaform = BusinessModelCases::dynaFormsByApplication(
|
||||
$appUid,
|
||||
$opTaskSource,
|
||||
$opObjUid,
|
||||
|
||||
@@ -7,6 +7,7 @@ use ProcessMaker\BusinessModel\Process as BmProcess;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
use ProcessMaker\ChangeLog\ChangeLog;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
use ProcessMaker\BusinessModel\WebEntry;
|
||||
use ProcessMaker\Core\Installer;
|
||||
use ProcessMaker\Core\ProcessesManager;
|
||||
use ProcessMaker\Core\System;
|
||||
@@ -364,6 +365,18 @@ class WorkspaceTools
|
||||
$start = microtime(true);
|
||||
$this->updateTriggers(true, $lang);
|
||||
CLI::logging("* End updating MySQL triggers...(" . (microtime(true) - $start) . " seconds)\n");
|
||||
|
||||
CLI::logging("* Start adding +async option to scheduler commands...\n");
|
||||
$start = microtime(true);
|
||||
$this->addAsyncOptionToSchedulerCommands(true);
|
||||
CLI::logging("* End adding +async option to scheduler commands...(Completed on " . (microtime(true) - $start) . " seconds)\n");
|
||||
|
||||
CLI::logging("* Start Converting Web Entries v1.0 to v2.0 for BPMN processes...\n");
|
||||
$start = microtime(true);
|
||||
Bootstrap::setConstantsRelatedWs($workspace);
|
||||
Propel::init(PATH_CONFIG . 'databases.php');
|
||||
WebEntry::convertFromV1ToV2();
|
||||
CLI::logging("* End converting Web Entries v1.0 to v2.0 for BPMN processes...(" . (microtime(true) - $start) . " seconds)\n");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1243,12 +1256,15 @@ class WorkspaceTools
|
||||
if ($action == 'ADD') {
|
||||
$tablesToAddColumns[$tableName] = $actionData;
|
||||
|
||||
// In a very old schema the primary key for table "LOGIN_LOG" was changed and we need to delete the
|
||||
// In a very old schema the primary key for tables "LOGIN_LOG" and "APP_SEQUENCE" were changed and we need to delete the
|
||||
// primary index to avoid errors in the database upgrade
|
||||
// TO DO: The change of a Primary Key in a table should be generic
|
||||
if ($tableName == 'LOGIN_LOG' && array_key_exists('LOG_ID', $actionData)) {
|
||||
$database->executeQuery('DROP INDEX `PRIMARY` ON LOGIN_LOG;');
|
||||
}
|
||||
if ($tableName == 'APP_SEQUENCE' && array_key_exists('APP_TYPE', $actionData)) {
|
||||
$database->executeQuery('DROP INDEX `PRIMARY` ON APP_SEQUENCE;');
|
||||
}
|
||||
} else {
|
||||
foreach ($actionData as $columnName => $meta) {
|
||||
switch ($action) {
|
||||
@@ -2206,6 +2222,18 @@ class WorkspaceTools
|
||||
$start = microtime(true);
|
||||
$workspace->updateTriggers(true, $lang);
|
||||
CLI::logging("* End updating MySQL triggers...(" . (microtime(true) - $start) . " seconds)\n");
|
||||
|
||||
CLI::logging("* Start adding +async option to scheduler commands...\n");
|
||||
$start = microtime(true);
|
||||
$workspace->addAsyncOptionToSchedulerCommands(false);
|
||||
CLI::logging("* End adding +async option to scheduler commands...(Completed on " . (microtime(true) - $start) . " seconds)\n");
|
||||
|
||||
CLI::logging("* Start Converting Web Entries v1.0 to v2.0 for BPMN processes...\n");
|
||||
$start = microtime(true);
|
||||
Bootstrap::setConstantsRelatedWs($workspace);
|
||||
Propel::init(PATH_CONFIG . 'databases.php');
|
||||
WebEntry::convertFromV1ToV2();
|
||||
CLI::logging("* End converting Web Entries v1.0 to v2.0 for BPMN processes...(" . (microtime(true) - $start) . " seconds)\n");
|
||||
}
|
||||
|
||||
CLI::logging("> Start To Verify License Enterprise...\n");
|
||||
@@ -3285,22 +3313,46 @@ class WorkspaceTools
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add sequence numbers
|
||||
*/
|
||||
public function checkSequenceNumber()
|
||||
{
|
||||
$criteria = new Criteria("workflow");
|
||||
// Instance required class
|
||||
$appSequenceInstance = new AppSequence();
|
||||
|
||||
// Get a record from APP_SEQUENCE table
|
||||
$criteria = new Criteria('workflow');
|
||||
$rsCriteria = AppSequencePeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
$appSequenceRow = $rsCriteria->getRow();
|
||||
|
||||
// If table APP_SEQUENCE is empty, insert two records
|
||||
if (empty($appSequenceRow)) {
|
||||
$sequenceInstance = SequencesPeer::retrieveByPK("APP_NUMBER");
|
||||
$appSequenceInstance = new AppSequence();
|
||||
// Check if exist a value in old table SEQUENCES
|
||||
$sequenceInstance = SequencesPeer::retrieveByPK('APP_NUMBER');
|
||||
|
||||
if (!is_null($sequenceInstance)) {
|
||||
// If exists a value in SEQUENCE table, copy the same to APP_SEQUENCES table
|
||||
$sequenceFields = $sequenceInstance->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$appSequenceInstance->updateSequenceNumber($sequenceFields['SEQ_VALUE']);
|
||||
} else {
|
||||
// If not exists a value in SEQUENCE table, insert a initial value
|
||||
$appSequenceInstance->updateSequenceNumber(0);
|
||||
}
|
||||
|
||||
// Insert a initial value for the web entries
|
||||
$appSequenceInstance->updateSequenceNumber(0, AppSequence::APP_TYPE_WEB_ENTRY);
|
||||
} else {
|
||||
// Create a new instance of Criteria class
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(AppSequencePeer::APP_TYPE, AppSequence::APP_TYPE_WEB_ENTRY);
|
||||
|
||||
// Check if exists a record for the web entries, if not exist insert the initial value
|
||||
if (AppSequencePeer::doCount($criteria) === 0) {
|
||||
$appSequenceInstance->updateSequenceNumber(0, AppSequence::APP_TYPE_WEB_ENTRY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4939,7 +4991,9 @@ class WorkspaceTools
|
||||
$case = new Cases();
|
||||
|
||||
//select cases for this Process, ordered by APP_NUMBER
|
||||
$applications = Application::where('PRO_UID', '=', $processUid)
|
||||
$applications = Application::query()
|
||||
->where('PRO_UID', '=', $processUid)
|
||||
->where('APP_NUMBER', '>', 0)
|
||||
->orderBy('APP_NUMBER', 'asc')
|
||||
->offset($start)
|
||||
->limit($limit)
|
||||
@@ -5040,4 +5094,37 @@ class WorkspaceTools
|
||||
$database = $this->getDatabase($rbac);
|
||||
$database->executeQuery($query, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add +async option to scheduler commands in table SCHEDULER.
|
||||
* @param boolean $force
|
||||
*/
|
||||
public function addAsyncOptionToSchedulerCommands($force = false)
|
||||
{
|
||||
//read update status
|
||||
$this->initPropel(true);
|
||||
$conf = new Configurations();
|
||||
$exist = $conf->exists('ADDED_ASYNC_OPTION_TO_SCHEDULER', 'scheduler');
|
||||
if ($exist === true && $force === false) {
|
||||
$config = (object) $conf->load('ADDED_ASYNC_OPTION_TO_SCHEDULER', 'scheduler');
|
||||
if ($config->updated) {
|
||||
CLI::logging("-> This was previously updated.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//update process
|
||||
$updateQuery = ""
|
||||
. "UPDATE {$this->dbName}.SCHEDULER SET body = REPLACE(body, '+force\"', '+force +async\"') "
|
||||
. "WHERE body NOT LIKE '%+async%'"
|
||||
. "";
|
||||
$con = Propel::getConnection("workflow");
|
||||
$stmt = $con->createStatement();
|
||||
$stmt->executeQuery($updateQuery);
|
||||
CLI::logging("-> Adding +async option to scheduler commands in table {$this->dbName}.SCHEDULER\n");
|
||||
|
||||
//save update status
|
||||
$conf->aConfig = ['updated' => true];
|
||||
$conf->saveConfig('ADDED_ASYNC_OPTION_TO_SCHEDULER', 'scheduler');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,6 +302,9 @@ class PMScript
|
||||
case 'SCRIPT_TASK':
|
||||
$executedOn = self::SCRIPT_TASK;
|
||||
break;
|
||||
case 'SELF_SERVICE_TIMEOUT':
|
||||
$executedOn = self::SELF_SERVICE_TIMEOUT;
|
||||
break;
|
||||
default:
|
||||
$executedOn = self::UNDEFINED_ORIGIN;
|
||||
break;
|
||||
|
||||
@@ -314,6 +314,8 @@ class AppFolder extends BaseAppFolder
|
||||
$oCriteria->addSelectColumn( AppDocumentPeer::APP_DOC_STATUS_DATE);
|
||||
$oCriteria->addSelectColumn( AppDocumentPeer::APP_DOC_FIELDNAME);
|
||||
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_DRIVE_DOWNLOAD);
|
||||
$oCriteria->addJoin(AppDocumentPeer::APP_UID, ApplicationPeer::APP_UID);
|
||||
$oCriteria->add(ApplicationPeer::APP_NUMBER, 0, Criteria::GREATER_THAN);
|
||||
|
||||
if ((is_array( $docIdFilter )) && (count( $docIdFilter ) > 0)) {
|
||||
//Search by App Doc UID no matter what Folder it is
|
||||
|
||||
@@ -16,27 +16,34 @@ require_once 'classes/model/om/BaseAppSequence.php';
|
||||
*/
|
||||
class AppSequence extends BaseAppSequence {
|
||||
|
||||
const APP_TYPE_NORMAL = 'NORMAL';
|
||||
const APP_TYPE_WEB_ENTRY = 'WEB_ENTRY';
|
||||
|
||||
/**
|
||||
* Get an Set new sequence number
|
||||
*
|
||||
* @param string $sequenceType
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function sequenceNumber()
|
||||
public function sequenceNumber($sequenceType)
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection('workflow');
|
||||
$stmt = $con->createStatement();
|
||||
//UPDATE SEQUENCES SET SEQ_VALUE = LAST_INSERT_ID(SEQ_VALUE + 1);
|
||||
$sql = "UPDATE APP_SEQUENCE SET ID=LAST_INSERT_ID(ID+1)";
|
||||
$sql = "UPDATE APP_SEQUENCE SET ID=LAST_INSERT_ID(ID+1) WHERE APP_TYPE = '{$sequenceType}'";
|
||||
$stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
//SELECT LAST_INSERT_ID()
|
||||
$sql = "SELECT LAST_INSERT_ID()";
|
||||
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
$result = $row['LAST_INSERT_ID()'];
|
||||
} catch (\Exception $e) {
|
||||
|
||||
// If the type is WEB_ENTRY, we need to change to negative
|
||||
if ($sequenceType === 'WEB_ENTRY') {
|
||||
$result *= -1;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
return $result;
|
||||
@@ -46,26 +53,36 @@ class AppSequence extends BaseAppSequence {
|
||||
/**
|
||||
* Update sequence number
|
||||
*
|
||||
* @return mixed
|
||||
* @param int $number
|
||||
* @param string $sequenceType
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function updateSequenceNumber($number)
|
||||
public function updateSequenceNumber($number, $sequenceType = AppSequence::APP_TYPE_NORMAL)
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection('workflow');
|
||||
$stmt = $con->createStatement();
|
||||
$c = new Criteria();
|
||||
$rs = AppSequencePeer::doSelectRS($c);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
// Get the current connection
|
||||
$connection = Propel::getConnection('workflow');
|
||||
|
||||
// Create a statement instance
|
||||
$statement = $connection->createStatement();
|
||||
|
||||
// Get the record according to the sequence type
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(AppSequencePeer::APP_TYPE, $sequenceType);
|
||||
$rsCriteria = AppSequencePeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
// Insert/Update sequence table with the number sent
|
||||
if ($row) {
|
||||
$sql = "UPDATE APP_SEQUENCE SET ID=LAST_INSERT_ID('$number')";
|
||||
$sql = "UPDATE APP_SEQUENCE SET ID=LAST_INSERT_ID('{$number}') WHERE APP_TYPE = '{$sequenceType}'";
|
||||
} else {
|
||||
$sql = "INSERT INTO APP_SEQUENCE (ID) VALUES ('$number');";
|
||||
$sql = "INSERT INTO APP_SEQUENCE (ID, APP_TYPE) VALUES ('{$number}', '{$sequenceType}')";
|
||||
}
|
||||
$stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
} catch (\Exception $e) {
|
||||
$statement->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
} catch (Exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,30 +207,31 @@ class Application extends BaseApplication
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the Application
|
||||
* Creates an Application
|
||||
*
|
||||
* @param
|
||||
* $sProUid the process id
|
||||
* $sUsrUid the userid
|
||||
* @return void
|
||||
* @param string $processUid
|
||||
* @param string $userUid
|
||||
* @param string $sequenceType
|
||||
* @throws PropelException
|
||||
* @throws Exception
|
||||
* @return string
|
||||
*/
|
||||
public function create($sProUid, $sUsrUid)
|
||||
public function create($processUid, $userUid, $sequenceType)
|
||||
{
|
||||
require_once ("classes/model/AppSequence.php");
|
||||
$con = Propel::getConnection('workflow');
|
||||
|
||||
try {
|
||||
//fill the default values for new application row
|
||||
// Fill the default values for new application row
|
||||
$this->setAppUid(G::generateUniqueID());
|
||||
$this->setAppParent('');
|
||||
$this->setAppStatus('DRAFT');
|
||||
$this->setAppStatusId(1);
|
||||
$this->setProUid($sProUid);
|
||||
$this->setProUid($processUid);
|
||||
$this->setAppProcStatus('');
|
||||
$this->setAppProcCode('');
|
||||
$this->setAppParallel('N');
|
||||
$this->setAppInitUser($sUsrUid);
|
||||
$this->setAppCurUser($sUsrUid);
|
||||
$this->setAppInitUser($userUid);
|
||||
$this->setAppCurUser($userUid);
|
||||
$this->setAppCreateDate('now');
|
||||
$this->setAppInitDate('now');
|
||||
$this->setAppUpdateDate('now');
|
||||
@@ -241,8 +242,8 @@ class Application extends BaseApplication
|
||||
$c = new Criteria();
|
||||
$c->clearSelectColumns();
|
||||
|
||||
$oAppSequence = new AppSequence();
|
||||
$maxNumber = $oAppSequence->sequenceNumber();
|
||||
$appSequence = new AppSequence();
|
||||
$maxNumber = $appSequence->sequenceNumber($sequenceType);
|
||||
|
||||
$this->setAppNumber($maxNumber);
|
||||
$this->setAppData(serialize(['APP_NUMBER' => $maxNumber, 'PIN' => $pin]));
|
||||
@@ -253,9 +254,7 @@ class Application extends BaseApplication
|
||||
$con->begin();
|
||||
$this->setAppTitleContent('#' . $maxNumber);
|
||||
$this->setAppDescriptionContent('');
|
||||
//to do: ID_CASE in translation $this->setAppTitle(G::LoadTranslation('ID_CASE') . $maxNumber);
|
||||
//Content::insertContent('APP_PROC_CODE', '', $this->getAppUid(), $lang, '');
|
||||
$res = $this->save();
|
||||
$this->save();
|
||||
$con->commit();
|
||||
|
||||
return $this->getAppUid();
|
||||
|
||||
@@ -65,7 +65,9 @@ class AppSequenceMapBuilder
|
||||
|
||||
$tMap->setUseIdGenerator(false);
|
||||
|
||||
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
|
||||
$tMap->addColumn('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
|
||||
|
||||
$tMap->addColumn('APP_TYPE', 'AppType', 'string', CreoleTypes::VARCHAR, true, 20);
|
||||
|
||||
} // doBuild()
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class AppTimeoutActionExecutedMapBuilder
|
||||
|
||||
$tMap->addPrimaryKey('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||
|
||||
$tMap->addColumn('DEL_INDEX', 'DelIndex', 'int', CreoleTypes::INTEGER, true, null);
|
||||
$tMap->addPrimaryKey('DEL_INDEX', 'DelIndex', 'int', CreoleTypes::INTEGER, true, null);
|
||||
|
||||
$tMap->addColumn('EXECUTION_DATE', 'ExecutionDate', 'int', CreoleTypes::TIMESTAMP, false, null);
|
||||
|
||||
|
||||
@@ -33,6 +33,12 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* The value for the app_type field.
|
||||
* @var string
|
||||
*/
|
||||
protected $app_type = 'NORMAL';
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
@@ -58,6 +64,17 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [app_type] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAppType()
|
||||
{
|
||||
|
||||
return $this->app_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [id] column.
|
||||
*
|
||||
@@ -80,6 +97,28 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
|
||||
|
||||
} // setId()
|
||||
|
||||
/**
|
||||
* Set the value of [app_type] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setAppType($v)
|
||||
{
|
||||
|
||||
// Since the native PHP type for this column is string,
|
||||
// we will cast the input to a string (if it is not).
|
||||
if ($v !== null && !is_string($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->app_type !== $v || $v === 'NORMAL') {
|
||||
$this->app_type = $v;
|
||||
$this->modifiedColumns[] = AppSequencePeer::APP_TYPE;
|
||||
}
|
||||
|
||||
} // setAppType()
|
||||
|
||||
/**
|
||||
* Hydrates (populates) the object variables with values from the database resultset.
|
||||
*
|
||||
@@ -99,12 +138,14 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
|
||||
|
||||
$this->id = $rs->getInt($startcol + 0);
|
||||
|
||||
$this->app_type = $rs->getString($startcol + 1);
|
||||
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
||||
// FIXME - using NUM_COLUMNS may be clearer.
|
||||
return $startcol + 1; // 1 = AppSequencePeer::NUM_COLUMNS - AppSequencePeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
return $startcol + 2; // 2 = AppSequencePeer::NUM_COLUMNS - AppSequencePeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating AppSequence object", $e);
|
||||
@@ -311,6 +352,9 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
|
||||
case 0:
|
||||
return $this->getId();
|
||||
break;
|
||||
case 1:
|
||||
return $this->getAppType();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
@@ -332,6 +376,7 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
|
||||
$keys = AppSequencePeer::getFieldNames($keyType);
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getAppType(),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
@@ -366,6 +411,9 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
|
||||
case 0:
|
||||
$this->setId($value);
|
||||
break;
|
||||
case 1:
|
||||
$this->setAppType($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
@@ -393,6 +441,10 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
|
||||
$this->setId($arr[$keys[0]]);
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[1], $arr)) {
|
||||
$this->setAppType($arr[$keys[1]]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -408,6 +460,10 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
|
||||
$criteria->add(AppSequencePeer::ID, $this->id);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(AppSequencePeer::APP_TYPE)) {
|
||||
$criteria->add(AppSequencePeer::APP_TYPE, $this->app_type);
|
||||
}
|
||||
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
@@ -424,30 +480,33 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
|
||||
{
|
||||
$criteria = new Criteria(AppSequencePeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(AppSequencePeer::ID, $this->id);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the primary key for this object (row).
|
||||
* @return int
|
||||
* Returns NULL since this table doesn't have a primary key.
|
||||
* This method exists only for BC and is deprecated!
|
||||
* @return null
|
||||
*/
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->getId();
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic method to set the primary key (id column).
|
||||
* Dummy primary key setter.
|
||||
*
|
||||
* @param int $key Primary key.
|
||||
* @return void
|
||||
* This function only exists to preserve backwards compatibility. It is no longer
|
||||
* needed or required by the Persistent interface. It will be removed in next BC-breaking
|
||||
* release of Propel.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function setPrimaryKey($key)
|
||||
{
|
||||
$this->setId($key);
|
||||
}
|
||||
public function setPrimaryKey($pk)
|
||||
{
|
||||
// do nothing, because this object doesn't have any primary keys
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets contents of passed object to values from current object.
|
||||
@@ -462,11 +521,13 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
|
||||
public function copyInto($copyObj, $deepCopy = false)
|
||||
{
|
||||
|
||||
$copyObj->setId($this->id);
|
||||
|
||||
$copyObj->setAppType($this->app_type);
|
||||
|
||||
|
||||
$copyObj->setNew(true);
|
||||
|
||||
$copyObj->setId(NULL); // this is a pkey column, so set to default value
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class BaseAppSequencePeer
|
||||
const CLASS_DEFAULT = 'classes.model.AppSequence';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 1;
|
||||
const NUM_COLUMNS = 2;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
@@ -34,6 +34,9 @@ abstract class BaseAppSequencePeer
|
||||
/** the column name for the ID field */
|
||||
const ID = 'APP_SEQUENCE.ID';
|
||||
|
||||
/** the column name for the APP_TYPE field */
|
||||
const APP_TYPE = 'APP_SEQUENCE.APP_TYPE';
|
||||
|
||||
/** The PHP to DB Name Mapping */
|
||||
private static $phpNameMap = null;
|
||||
|
||||
@@ -45,10 +48,10 @@ abstract class BaseAppSequencePeer
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('Id', ),
|
||||
BasePeer::TYPE_COLNAME => array (AppSequencePeer::ID, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('ID', ),
|
||||
BasePeer::TYPE_NUM => array (0, )
|
||||
BasePeer::TYPE_PHPNAME => array ('Id', 'AppType', ),
|
||||
BasePeer::TYPE_COLNAME => array (AppSequencePeer::ID, AppSequencePeer::APP_TYPE, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('ID', 'APP_TYPE', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -58,10 +61,10 @@ abstract class BaseAppSequencePeer
|
||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('Id' => 0, ),
|
||||
BasePeer::TYPE_COLNAME => array (AppSequencePeer::ID => 0, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('ID' => 0, ),
|
||||
BasePeer::TYPE_NUM => array (0, )
|
||||
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'AppType' => 1, ),
|
||||
BasePeer::TYPE_COLNAME => array (AppSequencePeer::ID => 0, AppSequencePeer::APP_TYPE => 1, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('ID' => 0, 'APP_TYPE' => 1, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -164,10 +167,12 @@ abstract class BaseAppSequencePeer
|
||||
|
||||
$criteria->addSelectColumn(AppSequencePeer::ID);
|
||||
|
||||
$criteria->addSelectColumn(AppSequencePeer::APP_TYPE);
|
||||
|
||||
}
|
||||
|
||||
const COUNT = 'COUNT(APP_SEQUENCE.ID)';
|
||||
const COUNT_DISTINCT = 'COUNT(DISTINCT APP_SEQUENCE.ID)';
|
||||
const COUNT = 'COUNT(*)';
|
||||
const COUNT_DISTINCT = 'COUNT(DISTINCT *)';
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria.
|
||||
@@ -376,9 +381,6 @@ abstract class BaseAppSequencePeer
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
|
||||
$comparison = $criteria->getComparison(AppSequencePeer::ID);
|
||||
$selectCriteria->add(AppSequencePeer::ID, $criteria->remove(AppSequencePeer::ID), $comparison);
|
||||
|
||||
} else {
|
||||
$criteria = $values->buildCriteria(); // gets full criteria
|
||||
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
|
||||
@@ -436,11 +438,22 @@ abstract class BaseAppSequencePeer
|
||||
$criteria = clone $values; // rename for clarity
|
||||
} elseif ($values instanceof AppSequence) {
|
||||
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
$criteria = $values->buildCriteria();
|
||||
} else {
|
||||
// it must be the primary key
|
||||
$criteria = new Criteria(self::DATABASE_NAME);
|
||||
$criteria->add(AppSequencePeer::ID, (array) $values, Criteria::IN);
|
||||
// primary key is composite; we therefore, expect
|
||||
// the primary key passed to be an array of pkey
|
||||
// values
|
||||
if (count($values) == count($values, COUNT_RECURSIVE)) {
|
||||
// array is not multi-dimensional
|
||||
$values = array($values);
|
||||
}
|
||||
$vals = array();
|
||||
foreach ($values as $value) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
@@ -498,54 +511,6 @@ abstract class BaseAppSequencePeer
|
||||
|
||||
return BasePeer::doValidate(AppSequencePeer::DATABASE_NAME, AppSequencePeer::TABLE_NAME, $columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a single object by pkey.
|
||||
*
|
||||
* @param mixed $pk the primary key.
|
||||
* @param Connection $con the connection to use
|
||||
* @return AppSequence
|
||||
*/
|
||||
public static function retrieveByPK($pk, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = new Criteria(AppSequencePeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(AppSequencePeer::ID, $pk);
|
||||
|
||||
|
||||
$v = AppSequencePeer::doSelect($criteria, $con);
|
||||
|
||||
return !empty($v) > 0 ? $v[0] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve multiple objects by pkey.
|
||||
*
|
||||
* @param array $pks List of primary keys
|
||||
* @param Connection $con the connection to use
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function retrieveByPKs($pks, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$objs = null;
|
||||
if (empty($pks)) {
|
||||
$objs = array();
|
||||
} else {
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(AppSequencePeer::ID, $pks, Criteria::IN);
|
||||
$objs = AppSequencePeer::doSelect($criteria, $con);
|
||||
}
|
||||
return $objs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -565,28 +565,40 @@ abstract class BaseAppTimeoutActionExecuted extends BaseObject implements Persis
|
||||
$criteria = new Criteria(AppTimeoutActionExecutedPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(AppTimeoutActionExecutedPeer::APP_UID, $this->app_uid);
|
||||
$criteria->add(AppTimeoutActionExecutedPeer::DEL_INDEX, $this->del_index);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the primary key for this object (row).
|
||||
* @return string
|
||||
* Returns the composite primary key for this object.
|
||||
* The array elements will be in same order as specified in XML.
|
||||
* @return array
|
||||
*/
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->getAppUid();
|
||||
$pks = array();
|
||||
|
||||
$pks[0] = $this->getAppUid();
|
||||
|
||||
$pks[1] = $this->getDelIndex();
|
||||
|
||||
return $pks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic method to set the primary key (app_uid column).
|
||||
* Set the [composite] primary key.
|
||||
*
|
||||
* @param string $key Primary key.
|
||||
* @param array $keys The elements of the composite key (order must match the order in XML file).
|
||||
* @return void
|
||||
*/
|
||||
public function setPrimaryKey($key)
|
||||
public function setPrimaryKey($keys)
|
||||
{
|
||||
$this->setAppUid($key);
|
||||
|
||||
$this->setAppUid($keys[0]);
|
||||
|
||||
$this->setDelIndex($keys[1]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -602,8 +614,6 @@ abstract class BaseAppTimeoutActionExecuted extends BaseObject implements Persis
|
||||
public function copyInto($copyObj, $deepCopy = false)
|
||||
{
|
||||
|
||||
$copyObj->setDelIndex($this->del_index);
|
||||
|
||||
$copyObj->setExecutionDate($this->execution_date);
|
||||
|
||||
|
||||
@@ -611,6 +621,8 @@ abstract class BaseAppTimeoutActionExecuted extends BaseObject implements Persis
|
||||
|
||||
$copyObj->setAppUid(''); // this is a pkey column, so set to default value
|
||||
|
||||
$copyObj->setDelIndex('0'); // this is a pkey column, so set to default value
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -389,6 +389,9 @@ abstract class BaseAppTimeoutActionExecutedPeer
|
||||
$comparison = $criteria->getComparison(AppTimeoutActionExecutedPeer::APP_UID);
|
||||
$selectCriteria->add(AppTimeoutActionExecutedPeer::APP_UID, $criteria->remove(AppTimeoutActionExecutedPeer::APP_UID), $comparison);
|
||||
|
||||
$comparison = $criteria->getComparison(AppTimeoutActionExecutedPeer::DEL_INDEX);
|
||||
$selectCriteria->add(AppTimeoutActionExecutedPeer::DEL_INDEX, $criteria->remove(AppTimeoutActionExecutedPeer::DEL_INDEX), $comparison);
|
||||
|
||||
} else {
|
||||
$criteria = $values->buildCriteria(); // gets full criteria
|
||||
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
|
||||
@@ -450,7 +453,22 @@ abstract class BaseAppTimeoutActionExecutedPeer
|
||||
} else {
|
||||
// it must be the primary key
|
||||
$criteria = new Criteria(self::DATABASE_NAME);
|
||||
$criteria->add(AppTimeoutActionExecutedPeer::APP_UID, (array) $values, Criteria::IN);
|
||||
// primary key is composite; we therefore, expect
|
||||
// the primary key passed to be an array of pkey
|
||||
// values
|
||||
if (count($values) == count($values, COUNT_RECURSIVE)) {
|
||||
// array is not multi-dimensional
|
||||
$values = array($values);
|
||||
}
|
||||
$vals = array();
|
||||
foreach ($values as $value) {
|
||||
|
||||
$vals[0][] = $value[0];
|
||||
$vals[1][] = $value[1];
|
||||
}
|
||||
|
||||
$criteria->add(AppTimeoutActionExecutedPeer::APP_UID, $vals[0], Criteria::IN);
|
||||
$criteria->add(AppTimeoutActionExecutedPeer::DEL_INDEX, $vals[1], Criteria::IN);
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
@@ -510,51 +528,23 @@ abstract class BaseAppTimeoutActionExecutedPeer
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a single object by pkey.
|
||||
*
|
||||
* @param mixed $pk the primary key.
|
||||
* @param Connection $con the connection to use
|
||||
* Retrieve object using using composite pkey values.
|
||||
* @param string $app_uid
|
||||
* @param int $del_index
|
||||
* @param Connection $con
|
||||
* @return AppTimeoutActionExecuted
|
||||
*/
|
||||
public static function retrieveByPK($pk, $con = null)
|
||||
public static function retrieveByPK($app_uid, $del_index, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = new Criteria(AppTimeoutActionExecutedPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(AppTimeoutActionExecutedPeer::APP_UID, $pk);
|
||||
|
||||
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(AppTimeoutActionExecutedPeer::APP_UID, $app_uid);
|
||||
$criteria->add(AppTimeoutActionExecutedPeer::DEL_INDEX, $del_index);
|
||||
$v = AppTimeoutActionExecutedPeer::doSelect($criteria, $con);
|
||||
|
||||
return !empty($v) > 0 ? $v[0] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve multiple objects by pkey.
|
||||
*
|
||||
* @param array $pks List of primary keys
|
||||
* @param Connection $con the connection to use
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function retrieveByPKs($pks, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$objs = null;
|
||||
if (empty($pks)) {
|
||||
$objs = array();
|
||||
} else {
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(AppTimeoutActionExecutedPeer::APP_UID, $pks, Criteria::IN);
|
||||
$objs = AppTimeoutActionExecutedPeer::doSelect($criteria, $con);
|
||||
}
|
||||
return $objs;
|
||||
return !empty($v) ? $v[0] : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user