Fix errors found in FT. Command 'migrate-list-unassigned'. User Id in APP_DELAY.

This commit is contained in:
Julio Cesar Laura Avendaño
2019-07-08 14:46:00 -04:00
parent ba0895dbf0
commit 9d0692f13c
3 changed files with 28 additions and 5 deletions

View File

@@ -1038,7 +1038,7 @@ function migrate_new_cases_lists($command, $args, $opts)
foreach ($workspaces as $workspace) { foreach ($workspaces as $workspace) {
print_r("Upgrading database in " . pakeColor::colorize($workspace->name, "INFO") . "\n"); print_r("Upgrading database in " . pakeColor::colorize($workspace->name, "INFO") . "\n");
try { try {
$workspace->migrateList($workspace->name, true, $lang); $workspace->migrateList(true, $lang);
echo "> List tables are done\n"; echo "> List tables are done\n";
} catch (Exception $e) { } catch (Exception $e) {
G::outRes("> Error: " . CLI::error($e->getMessage()) . "\n"); 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(); $filter = new InputFilter();
$opts = $filter->xssFilterHard($opts);
$args = $filter->xssFilterHard($args); $args = $filter->xssFilterHard($args);
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
$workspaces = get_workspaces_from_args($args); $workspaces = get_workspaces_from_args($args);
foreach ($workspaces as $workspace) { foreach ($workspaces as $workspace) {
print_r("Upgrading Unassigned List in" . pakeColor::colorize($workspace->name, "INFO") . "\n"); print_r("Upgrading Unassigned List in" . pakeColor::colorize($workspace->name, "INFO") . "\n");
try { try {
$workspace->regenerateListUnassigned(); $workspace->runRegenerateListUnassigned();
echo "> Unassigned List is done\n"; echo "> Unassigned List is done\n";
} catch (Exception $e) { } catch (Exception $e) {
G::outRes("> Error: " . CLI::error($e->getMessage()) . "\n"); G::outRes("> Error: " . CLI::error($e->getMessage()) . "\n");

View File

@@ -2923,6 +2923,29 @@ class WorkspaceTools
return $query; 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 * Return query to update PRO_ID in list table
* *

View File

@@ -199,6 +199,8 @@ class AppDelay extends BaseAppDelay
if (empty($usrUid)) { if (empty($usrUid)) {
global $RBAC; global $RBAC;
$usrUid = $RBAC->aUserInfo['USER_INFO']['USR_UID']; $usrUid = $RBAC->aUserInfo['USER_INFO']['USR_UID'];
}
if (empty($usrId)) {
$u = new Users(); $u = new Users();
$usrId = $u->load($usrUid)['USR_ID']; $usrId = $u->load($usrUid)['USR_ID'];
} }