diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index a195e8378..c45935522 100644 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -1038,7 +1038,7 @@ function migrate_new_cases_lists($command, $args, $opts) foreach ($workspaces as $workspace) { print_r("Upgrading database in " . pakeColor::colorize($workspace->name, "INFO") . "\n"); try { - $workspace->migrateList($workspace->name, true, $lang); + $workspace->migrateList(true, $lang); echo "> List tables are done\n"; } catch (Exception $e) { G::outRes("> Error: " . CLI::error($e->getMessage()) . "\n"); @@ -1063,17 +1063,15 @@ function migrate_counters($command, $args) } } -function migrate_list_unassigned($command, $args, $opts) +function migrate_list_unassigned($command, $args) { $filter = new InputFilter(); - $opts = $filter->xssFilterHard($opts); $args = $filter->xssFilterHard($args); - $lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en'; $workspaces = get_workspaces_from_args($args); foreach ($workspaces as $workspace) { print_r("Upgrading Unassigned List in" . pakeColor::colorize($workspace->name, "INFO") . "\n"); try { - $workspace->regenerateListUnassigned(); + $workspace->runRegenerateListUnassigned(); echo "> Unassigned List is done\n"; } catch (Exception $e) { G::outRes("> Error: " . CLI::error($e->getMessage()) . "\n"); diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index f7f6d86e2..f4badbba6 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -2923,6 +2923,29 @@ class WorkspaceTools return $query; } + /** + * Re-populate only the unassigned list + */ + public function runRegenerateListUnassigned() + { + // Init Propel + $this->initPropel(true); + + // Initialize Propel objects + $con = Propel::getConnection("workflow"); + $stmt = $con->createStatement(); + + // Clean table + $stmt->executeQuery('TRUNCATE ' . $this->dbName . '.LIST_UNASSIGNED;'); + + // Populate table + $stmt->executeQuery($this->regenerateListUnassigned()); + + // Update some fields + $stmt->executeQuery($this->updateListProId('LIST_UNASSIGNED')); + $stmt->executeQuery($this->updateListTasId('LIST_UNASSIGNED')); + } + /** * Return query to update PRO_ID in list table * diff --git a/workflow/engine/classes/model/AppDelay.php b/workflow/engine/classes/model/AppDelay.php index 06d9d269c..6157d6907 100644 --- a/workflow/engine/classes/model/AppDelay.php +++ b/workflow/engine/classes/model/AppDelay.php @@ -199,6 +199,8 @@ class AppDelay extends BaseAppDelay if (empty($usrUid)) { global $RBAC; $usrUid = $RBAC->aUserInfo['USER_INFO']['USR_UID']; + } + if (empty($usrId)) { $u = new Users(); $usrId = $u->load($usrUid)['USR_ID']; }