Merged in bugfix/PMCORE-2638 (pull request #7683)
PMCORE-2638 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -2251,9 +2251,9 @@ class WorkspaceTools
|
|||||||
|
|
||||||
CLI::logging("* Start Converting Web Entries v1.0 to v2.0 for BPMN processes...\n");
|
CLI::logging("* Start Converting Web Entries v1.0 to v2.0 for BPMN processes...\n");
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
Bootstrap::setConstantsRelatedWs($workspace);
|
$workspace->initPropel(true);
|
||||||
Propel::init(PATH_CONFIG . 'databases.php');
|
$statement = Propel::getConnection('workflow')->createStatement();
|
||||||
WebEntry::convertFromV1ToV2();
|
$statement->executeQuery(WebEntry::UPDATE_QUERY_V1_TO_V2);
|
||||||
CLI::logging("* End converting Web Entries v1.0 to v2.0 for BPMN processes...(" . (microtime(true) - $start) . " seconds)\n");
|
CLI::logging("* End converting Web Entries v1.0 to v2.0 for BPMN processes...(" . (microtime(true) - $start) . " seconds)\n");
|
||||||
|
|
||||||
CLI::logging("* Start migrating case title...\n");
|
CLI::logging("* Start migrating case title...\n");
|
||||||
@@ -5180,28 +5180,35 @@ class WorkspaceTools
|
|||||||
*/
|
*/
|
||||||
public function migrateCaseTitleToThreads($args)
|
public function migrateCaseTitleToThreads($args)
|
||||||
{
|
{
|
||||||
|
// Define the main query
|
||||||
|
$query = "
|
||||||
|
UPDATE
|
||||||
|
`APP_DELEGATION`
|
||||||
|
LEFT JOIN
|
||||||
|
`APPLICATION` ON `APP_DELEGATION`.`APP_NUMBER` = `APPLICATION`.`APP_NUMBER`
|
||||||
|
SET
|
||||||
|
`APP_DELEGATION`.`DEL_TITLE` = `APPLICATION`.`APP_TITLE`
|
||||||
|
WHERE
|
||||||
|
(`APPLICATION`.`APP_STATUS_ID` IN (2) OR
|
||||||
|
(`APPLICATION`.`APP_STATUS_ID` IN (3, 4) AND
|
||||||
|
`APP_DELEGATION`.`DEL_LAST_INDEX` = 1))";
|
||||||
|
|
||||||
|
// Add additional filters
|
||||||
|
if (!empty($args[1]) && is_numeric($args[1])) {
|
||||||
|
$query .= " AND `APP_DELEGATION`.`APP_NUMBER` >= {$args[1]}";
|
||||||
|
}
|
||||||
|
if (!empty($args[2]) && is_numeric($args[2])) {
|
||||||
|
$query .= " AND `APP_DELEGATION`.`APP_NUMBER` <= {$args[2]}";
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (!empty($args)) {
|
if (!empty($args)) {
|
||||||
// Set workspace constants and initialize DB connection
|
// Set workspace constants and initialize DB connection
|
||||||
Bootstrap::setConstantsRelatedWs($args[0]);
|
Bootstrap::setConstantsRelatedWs($args[0]);
|
||||||
Propel::init(PATH_CONFIG . 'databases.php');
|
Propel::init(PATH_CONFIG . 'databases.php');
|
||||||
$query = Delegation::leftJoin('APPLICATION', function ($leftJoin) {
|
|
||||||
$leftJoin->on('APP_DELEGATION.APP_NUMBER', '=', 'APPLICATION.APP_NUMBER');
|
// Execute the query
|
||||||
});
|
$statement = Propel::getConnection('workflow')->createStatement();
|
||||||
$query->where(function ($query) {
|
$statement->executeQuery($query);
|
||||||
$query->whereIn('APPLICATION.APP_STATUS_ID', [2]);
|
|
||||||
$query->orWhere(function ($query) {
|
|
||||||
$query->whereIn('APPLICATION.APP_STATUS_ID', [3, 4]);
|
|
||||||
$query->where('APP_DELEGATION.DEL_LAST_INDEX', '=', 1);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if (!empty($args[1]) && is_numeric($args[1])) {
|
|
||||||
$query->where('APP_DELEGATION.APP_NUMBER', '>=', $args[1]);
|
|
||||||
}
|
|
||||||
if (!empty($args[2]) && is_numeric($args[2])) {
|
|
||||||
$query->where('APP_DELEGATION.APP_NUMBER', '<=', $args[2]);
|
|
||||||
}
|
|
||||||
$query->update(['APP_DELEGATION.DEL_TITLE' => DB::raw('APPLICATION.APP_TITLE')]);
|
|
||||||
|
|
||||||
CLI::logging("The Case Title has been updated successfully in APP_DELEGATION table." . PHP_EOL);
|
CLI::logging("The Case Title has been updated successfully in APP_DELEGATION table." . PHP_EOL);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -12,6 +12,19 @@ use WebEntryPeer;
|
|||||||
|
|
||||||
class WebEntry
|
class WebEntry
|
||||||
{
|
{
|
||||||
|
const UPDATE_QUERY_V1_TO_V2 = "
|
||||||
|
UPDATE
|
||||||
|
`WEB_ENTRY`
|
||||||
|
LEFT JOIN
|
||||||
|
`BPMN_PROCESS`
|
||||||
|
ON
|
||||||
|
(`WEB_ENTRY`.`PRO_UID` = `BPMN_PROCESS`.`PRJ_UID`)
|
||||||
|
SET
|
||||||
|
`WEB_ENTRY`.`DYN_UID` = '', `WEB_ENTRY`.`WE_TYPE` = 'MULTIPLE'
|
||||||
|
WHERE
|
||||||
|
`WE_TYPE` = 'SINGLE' AND `WE_AUTHENTICATION` = 'ANONYMOUS' AND
|
||||||
|
`WE_CALLBACK` = 'PROCESSMAKER' AND `BPMN_PROCESS`.`PRJ_UID` IS NOT NULL";
|
||||||
|
|
||||||
private $arrayFieldDefinition = array(
|
private $arrayFieldDefinition = array(
|
||||||
"WE_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "webEntryUid"),
|
"WE_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "webEntryUid"),
|
||||||
|
|
||||||
@@ -1174,21 +1187,8 @@ class WebEntry
|
|||||||
*/
|
*/
|
||||||
public static function convertFromV1ToV2()
|
public static function convertFromV1ToV2()
|
||||||
{
|
{
|
||||||
// Build query
|
|
||||||
$query = "UPDATE
|
|
||||||
`WEB_ENTRY`
|
|
||||||
LEFT JOIN
|
|
||||||
`BPMN_PROCESS`
|
|
||||||
ON
|
|
||||||
(`WEB_ENTRY`.`PRO_UID` = `BPMN_PROCESS`.`PRJ_UID`)
|
|
||||||
SET
|
|
||||||
`WEB_ENTRY`.`DYN_UID` = '', `WEB_ENTRY`.`WE_TYPE` = 'MULTIPLE'
|
|
||||||
WHERE
|
|
||||||
`WE_TYPE` = 'SINGLE' AND `WE_AUTHENTICATION` = 'ANONYMOUS' AND
|
|
||||||
`WE_CALLBACK` = 'PROCESSMAKER' AND `BPMN_PROCESS`.`PRJ_UID` IS NOT NULL";
|
|
||||||
|
|
||||||
// Execute query
|
// Execute query
|
||||||
DB::connection('workflow')->statement($query);
|
DB::connection('workflow')->statement(self::UPDATE_QUERY_V1_TO_V2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user