Merged develop into feature/HOR-3610

This commit is contained in:
Paula Quispe
2017-08-03 18:08:17 -04:00
7 changed files with 702 additions and 430 deletions

View File

@@ -162,6 +162,8 @@ CLI::taskDescription(<<<EOT
EOT EOT
); );
CLI::taskArg('workspace-name', true, true); CLI::taskArg('workspace-name', true, true);
CLI::taskOpt('noxml', 'If this option is enabled, the XML files will not be modified.', 'NoXml', 'no-xml');
CLI::taskOpt('nomafe', 'If this option is enabled, the Front End (BPMN Designer and Bootstrap Forms) translation file will not be modified.', 'NoMafe', 'no-mafe');
CLI::taskRun("run_translation_upgrade"); CLI::taskRun("run_translation_upgrade");
CLI::taskName('migrate-cases-folders'); CLI::taskName('migrate-cases-folders');
@@ -370,22 +372,62 @@ function run_workspace_upgrade($args, $opts) {
} }
} }
/**
* We will repair the translation in the languages defined in the workspace
* Verify if we need to execute an external program for each workspace
* If we apply the command for all workspaces, we will need to execute one by one by redefining the constants
* @param string $args, workspaceName that we need to apply the database-upgrade
* @param string $opts
*
* @return void
*/
function run_translation_upgrade($args, $opts) { function run_translation_upgrade($args, $opts) {
G::LoadSystem('inputfilter'); $noXml = array_key_exists('noxml', $opts) ? '--no-xml' : '';
$filter = new InputFilter(); $noMafe = array_key_exists('nomafe', $opts) ? '--no-mafe' : '';
$opts = $filter->xssFilterHard($opts); if (!empty($noXml)) {
$args = $filter->xssFilterHard($args); $noMafe = ' ' . $noMafe;
}
//Check if the command is executed by a specific workspace
if (count($args) === 1) {
translation_upgrade($args, $opts);
} else {
$workspaces = get_workspaces_from_args($args); $workspaces = get_workspaces_from_args($args);
$first = true; foreach ($workspaces as $workspace) {
passthru('./processmaker translation-repair ' . $noXml . $noMafe . ' ' . $workspace->name);
}
}
}
/**
* This function will regenerate the translation for a workspace
* This function is executed only for one workspace
* @param array $args, workspaceName that we will to apply the command
* @param array $opts, noxml and nomafe flags
*
* @return void
*/
function translation_upgrade($args, $opts)
{
try {
//Load the attributes for the workspace
$arrayWorkspace = get_workspaces_from_args($args);
//Loop, read all the attributes related to the one workspace
$wsName = $arrayWorkspace[key($arrayWorkspace)]->name;
Bootstrap::setConstantsRelatedWs($wsName);
$workspaces = get_workspaces_from_args($args);
$flagUpdateXml = (!array_key_exists('noxml', $opts));
$flagUpdateMafe = (!array_key_exists('nomafe', $opts));
foreach ($workspaces as $workspace) { foreach ($workspaces as $workspace) {
try { try {
G::outRes("Upgrading translation for " . pakeColor::colorize($workspace->name, "INFO") . "\n"); G::outRes("Upgrading translation for " . pakeColor::colorize($workspace->name, "INFO") . "\n");
$workspace->upgradeTranslation($first, $first); $workspace->upgradeTranslation($flagUpdateXml, $flagUpdateMafe);
$first = false;
} catch (Exception $e) { } catch (Exception $e) {
G::outRes("Errors upgrading translation of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n"); G::outRes("Errors upgrading translation of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n");
} }
} }
} catch (Exception $e) {
G::outRes(CLI::error($e->getMessage()) . "\n");
}
} }
function run_cacheview_upgrade($args, $opts) { function run_cacheview_upgrade($args, $opts) {

File diff suppressed because it is too large Load Diff

View File

@@ -214,15 +214,13 @@ class ListUnassigned extends BaseListUnassigned
* This function get the information in the corresponding cases list * This function get the information in the corresponding cases list
* @param string $usr_uid, must be show cases related to this user * @param string $usr_uid, must be show cases related to this user
* @param array $filters for apply in the result * @param array $filters for apply in the result
* @param null $callbackRecord * @param callable $callbackRecord
* @return array $data * @return array $data
* @throws PropelException * @throws PropelException
*/ */
public function loadList($usr_uid, $filters = array(), $callbackRecord = null) public function loadList($usr_uid, $filters = array(), callable $callbackRecord = null)
{ {
$resp = array();
$pmTable = new PmTable(); $pmTable = new PmTable();
$tasks = $this->getSelfServiceTasks($usr_uid);
$criteria = $pmTable->addPMFieldsToList('unassigned'); $criteria = $pmTable->addPMFieldsToList('unassigned');
$this->additionalClassName = $pmTable->tableClassName; $this->additionalClassName = $pmTable->tableClassName;
$additionalColumns = $criteria->getSelectColumns(); $additionalColumns = $criteria->getSelectColumns();
@@ -244,60 +242,7 @@ class ListUnassigned extends BaseListUnassigned
$criteria->addSelectColumn(ListUnassignedPeer::DEL_DUE_DATE); $criteria->addSelectColumn(ListUnassignedPeer::DEL_DUE_DATE);
$criteria->addSelectColumn(ListUnassignedPeer::DEL_PRIORITY); $criteria->addSelectColumn(ListUnassignedPeer::DEL_PRIORITY);
//Self Service Value Based Assignment //Self Service Value Based Assignment
$aSelfServiceValueBased = $this->getSelfServiceCasesByEvaluate($usr_uid); $criteria = $this->getCriteriaWhereSelfService($criteria, $usr_uid);
if (!empty($aSelfServiceValueBased)) {
$criterionAux = null;
//Load Self Service Value Based Assignment
foreach ($aSelfServiceValueBased as $value) {
if (is_null($criterionAux)) {
$criterionAux = $criteria->getNewCriterion(
ListUnassignedPeer::APP_UID,
$value["APP_UID"],
Criteria::EQUAL
)->addAnd(
$criteria->getNewCriterion(
ListUnassignedPeer::DEL_INDEX,
$value["DEL_INDEX"],
Criteria::EQUAL
)
)->addAnd(
$criteria->getNewCriterion(
ListUnassignedPeer::TAS_UID,
$value["TAS_UID"],
Criteria::EQUAL
)
);
} else {
$criterionAux = $criteria->getNewCriterion(
ListUnassignedPeer::APP_UID,
$value["APP_UID"],
Criteria::EQUAL
)->addAnd(
$criteria->getNewCriterion(
ListUnassignedPeer::DEL_INDEX,
$value["DEL_INDEX"],
Criteria::EQUAL
)
)->addAnd(
$criteria->getNewCriterion(
ListUnassignedPeer::TAS_UID,
$value["TAS_UID"],
Criteria::EQUAL
)
)->addOr(
$criterionAux
);
}
}
//And Load Selfservice
$criteria->add(
$criterionAux->addOr($criteria->getNewCriterion(ListUnassignedPeer::TAS_UID, $tasks, Criteria::IN))
);
} else {
//Load Selfservice
$criteria->add(ListUnassignedPeer::TAS_UID, $tasks, Criteria::IN);
}
//Apply some filters //Apply some filters
self::loadFilters($criteria, $filters, $additionalColumns); self::loadFilters($criteria, $filters, $additionalColumns);
@@ -346,10 +291,11 @@ class ListUnassigned extends BaseListUnassigned
} }
/** /**
* Get Selfservice Value Based * Get SelfService Value Based
* *
* @param string $userUid * @param string $userUid
* @return array criteria $arrayAppAssignSelfServiceValueData * @return array $arrayAppAssignSelfServiceValueData
* @throws Exception
*/ */
public function getSelfServiceCasesByEvaluate($userUid) public function getSelfServiceCasesByEvaluate($userUid)
{ {
@@ -402,8 +348,8 @@ class ListUnassigned extends BaseListUnassigned
/** /**
* get user's SelfService tasks * get user's SelfService tasks
* @param string $sUIDUser * @param string $userUid
* @return $rows * @return array $tasks
*/ */
public function getSelfServiceTasks($userUid = '') public function getSelfServiceTasks($userUid = '')
{ {
@@ -465,62 +411,78 @@ class ListUnassigned extends BaseListUnassigned
/** /**
* Returns the number of cases of a user * Returns the number of cases of a user
* @param $userUid * @param string $userUid
* @param array $filters * @param array $filters
* @return int * @return int $total
*/ */
public function getCountList($userUid, $filters = array()) public function getCountList($userUid, $filters = array())
{ {
$criteria = new Criteria('workflow'); $criteria = new Criteria('workflow');
$tasks = $this->getSelfServiceTasks($userUid); $this->getCriteriaWhereSelfService($criteria, $userUid);
$arrayAppAssignSelfServiceValueData = $this->getSelfServiceCasesByEvaluate($userUid); $total = ListUnassignedPeer::doCount($criteria);
return (int)$total;
}
if (!empty($arrayAppAssignSelfServiceValueData)) { /**
* This function get the where criteria for the SelfService and SelfService value based
*
* @param criteria $criteria
* @param string $userUid
* @return criteria $criteria
*/
public function getCriteriaWhereSelfService($criteria, $userUid)
{
$tasks = $this->getSelfServiceTasks($userUid);
$aSelfServiceValueBased = $this->getSelfServiceCasesByEvaluate($userUid);
if (!empty($aSelfServiceValueBased)) {
//Self Service Value Based Assignment //Self Service Value Based Assignment
$criterionAux = null; $criterionAux = null;
foreach ($arrayAppAssignSelfServiceValueData as $value) { //Load Self Service Value Based Assignment
if (is_null($criterionAux)) { $firstRow = current($aSelfServiceValueBased);
$criterionAux = $criteria->getNewCriterion( $criterionAux = sprintf(
ListUnassignedPeer::APP_UID, "((
$value["APP_UID"], LIST_UNASSIGNED.APP_UID='%s' AND
Criteria::EQUAL LIST_UNASSIGNED.DEL_INDEX=%d AND
)->addAnd( LIST_UNASSIGNED.TAS_UID='%s'
$criteria->getNewCriterion(ListUnassignedPeer::DEL_INDEX, $value["DEL_INDEX"], Criteria::EQUAL) ) ",
)->addAnd( $firstRow["APP_UID"],
$criteria->getNewCriterion(ListUnassignedPeer::TAS_UID, $value["TAS_UID"], Criteria::EQUAL) $firstRow["DEL_INDEX"],
$firstRow["TAS_UID"]
); );
} else { foreach (array_slice($aSelfServiceValueBased, 1) as $value) {
$criterionAux = $criteria->getNewCriterion( $criterionAux .= sprintf(
ListUnassignedPeer::APP_UID, " OR (
LIST_UNASSIGNED.APP_UID='%s' AND
LIST_UNASSIGNED.DEL_INDEX=%d AND
LIST_UNASSIGNED.TAS_UID='%s'
) ",
$value["APP_UID"], $value["APP_UID"],
Criteria::EQUAL
)->addAnd(
$criteria->getNewCriterion(
ListUnassignedPeer::DEL_INDEX,
$value["DEL_INDEX"], $value["DEL_INDEX"],
Criteria::EQUAL $value["TAS_UID"]
) );
)->addAnd( }
$criterionAux .= ")";
//And Load SelfService
$criteria->add(
$criteria->getNewCriterion( $criteria->getNewCriterion(
ListUnassignedPeer::TAS_UID, ListUnassignedPeer::TAS_UID,
$value["TAS_UID"], $tasks,
Criteria::EQUAL Criteria::IN
)
)->addOr( )->addOr(
$criterionAux $criteria->getNewCriterion(
); ListUnassignedPeer::TAS_UID,
} $criterionAux,
} Criteria::CUSTOM
)
$criteria->add( )
$criterionAux->addOr($criteria->getNewCriterion(ListUnassignedPeer::TAS_UID, $tasks, Criteria::IN))
); );
} else { } else {
//Self Service //Self Service
$criteria->add(ListUnassignedPeer::TAS_UID, $tasks, Criteria::IN); $criteria->add(ListUnassignedPeer::TAS_UID, $tasks, Criteria::IN);
} }
$total = ListUnassignedPeer::doCount($criteria);
return (int)$total; return $criteria;
} }
} }

View File

@@ -132,6 +132,7 @@ class Users extends BaseUsers
$c->addSelectColumn( UsersPeer::USR_LASTNAME ); $c->addSelectColumn( UsersPeer::USR_LASTNAME );
$c->add( UsersPeer::USR_EMAIL, $sUsrEmail ); $c->add( UsersPeer::USR_EMAIL, $sUsrEmail );
$c->add( UsersPeer::USR_STATUS, array('INACTIVE', 'CLOSED'), Criteria::NOT_IN );
return $c; return $c;
} }

View File

@@ -297,6 +297,9 @@
<parameter name="Comment" value=""/> <parameter name="Comment" value=""/>
</vendor> </vendor>
</index> </index>
<index name="indexAppUid">
<index-column name="APP_UID"/>
</index>
</table> </table>
<table name="APP_MESSAGE" idMethod="native"> <table name="APP_MESSAGE" idMethod="native">
<vendor type="mysql"> <vendor type="mysql">

View File

@@ -132,7 +132,8 @@ CREATE TABLE `APP_DOCUMENT`
`SYNC_WITH_DRIVE` VARCHAR(32) default 'UNSYNCHRONIZED' NOT NULL, `SYNC_WITH_DRIVE` VARCHAR(32) default 'UNSYNCHRONIZED' NOT NULL,
`SYNC_PERMISSIONS` MEDIUMTEXT, `SYNC_PERMISSIONS` MEDIUMTEXT,
PRIMARY KEY (`APP_DOC_UID`,`DOC_VERSION`), PRIMARY KEY (`APP_DOC_UID`,`DOC_VERSION`),
KEY `indexAppDocument`(`FOLDER_UID`, `APP_DOC_UID`) KEY `indexAppDocument`(`FOLDER_UID`, `APP_DOC_UID`),
KEY `indexAppUid`(`APP_UID`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Documents in an Application'; )ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Documents in an Application';
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
#-- APP_MESSAGE #-- APP_MESSAGE

View File

@@ -1005,6 +1005,8 @@ class Light extends Api
$fields = $case->loadCase($app_uid, $del_index); $fields = $case->loadCase($app_uid, $del_index);
$caseVariables = array_merge($fields['APP_DATA'], $caseVariables = array_merge($fields['APP_DATA'],
\ProcessMaker\BusinessModel\Cases::getGlobalVariables($fields['APP_DATA'])); \ProcessMaker\BusinessModel\Cases::getGlobalVariables($fields['APP_DATA']));
$caseVariables = DateTime::convertUtcToTimeZone($caseVariables);
} }
\G::LoadClass("pmDynaform"); \G::LoadClass("pmDynaform");