PMCORE-3383
This commit is contained in:
@@ -4200,6 +4200,20 @@ class WorkspaceTools
|
|||||||
APP_STATUS_ID = 0");
|
APP_STATUS_ID = 0");
|
||||||
$con->commit();
|
$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
|
// Populating APPLICATION.APP_FINISH_DATE
|
||||||
CLI::logging("-> Populating APPLICATION.APP_FINISH_DATE \n");
|
CLI::logging("-> Populating APPLICATION.APP_FINISH_DATE \n");
|
||||||
$con->begin();
|
$con->begin();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use ProcessMaker\ChangeLog\ChangeLog;
|
|||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
use ProcessMaker\Core\JobsManager;
|
use ProcessMaker\Core\JobsManager;
|
||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
|
use ProcessMaker\Model\Application;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
|
|
||||||
class WsBase
|
class WsBase
|
||||||
@@ -3284,24 +3285,31 @@ class WsBase
|
|||||||
$_SESSION["INDEX"] = $delIndex;
|
$_SESSION["INDEX"] = $delIndex;
|
||||||
$_SESSION["USER_LOGGED"] = $userUid;
|
$_SESSION["USER_LOGGED"] = $userUid;
|
||||||
|
|
||||||
|
// Validate the appUid
|
||||||
if (empty($caseUid)) {
|
if (empty($caseUid)) {
|
||||||
$result = new WsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " caseUid");
|
$result = new WsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " caseUid");
|
||||||
|
|
||||||
$g->sessionVarRestore();
|
$g->sessionVarRestore();
|
||||||
|
|
||||||
return $result;
|
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)) {
|
if (empty($delIndex)) {
|
||||||
$result = new WsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " delIndex");
|
$result = new WsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " delIndex");
|
||||||
|
|
||||||
$g->sessionVarRestore();
|
$g->sessionVarRestore();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
// Validate the user
|
||||||
if (empty($userUid)) {
|
if (empty($userUid)) {
|
||||||
$result = new WsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " userUid");
|
$result = new WsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " userUid");
|
||||||
|
|
||||||
$g->sessionVarRestore();
|
$g->sessionVarRestore();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -3322,6 +3330,7 @@ class WsBase
|
|||||||
$g->sessionVarRestore();
|
$g->sessionVarRestore();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
// Review the unpaused date
|
||||||
if (strlen($unpauseDate) >= 10) {
|
if (strlen($unpauseDate) >= 10) {
|
||||||
if (!preg_match("/^\d{4}-\d{2}-\d{2}| \d{2}:\d{2}:\d{2}$/", $unpauseDate)) {
|
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");
|
$result = new WsResponse(100, G::LoadTranslation("ID_INVALID_DATA") . " $unpauseDate");
|
||||||
|
|||||||
@@ -7049,6 +7049,12 @@ msgstr "Down Trigger"
|
|||||||
msgid "Draft"
|
msgid "Draft"
|
||||||
msgstr "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
|
# TRANSLATION
|
||||||
# LABEL/ID_DRIVE_HELP_ENABLE
|
# LABEL/ID_DRIVE_HELP_ENABLE
|
||||||
#: LABEL/ID_DRIVE_HELP_ENABLE
|
#: LABEL/ID_DRIVE_HELP_ENABLE
|
||||||
|
|||||||
@@ -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_DOWNLOAD_SETTINGS','en','Download Settings','2020-12-10') ,
|
||||||
( 'LABEL','ID_DOWN_TRIGGER','en','Down Trigger','2015-02-20') ,
|
( 'LABEL','ID_DOWN_TRIGGER','en','Down Trigger','2015-02-20') ,
|
||||||
( 'LABEL','ID_DRAFT','en','Draft','2014-01-15') ,
|
( '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_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_DOWN_NAVIGATOR','en','Drill Down Navigator','2020-08-26') ,
|
||||||
( 'LABEL','ID_DRILL','en','Drill','2021-08-26') ,
|
( 'LABEL','ID_DRILL','en','Drill','2021-08-26') ,
|
||||||
|
|||||||
@@ -732,8 +732,12 @@ class Ajax
|
|||||||
}
|
}
|
||||||
// End save
|
// End save
|
||||||
|
|
||||||
$case = new Cases();
|
$case = new WsBase();
|
||||||
$case->pauseCase($appUid, $delIndex, $_SESSION['USER_LOGGED'], $unpauseDate);
|
$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();
|
$app = new Application();
|
||||||
$caseData = $app->load($appUid);
|
$caseData = $app->load($appUid);
|
||||||
$data['APP_NUMBER'] = $caseData['APP_NUMBER'];
|
$data['APP_NUMBER'] = $caseData['APP_NUMBER'];
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ class Draft extends AbstractCases
|
|||||||
{
|
{
|
||||||
$query = Application::query()->select(['APPLICATION.APP_NUMBER']);
|
$query = Application::query()->select(['APPLICATION.APP_NUMBER']);
|
||||||
// Add the initial scope for draft cases for specific user
|
// Add the initial scope for draft cases for specific user
|
||||||
$query->draft($this->getUserUid());
|
$query->draft($this->getUserId());
|
||||||
// Get only one case
|
// Get only one case
|
||||||
$query->limit(1);
|
$query->limit(1);
|
||||||
// Get result
|
// Get result
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class Application extends Model
|
|||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
// Status id
|
// Status id
|
||||||
const STATUS_DRAFT = 1;
|
const STATUS_DRAFT = 1;
|
||||||
|
const STATUS_DRAFT_NAME = 'DRAFT';
|
||||||
const STATUS_TODO = 2;
|
const STATUS_TODO = 2;
|
||||||
const STATUS_COMPLETED = 3;
|
const STATUS_COMPLETED = 3;
|
||||||
const STATUS_CANCELED = 4;
|
const STATUS_CANCELED = 4;
|
||||||
@@ -52,13 +53,13 @@ class Application extends Model
|
|||||||
* Scope for query to get the creator
|
* Scope for query to get the creator
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @param string $usrUid
|
* @param int $usrId
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @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
|
* Scope the Draft cases
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
* @param string $user
|
* @param int $user
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user