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
);
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::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) {
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$opts = $filter->xssFilterHard($opts);
$args = $filter->xssFilterHard($args);
$workspaces = get_workspaces_from_args($args);
$first = true;
foreach ($workspaces as $workspace) {
try {
G::outRes( "Upgrading translation for " . pakeColor::colorize($workspace->name, "INFO") . "\n" );
$workspace->upgradeTranslation($first, $first);
$first = false;
} catch (Exception $e) {
G::outRes( "Errors upgrading translation of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n" );
$noXml = array_key_exists('noxml', $opts) ? '--no-xml' : '';
$noMafe = array_key_exists('nomafe', $opts) ? '--no-mafe' : '';
if (!empty($noXml)) {
$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);
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) {
try {
G::outRes("Upgrading translation for " . pakeColor::colorize($workspace->name, "INFO") . "\n");
$workspace->upgradeTranslation($flagUpdateXml, $flagUpdateMafe);
} catch (Exception $e) {
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) {

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

View File

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

View File

@@ -132,7 +132,8 @@ CREATE TABLE `APP_DOCUMENT`
`SYNC_WITH_DRIVE` VARCHAR(32) default 'UNSYNCHRONIZED' NOT NULL,
`SYNC_PERMISSIONS` MEDIUMTEXT,
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';
#-----------------------------------------------------------------------------
#-- APP_MESSAGE

View File

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