PMCORE-3383

This commit is contained in:
Paula Quispe
2021-09-30 12:30:00 -04:00
parent 9f51a171c2
commit 851d992407
7 changed files with 48 additions and 13 deletions

View File

@@ -4200,6 +4200,20 @@ class WorkspaceTools
APP_STATUS_ID = 0");
$con->commit();
// Populating APPLICATION.APP_INIT_USER_ID
CLI::logging("-> Populating APPLICATION.APP_INIT_USER_ID \n");
$con->begin();
$stmt = $con->createStatement();
$rs = $stmt->executeQuery("UPDATE APPLICATION AS AP
INNER JOIN (
SELECT USERS.USR_UID, USERS.USR_ID
FROM USERS
) AS USR
ON (AP.APP_INIT_USER = USR.USR_UID)
SET AP.APP_INIT_USER_ID = USR.USR_ID
WHERE AP.APP_INIT_USER_ID = 0");
$con->commit();
// Populating APPLICATION.APP_FINISH_DATE
CLI::logging("-> Populating APPLICATION.APP_FINISH_DATE \n");
$con->begin();

View File

@@ -10,6 +10,7 @@ use ProcessMaker\ChangeLog\ChangeLog;
/*----------------------------------********---------------------------------*/
use ProcessMaker\Core\JobsManager;
use ProcessMaker\Core\System;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\Delegation;
class WsBase
@@ -3284,29 +3285,36 @@ class WsBase
$_SESSION["INDEX"] = $delIndex;
$_SESSION["USER_LOGGED"] = $userUid;
// Validate the appUid
if (empty($caseUid)) {
$result = new WsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " caseUid");
$g->sessionVarRestore();
return $result;
}
// Validate the status
$caseInfo = Application::getCase($caseUid);
if ($caseInfo['APP_STATUS'] === Application::STATUS_DRAFT_NAME) {
$result = new WsResponse(100, G::LoadTranslation("ID_DRAFT_CASES_CAN_NOT_PAUSED"));
$g->sessionVarRestore();
return $result;
}
// Validate the index
if (empty($delIndex)) {
$result = new WsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " delIndex");
$g->sessionVarRestore();
return $result;
}
// Validate the user
if (empty($userUid)) {
$result = new WsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " userUid");
$g->sessionVarRestore();
return $result;
}
//Validate if status is closed
// Validate if status is closed
$appDelegation = new AppDelegation();
$rows = $appDelegation->LoadParallel($caseUid, $delIndex);
if (empty($rows)) {
@@ -3314,7 +3322,7 @@ class WsBase
$g->sessionVarRestore();
return $result;
}
//Validate if the case is paused
// Validate if the case is paused
$appDelay = new AppDelay();
$sw = $appDelay->isPaused($caseUid, $delIndex);
if ($sw === true) {
@@ -3322,6 +3330,7 @@ class WsBase
$g->sessionVarRestore();
return $result;
}
// Review the unpaused date
if (strlen($unpauseDate) >= 10) {
if (!preg_match("/^\d{4}-\d{2}-\d{2}| \d{2}:\d{2}:\d{2}$/", $unpauseDate)) {
$result = new WsResponse(100, G::LoadTranslation("ID_INVALID_DATA") . " $unpauseDate");
@@ -3336,7 +3345,7 @@ class WsBase
$case = new Cases();
$case->pauseCase($caseUid, $delIndex, $userUid, $unpauseDate);
//Response
// Response
$result = self::messageExecuteSuccessfully();
$g->sessionVarRestore();

View File

@@ -7049,6 +7049,12 @@ msgstr "Down Trigger"
msgid "Draft"
msgstr "Draft"
# TRANSLATION
# LABEL/ID_DRAFT_CASES_CAN_NOT_PAUSED
#: LABEL/ID_DRAFT_CASES_CAN_NOT_PAUSED
msgid "Draft cases can not be paused"
msgstr "Draft cases can not be paused"
# TRANSLATION
# LABEL/ID_DRIVE_HELP_ENABLE
#: LABEL/ID_DRIVE_HELP_ENABLE

View File

@@ -58006,6 +58006,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_DOWNLOAD_SETTINGS','en','Download Settings','2020-12-10') ,
( 'LABEL','ID_DOWN_TRIGGER','en','Down Trigger','2015-02-20') ,
( 'LABEL','ID_DRAFT','en','Draft','2014-01-15') ,
( 'LABEL','ID_DRAFT_CASES_CAN_NOT_PAUSED','en','Draft cases can not be paused','2021-10-01') ,
( 'LABEL','ID_DRIVE_HELP_ENABLE','en','When this option is enabled, all input, output and attached documents generated in your processes can be stored in Google Drive.','2016-01-05') ,
( 'LABEL','ID_DRILL_DOWN_NAVIGATOR','en','Drill Down Navigator','2020-08-26') ,
( 'LABEL','ID_DRILL','en','Drill','2021-08-26') ,

View File

@@ -732,8 +732,12 @@ class Ajax
}
// End save
$case = new Cases();
$case->pauseCase($appUid, $delIndex, $_SESSION['USER_LOGGED'], $unpauseDate);
$case = new WsBase();
$response = $case->pauseCase($appUid, $delIndex, $_SESSION['USER_LOGGED'], $unpauseDate);
$response = (object) $response;
if ($response->status_code == 100) {
throw new Exception($response->message);
}
$app = new Application();
$caseData = $app->load($appUid);
$data['APP_NUMBER'] = $caseData['APP_NUMBER'];

View File

@@ -164,7 +164,7 @@ class Draft extends AbstractCases
{
$query = Application::query()->select(['APPLICATION.APP_NUMBER']);
// Add the initial scope for draft cases for specific user
$query->draft($this->getUserUid());
$query->draft($this->getUserId());
// Get only one case
$query->limit(1);
// Get result

View File

@@ -14,6 +14,7 @@ class Application extends Model
public $timestamps = false;
// Status id
const STATUS_DRAFT = 1;
const STATUS_DRAFT_NAME = 'DRAFT';
const STATUS_TODO = 2;
const STATUS_COMPLETED = 3;
const STATUS_CANCELED = 4;
@@ -52,13 +53,13 @@ class Application extends Model
* Scope for query to get the creator
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $usrUid
* @param int $usrId
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeCreator($query, $usrUid)
public function scopeCreator($query, $usrId)
{
return $query->where('APP_INIT_USER', '=', $usrUid);
return $query->where('APP_INIT_USER_ID', '=', $usrId);
}
/**
@@ -359,7 +360,7 @@ class Application extends Model
* Scope the Draft cases
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $user
* @param int $user
*
* @return \Illuminate\Database\Eloquent\Builder
*/