Merged in bugfix/PMC-522 (pull request #6798)
PMC-522 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -633,87 +633,32 @@ class Cases
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function loads the title and description label in a case
|
* Optimized for speed. This function loads the title and description label in a case
|
||||||
* PROCESO:
|
|
||||||
* If there is a label then it is loaded
|
|
||||||
* To get APP_DELEGATIONS that they are opened in the case
|
|
||||||
* To look for APP_DELEGATIONS wich TASK in it, It has a label defined(CASE_TITLE)
|
|
||||||
* We need to read the last APP_DELEGATION->TASK
|
|
||||||
* @param string $sAppUid
|
|
||||||
* @param array $aAppData
|
|
||||||
* @return $res
|
|
||||||
*/
|
|
||||||
public function refreshCaseTitleAndDescription($sAppUid, $aAppData)
|
|
||||||
{
|
|
||||||
$res['APP_TITLE'] = null;
|
|
||||||
$res['APP_DESCRIPTION'] = null;
|
|
||||||
//$res['APP_PROC_CODE'] = null;
|
|
||||||
|
|
||||||
$oApplication = new Application;
|
|
||||||
try {
|
|
||||||
$fields = $oApplication->load($sAppUid);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
$res['APP_TITLE'] = $fields['APP_TITLE']; // $oApplication->$getAppLabel();
|
|
||||||
$res['APP_DESCRIPTION'] = $fields['APP_DESCRIPTION'];
|
|
||||||
|
|
||||||
$lang = defined('SYS_LANG') ? SYS_LANG : 'en';
|
|
||||||
$bUpdatedDefTitle = false;
|
|
||||||
$bUpdatedDefDescription = false;
|
|
||||||
$cri = new Criteria;
|
|
||||||
$cri->add(AppDelegationPeer::APP_UID, $sAppUid);
|
|
||||||
$cri->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN");
|
|
||||||
$currentDelegations = AppDelegationPeer::doSelect($cri);
|
|
||||||
//load only the tas_def fields, because these three or two values are needed
|
|
||||||
for ($r = count($currentDelegations) - 1; $r >= 0; $r--) {
|
|
||||||
$c = new Criteria();
|
|
||||||
$c->clearSelectColumns();
|
|
||||||
$c->addSelectColumn(TaskPeer::TAS_DEF_TITLE);
|
|
||||||
$c->addSelectColumn(TaskPeer::TAS_DEF_DESCRIPTION);
|
|
||||||
$c->add(TaskPeer::TAS_UID, $currentDelegations[$r]->getTasUid());
|
|
||||||
$rs = TaskPeer::doSelectRS($c);
|
|
||||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
while ($rs->next()) {
|
|
||||||
$row = $rs->getRow();
|
|
||||||
$tasDefTitle = $row['TAS_DEF_TITLE'];
|
|
||||||
if ($tasDefTitle != '' && !$bUpdatedDefTitle) {
|
|
||||||
$res['APP_TITLE'] = G::replaceDataField($tasDefTitle, $aAppData);
|
|
||||||
$bUpdatedDefTitle = true;
|
|
||||||
}
|
|
||||||
$tasDefDescription = $row['TAS_DEF_DESCRIPTION'];
|
|
||||||
if ($tasDefDescription != '' && !$bUpdatedDefDescription) {
|
|
||||||
$res['APP_DESCRIPTION'] = G::replaceDataField($tasDefDescription, $aAppData);
|
|
||||||
$bUpdatedDefDescription = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* optimized for speed. This function loads the title and description label in a case
|
|
||||||
* If there is a label then it is loaded
|
* If there is a label then it is loaded
|
||||||
* Get Open APP_DELEGATIONS in the case
|
* Get Open APP_DELEGATIONS in the case
|
||||||
* To look for APP_DELEGATIONS wich TASK in it, It has a label defined(CASE_TITLE)
|
* To look for APP_DELEGATIONS which TASK in it, It has a label defined(CASE_TITLE)
|
||||||
* We need to read the last APP_DELEGATION->TASK
|
* We need to read the last APP_DELEGATION->TASK
|
||||||
* @param string $sAppUid
|
*
|
||||||
* @param array $aAppData
|
* @param string $appUid
|
||||||
* @return $res
|
* @param array $fields
|
||||||
|
* @param array $lastFieldsCase
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @see classes/Cases->startCase()
|
||||||
|
* @see classes/Cases->updateCase()
|
||||||
*/
|
*/
|
||||||
public function newRefreshCaseTitleAndDescription($sAppUid, $fields, $aAppData)
|
public function newRefreshCaseTitleAndDescription($appUid, $fields, $lastFieldsCase = [])
|
||||||
{
|
{
|
||||||
$res = array();
|
$res = [];
|
||||||
|
|
||||||
$lang = defined('SYS_LANG') ? SYS_LANG : 'en';
|
$flagTitle = false;
|
||||||
$bUpdatedDefTitle = false;
|
$flagDescription = false;
|
||||||
$bUpdatedDefDescription = false;
|
|
||||||
|
|
||||||
$cri = new Criteria;
|
$cri = new Criteria;
|
||||||
$cri->clearSelectColumns();
|
$cri->clearSelectColumns();
|
||||||
$cri->addSelectColumn(AppDelegationPeer::TAS_UID);
|
$cri->addSelectColumn(AppDelegationPeer::TAS_UID);
|
||||||
$cri->add(AppDelegationPeer::APP_UID, $sAppUid);
|
$cri->add(AppDelegationPeer::APP_UID, $appUid);
|
||||||
$cri->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN");
|
$cri->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN");
|
||||||
if (isset($fields['DEL_INDEX'])) {
|
if (isset($fields['DEL_INDEX'])) {
|
||||||
$cri->add(AppDelegationPeer::DEL_INDEX, $fields['DEL_INDEX']);
|
$cri->add(AppDelegationPeer::DEL_INDEX, $fields['DEL_INDEX']);
|
||||||
@@ -734,36 +679,38 @@ class Cases
|
|||||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
while ($rs->next()) {
|
while ($rs->next()) {
|
||||||
$row = $rs->getRow();
|
$row = $rs->getRow();
|
||||||
|
$newValues = [];
|
||||||
|
//Get the case title
|
||||||
$tasDefTitle = trim($row['TAS_DEF_TITLE']);
|
$tasDefTitle = trim($row['TAS_DEF_TITLE']);
|
||||||
if ($tasDefTitle != '' && !$bUpdatedDefTitle) {
|
if (!empty($tasDefTitle) && !$flagTitle) {
|
||||||
$newAppTitle = G::replaceDataField($tasDefTitle, $aAppData);
|
$newAppProperty = G::replaceDataField($tasDefTitle, $lastFieldsCase);
|
||||||
$res['APP_TITLE'] = $newAppTitle;
|
$res['APP_TITLE'] = $newAppProperty;
|
||||||
if (!(isset($fields['APP_TITLE']) && $fields['APP_TITLE'] == $newAppTitle)) {
|
if (!(isset($currentValue) && ($currentValue == $tasDefTitle))) {
|
||||||
$bUpdatedDefTitle = true;
|
$newValues['APP_TITLE'] = $newAppProperty;
|
||||||
$appData = array();
|
$flagTitle = true;
|
||||||
$appData['APP_UID'] = $sAppUid;
|
|
||||||
$appData['APP_TITLE'] = $newAppTitle;
|
|
||||||
$oApplication = new Application();
|
|
||||||
$oApplication->update($appData);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Get the case description
|
||||||
$tasDefDescription = trim($row['TAS_DEF_DESCRIPTION']);
|
$tasDefDescription = trim($row['TAS_DEF_DESCRIPTION']);
|
||||||
if ($tasDefDescription != '' && !$bUpdatedDefDescription) {
|
if (!empty($tasDefDescription) && !$flagDescription) {
|
||||||
$newAppDescription = G::replaceDataField($tasDefDescription, $aAppData);
|
$newAppProperty = G::replaceDataField($tasDefDescription, $lastFieldsCase);
|
||||||
$res['APP_DESCRIPTION'] = $newAppDescription;
|
$res['APP_DESCRIPTION'] = $newAppProperty;
|
||||||
if (!(isset($fields['APP_DESCRIPTION']) && $fields['APP_DESCRIPTION'] == $newAppDescription)) {
|
if (!(isset($currentValue) && ($currentValue == $tasDefDescription))) {
|
||||||
$bUpdatedDefDescription = true;
|
$newValues['APP_DESCRIPTION'] = $newAppProperty;
|
||||||
$appData = array();
|
$flagDescription = true;
|
||||||
$appData['APP_UID'] = $sAppUid;
|
|
||||||
$appData['APP_DESCRIPTION'] = $newAppDescription;
|
|
||||||
$oApplication = new Application();
|
|
||||||
$oApplication->update($appData);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($newValues)) {
|
||||||
|
$application = new Application();
|
||||||
|
$newValues['APP_UID'] = $appUid;
|
||||||
|
$application->update($newValues);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$rsCri->next();
|
$rsCri->next();
|
||||||
$rowCri = $rsCri->getRow();
|
$rowCri = $rsCri->getRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -867,27 +814,75 @@ class Cases
|
|||||||
* Update an existing case, this info is used in CaseResume
|
* Update an existing case, this info is used in CaseResume
|
||||||
*
|
*
|
||||||
* @name updateCase
|
* @name updateCase
|
||||||
* @param string $sAppUid
|
*
|
||||||
* @param integer $iDelIndex > 0 //get the Delegation fields
|
* @param string $appUid
|
||||||
|
* @param array $Fields
|
||||||
|
* @param bool $forceLoadData
|
||||||
|
*
|
||||||
* @return Fields
|
* @return Fields
|
||||||
|
* @throws Exception
|
||||||
|
*
|
||||||
|
* @see Cases->cancelCase()
|
||||||
|
* @see Cases->executeTriggerFromList()
|
||||||
|
* @see Cases->executeTriggersAfterExternal()
|
||||||
|
* @see Cases->getExecuteTriggerProcess()
|
||||||
|
* @see Cases->unCancelCase()
|
||||||
|
* @see Cases->cancelCase()
|
||||||
|
* @see executeCaseSelfService()/cron_single.php
|
||||||
|
* @see handleErrors()/class.pmFunctions.php
|
||||||
|
* @see handleFatalErrors()/class.pmFunctions.php
|
||||||
|
* @see PMFRedirectToStep()/class.pmFunctions.php
|
||||||
|
* @see setCaseTrackerCode()/class.pmFunctions.php
|
||||||
|
* @see Derivation::derivate()
|
||||||
|
* @see Derivation::verifyIsCaseChild()
|
||||||
|
* @see WsBase::executeTrigger()
|
||||||
|
* @see WsBase::executeTriggerFromDerivate()
|
||||||
|
* @see WsBase::newCase()
|
||||||
|
* @see WsBase::newCaseImpersonate()
|
||||||
|
* @see WsBase::sendVariables()
|
||||||
|
* @see AdditionalTables->saveDataInTable()
|
||||||
|
* @see AppEvent->executeEvents()
|
||||||
|
* @see cases_Derivate.php
|
||||||
|
* @see cases_SaveData.php
|
||||||
|
* @see cases_SaveDataSupervisor.php
|
||||||
|
* @see cases_SaveDocument.php
|
||||||
|
* @see cases_Step.php
|
||||||
|
* @see cases_SupervisorSaveDocument.php
|
||||||
|
* @see saveForm.php
|
||||||
|
* @see ActionByEmail.php
|
||||||
|
* @see ActionByEmailDataFormPost.php
|
||||||
|
* @see cases_StartExternal.php
|
||||||
|
* @see upload.php
|
||||||
|
* @see \ProcessMaker\BusinessModel\Cases::deleteMultipleFile()
|
||||||
|
* @see \ProcessMaker\BusinessModel\Cases::putExecuteTriggers()
|
||||||
|
* @see \ProcessMaker\BusinessModel\Cases::setCaseVariables()
|
||||||
|
* @see \ProcessMaker\BusinessModel\Consolidated::consolidatedUpdate()
|
||||||
|
* @see \ProcessMaker\BusinessModel\Consolidated::postDerivate()
|
||||||
|
* @see \ProcessMaker\BusinessModel\Light::doExecuteTriggerCase()
|
||||||
|
* @see \ProcessMaker\BusinessModel\Light::getPrepareInformation()
|
||||||
|
* @see \ProcessMaker\BusinessModel\Light::startCase()
|
||||||
|
* @see \ProcessMaker\BusinessModel\MessageApplication::catchMessageEvent()
|
||||||
|
* @see \ProcessMaker\BusinessModel\ScriptTask::execScriptByActivityUid()
|
||||||
|
* @see \ProcessMaker\BusinessModel\Cases\InputDocument::addCasesInputDocument()
|
||||||
|
* @see \ProcessMaker\BusinessModel\Cases\InputDocument::uploadFileCase()
|
||||||
|
* @see \ProcessMaker\BusinessModel\Cases\Variable::create()
|
||||||
|
* @see \ProcessMaker\BusinessModel\Cases\Variable::delete()
|
||||||
|
* @see \ProcessMaker\BusinessModel\Cases\Variable::update()
|
||||||
*/
|
*/
|
||||||
public function updateCase($sAppUid, $Fields = array())
|
public function updateCase($appUid, $Fields = [], $forceLoadData = false)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oApplication = new Application;
|
$application = new Application;
|
||||||
if (!$oApplication->exists($sAppUid)) {
|
if (!$application->exists($appUid)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$aApplicationFields = $Fields['APP_DATA'];
|
$appData = $Fields['APP_DATA'];
|
||||||
$Fields['APP_UID'] = $sAppUid;
|
$Fields['APP_UID'] = $appUid;
|
||||||
$Fields['APP_UPDATE_DATE'] = 'now';
|
$Fields['APP_UPDATE_DATE'] = 'now';
|
||||||
$Fields['APP_DATA'] = serialize($Fields['APP_DATA']);
|
$Fields['APP_DATA'] = serialize($Fields['APP_DATA']);
|
||||||
/*
|
|
||||||
$oApp = new Application;
|
$app = ApplicationPeer::retrieveByPk($appUid);
|
||||||
$appFields = $oApp->load($sAppUid);
|
$appFields = $app->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
*/
|
|
||||||
$oApp = ApplicationPeer::retrieveByPk($sAppUid);
|
|
||||||
$appFields = $oApp->toArray(BasePeer::TYPE_FIELDNAME);
|
|
||||||
if (isset($Fields['APP_TITLE'])) {
|
if (isset($Fields['APP_TITLE'])) {
|
||||||
$appFields['APP_TITLE'] = $Fields['APP_TITLE'];
|
$appFields['APP_TITLE'] = $Fields['APP_TITLE'];
|
||||||
}
|
}
|
||||||
@@ -898,16 +893,26 @@ class Cases
|
|||||||
$appFields['DEL_INDEX'] = $Fields['DEL_INDEX'];
|
$appFields['DEL_INDEX'] = $Fields['DEL_INDEX'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$arrayNewCaseTitleAndDescription = $this->newRefreshCaseTitleAndDescription($sAppUid, $appFields, $aApplicationFields);
|
//Get the appTitle and appDescription
|
||||||
|
$fieldsCase = [];
|
||||||
|
if ($forceLoadData) {
|
||||||
|
$lastFieldsCase = $this->loadCase($appUid)['APP_DATA'];
|
||||||
|
$fieldsCase = array_merge($appData, $lastFieldsCase);
|
||||||
|
}
|
||||||
|
$newTitleOrDescription = $this->newRefreshCaseTitleAndDescription(
|
||||||
|
$appUid,
|
||||||
|
$appFields,
|
||||||
|
empty($fieldsCase) ? $appData : $fieldsCase
|
||||||
|
);
|
||||||
|
|
||||||
//Start: Save History --By JHL
|
//Start: Save History --By JHL
|
||||||
if (isset($Fields['CURRENT_DYNAFORM'])) {
|
if (isset($Fields['CURRENT_DYNAFORM'])) {
|
||||||
//only when that variable is set.. from Save
|
//only when that variable is set.. from Save
|
||||||
$FieldsBefore = $this->loadCase($sAppUid);
|
$FieldsBefore = $this->loadCase($appUid);
|
||||||
$FieldsDifference = $this->arrayRecursiveDiff($FieldsBefore['APP_DATA'], $aApplicationFields);
|
$FieldsDifference = $this->arrayRecursiveDiff($FieldsBefore['APP_DATA'], $appData);
|
||||||
$fieldsOnBoth = $this->array_key_intersect($FieldsBefore['APP_DATA'], $aApplicationFields);
|
$fieldsOnBoth = $this->array_key_intersect($FieldsBefore['APP_DATA'], $appData);
|
||||||
//Add fields that weren't in previous version
|
//Add fields that weren't in previous version
|
||||||
foreach ($aApplicationFields as $key => $value) {
|
foreach ($appData as $key => $value) {
|
||||||
if (is_array($value) && isset($fieldsOnBoth[$key]) && is_array($fieldsOnBoth[$key])) {
|
if (is_array($value) && isset($fieldsOnBoth[$key]) && is_array($fieldsOnBoth[$key])) {
|
||||||
$afieldDifference = $this->arrayRecursiveDiff($value, $fieldsOnBoth[$key]);
|
$afieldDifference = $this->arrayRecursiveDiff($value, $fieldsOnBoth[$key]);
|
||||||
$dfieldDifference = $this->arrayRecursiveDiff($fieldsOnBoth[$key], $value);
|
$dfieldDifference = $this->arrayRecursiveDiff($fieldsOnBoth[$key], $value);
|
||||||
@@ -921,9 +926,9 @@ class Cases
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((is_array($FieldsDifference)) && (count($FieldsDifference) > 0)) {
|
if ((is_array($FieldsDifference)) && (count($FieldsDifference) > 0)) {
|
||||||
$oCurrentDynaform = new Dynaform();
|
$dynaformInstance = new Dynaform();
|
||||||
try {
|
try {
|
||||||
$currentDynaform = $oCurrentDynaform->Load($Fields['CURRENT_DYNAFORM']);
|
$currentDynaform = $dynaformInstance->Load($Fields['CURRENT_DYNAFORM']);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$currentDynaform["DYN_CONTENT"] = "";
|
$currentDynaform["DYN_CONTENT"] = "";
|
||||||
}
|
}
|
||||||
@@ -951,8 +956,8 @@ class Cases
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//End Save History
|
//End Save History
|
||||||
//we are removing the app_title and app_description from this array,
|
|
||||||
//because they already be updated in newRefreshCaseTitleAndDescription function
|
//We are removing the app_title and app_description because they already be updated in newRefreshCaseTitleAndDescription function
|
||||||
if (isset($Fields['APP_TITLE'])) {
|
if (isset($Fields['APP_TITLE'])) {
|
||||||
unset($Fields['APP_TITLE']);
|
unset($Fields['APP_TITLE']);
|
||||||
}
|
}
|
||||||
@@ -965,17 +970,17 @@ class Cases
|
|||||||
}
|
}
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
$completed = new ListCompleted();
|
$completed = new ListCompleted();
|
||||||
$completed->create(array_merge($Fields, $arrayNewCaseTitleAndDescription));
|
$completed->create(array_merge($Fields, $newTitleOrDescription));
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
}
|
}
|
||||||
$oApp->update($Fields);
|
|
||||||
|
|
||||||
$DEL_INDEX = isset($Fields['DEL_INDEX']) ? $Fields['DEL_INDEX'] : '';
|
/** Update case*/
|
||||||
$TAS_UID = isset($Fields['TAS_UID']) ? $Fields['TAS_UID'] : '';
|
$app->update($Fields);
|
||||||
|
|
||||||
|
//Update the reportTables and tables related to the case
|
||||||
require_once 'classes/model/AdditionalTables.php';
|
require_once 'classes/model/AdditionalTables.php';
|
||||||
$oReportTables = new ReportTables();
|
$reportTables = new ReportTables();
|
||||||
$addtionalTables = new additionalTables();
|
$additionalTables = new additionalTables();
|
||||||
|
|
||||||
if (!isset($Fields['APP_NUMBER'])) {
|
if (!isset($Fields['APP_NUMBER'])) {
|
||||||
$Fields['APP_NUMBER'] = $appFields['APP_NUMBER'];
|
$Fields['APP_NUMBER'] = $appFields['APP_NUMBER'];
|
||||||
@@ -984,49 +989,26 @@ class Cases
|
|||||||
$Fields['APP_STATUS'] = $appFields['APP_STATUS'];
|
$Fields['APP_STATUS'] = $appFields['APP_STATUS'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$oReportTables->updateTables($appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields);
|
$reportTables->updateTables($appFields['PRO_UID'], $appUid, $Fields['APP_NUMBER'], $appData);
|
||||||
$addtionalTables->updateReportTables(
|
$additionalTables->updateReportTables(
|
||||||
$appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields, $Fields['APP_STATUS']
|
$appFields['PRO_UID'], $appUid, $Fields['APP_NUMBER'], $appData, $Fields['APP_STATUS']
|
||||||
);
|
);
|
||||||
|
|
||||||
//now update the priority in appdelegation table, using the defined variable in task
|
//Update the priority related to the task
|
||||||
if (trim($DEL_INDEX) != '' && trim($TAS_UID) != '') {
|
$delIndex = isset($Fields['DEL_INDEX']) ? trim($Fields['DEL_INDEX']) : '';
|
||||||
//optimized code to avoid load task content row.
|
$tasUid = isset($Fields['TAS_UID']) ? trim($Fields['TAS_UID']) : '';
|
||||||
$c = new Criteria();
|
$appDel = new AppDelegation;
|
||||||
$c->clearSelectColumns();
|
$appDel->updatePriority($delIndex, $tasUid, $appUid, $appData);
|
||||||
$c->addSelectColumn(TaskPeer::TAS_PRIORITY_VARIABLE);
|
|
||||||
$c->add(TaskPeer::TAS_UID, $TAS_UID);
|
|
||||||
$rs = TaskPeer::doSelectRS($c);
|
|
||||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$rs->next();
|
|
||||||
$row = $rs->getRow();
|
|
||||||
$VAR_PRI = substr($row['TAS_PRIORITY_VARIABLE'], 2);
|
|
||||||
//end optimized code.
|
|
||||||
|
|
||||||
$x = unserialize($Fields['APP_DATA']);
|
|
||||||
if (isset($x[$VAR_PRI])) {
|
|
||||||
if (trim($x[$VAR_PRI]) != '') {
|
|
||||||
$oDel = new AppDelegation;
|
|
||||||
$array = array();
|
|
||||||
$array['APP_UID'] = $sAppUid;
|
|
||||||
$array['DEL_INDEX'] = $DEL_INDEX;
|
|
||||||
$array['TAS_UID'] = $TAS_UID;
|
|
||||||
$array['DEL_PRIORITY'] = (isset($x[$VAR_PRI]) ?
|
|
||||||
($x[$VAR_PRI] >= 1 && $x[$VAR_PRI] <= 5 ? $x[$VAR_PRI] : '3') : '3');
|
|
||||||
$oDel->update($array);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Update Solr Index
|
//Update Solr Index
|
||||||
if ($this->appSolr != null) {
|
if ($this->appSolr != null) {
|
||||||
$this->appSolr->updateApplicationSearchIndex($sAppUid);
|
$this->appSolr->updateApplicationSearchIndex($appUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Fields["APP_STATUS"] == "COMPLETED") {
|
if ($Fields["APP_STATUS"] == "COMPLETED") {
|
||||||
//Delete records of the table APP_ASSIGN_SELF_SERVICE_VALUE
|
//Delete records of the table APP_ASSIGN_SELF_SERVICE_VALUE
|
||||||
$appAssignSelfServiceValue = new AppAssignSelfServiceValue();
|
$appAssignSelfServiceValue = new AppAssignSelfServiceValue();
|
||||||
|
$appAssignSelfServiceValue->remove($appUid);
|
||||||
$appAssignSelfServiceValue->remove($sAppUid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
@@ -1036,12 +1018,12 @@ class Cases
|
|||||||
$inbox = new ListInbox();
|
$inbox = new ListInbox();
|
||||||
unset($Fields['DEL_INIT_DATE']);
|
unset($Fields['DEL_INIT_DATE']);
|
||||||
unset($Fields['DEL_DELEGATE_DATE']);
|
unset($Fields['DEL_DELEGATE_DATE']);
|
||||||
$inbox->update(array_merge($Fields, $arrayNewCaseTitleAndDescription));
|
$inbox->update(array_merge($Fields, $newTitleOrDescription));
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
return $Fields;
|
return $Fields;
|
||||||
} catch (exception $e) {
|
} catch (Exception $e) {
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3578,7 +3560,7 @@ class Cases
|
|||||||
$appFieldsTrigger = [];
|
$appFieldsTrigger = [];
|
||||||
$appFieldsTrigger['APP_DATA'] = $fieldsTrigger;
|
$appFieldsTrigger['APP_DATA'] = $fieldsTrigger;
|
||||||
//Update the case
|
//Update the case
|
||||||
$this->updateCase($appUid, $appFieldsTrigger);
|
$this->updateCase($appUid, $appFieldsTrigger, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Merge the appData with variables changed
|
//Merge the appData with variables changed
|
||||||
|
|||||||
@@ -1046,4 +1046,45 @@ class AppDelegation extends BaseAppDelegation
|
|||||||
|
|
||||||
return $delIndex;
|
return $delIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the priority in AppDelegation table, using the defined variable in task
|
||||||
|
*
|
||||||
|
* @param integer $delIndex
|
||||||
|
* @param string $tasUid
|
||||||
|
* @param string $appUid
|
||||||
|
* @param array $fieldAppData
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @see Cases->update()
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function updatePriority($delIndex, $tasUid, $appUid, $fieldAppData)
|
||||||
|
{
|
||||||
|
if (!empty($delIndex) && !empty($tasUid)) {
|
||||||
|
//Optimized code to avoid load task content row.
|
||||||
|
$criteria = new Criteria();
|
||||||
|
$criteria->clearSelectColumns();
|
||||||
|
$criteria->addSelectColumn(TaskPeer::TAS_PRIORITY_VARIABLE);
|
||||||
|
$criteria->add(TaskPeer::TAS_UID, $tasUid);
|
||||||
|
$rs = TaskPeer::doSelectRS($criteria);
|
||||||
|
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
$rs->next();
|
||||||
|
$row = $rs->getRow();
|
||||||
|
$tasPriority = substr($row['TAS_PRIORITY_VARIABLE'], 2);
|
||||||
|
//End optimized code.
|
||||||
|
|
||||||
|
$x = $fieldAppData;
|
||||||
|
if (!empty($x[$tasPriority])) {
|
||||||
|
$array = [];
|
||||||
|
$array['APP_UID'] = $appUid;
|
||||||
|
$array['DEL_INDEX'] = $delIndex;
|
||||||
|
$array['TAS_UID'] = $tasUid;
|
||||||
|
$array['DEL_PRIORITY'] = (isset($x[$tasPriority]) ?
|
||||||
|
($x[$tasPriority] >= 1 && $x[$tasPriority] <= 5 ? $x[$tasPriority] : '3') : '3');
|
||||||
|
$this->update($array);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user