logging, new unique ID and improve start case

This commit is contained in:
Fernando Ontiveros
2025-04-24 17:55:41 +00:00
parent 85020fbdbd
commit 66d2c7a6a4
5 changed files with 69 additions and 45 deletions

View File

@@ -2163,10 +2163,11 @@ class Cases
$event = new Event();
$event->createAppEvents($proUid, $appUid, $delIndex, $tasUid);
//todo: remove Solr
// Update solr
if ($this->appSolr != null) {
$this->appSolr->updateApplicationSearchIndex($appUid);
}
//if ($this->appSolr != null) {
// $this->appSolr->updateApplicationSearchIndex($appUid);
//}
$fields['TAS_UID'] = $tasUid;
$fields['USR_UID'] = $usrUid;
@@ -2197,7 +2198,7 @@ class Cases
// Log
$message = 'Create case';
$context = $data = [
$context = [
"appUid" => $appUid,
"usrUid" => $usrUid,
"tasUid" => $tasUid,
@@ -2207,14 +2208,17 @@ class Cases
"appInitDate" => $fields['APP_INIT_DATE']
];
Log::channel(':CreateCase')->info($message, Bootstrap::context($context));
// Call plugin
if (class_exists('folderData')) {
$folderData = new folderData($proUid, $proFields['PRO_TITLE'], $appUid, '', $usrUid);
$oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers(PM_CREATE_CASE, $folderData);
}
$this->getExecuteTriggerProcess($appUid, 'CREATE', false);
//end plugin
//Exceute trigger if any configured for this create case
$this->getExecuteTriggerProcess($appUid, 'CREATE', false);
return [
'APPLICATION' => $appUid,
'INDEX' => $delIndex,

View File

@@ -181,22 +181,29 @@ class Application extends BaseApplication
}
/**
* Creates an Application
* Creates a new Application entry in the database.
*
* @param string $processUid
* @param string $userUid
* @param string $sequenceType
* @throws PropelException
* @throws Exception
* @return string
*/
* This method initializes a new application with default values and saves it to the database.
* It generates a unique application ID, sets various properties related to the application,
* and handles the creation process within a database transaction.
*
* @param string $processUid The unique identifier for the process associated with the application.
* @param string $userUid The unique identifier for the user initiating the application.
* @param string $sequenceType The type of sequence to be used for generating the application number NORMAL or WEBENTRY.
*
* @throws PropelException If the application cannot be created due to validation failures or database errors.
* @throws Exception If an unexpected error occurs during the application creation process.
*
* @return string Returns the unique identifier of the newly created application.
*/
public function create($processUid, $userUid, $sequenceType)
{
$con = Propel::getConnection('workflow');
try {
// Fill the default values for new application row
$this->setAppUid(G::generateUniqueID());
$this->setAppUid(G::generateUid('app'));
$this->setAppParent('');
$this->setAppStatus('DRAFT');
$this->setAppStatusId(1);

View File

@@ -35,6 +35,7 @@ if (! function_exists( $_REQUEST['action'] ) || !G::isUserFunction($_REQUEST['ac
die();
}
$functionName = $_REQUEST['action'];
$functionParams = isset( $_REQUEST['params'] ) ? $_REQUEST['params'] : array ();
@@ -209,7 +210,6 @@ function startCase()
try {
// Initializing variables
$sequenceType = (!empty($_REQUEST['actionFrom']) && $_REQUEST['actionFrom'] === 'webEntry') ? AppSequence::APP_TYPE_WEB_ENTRY : AppSequence::APP_TYPE_NORMAL;
// Update CONTENT table
lookinginforContentProcess($_POST['processId']);
@@ -237,11 +237,13 @@ function startCase()
$newCase['status'] = 'success';
// Print JSON response
print (G::json_encode($newCase));
ob_end_clean();
header('Content-Type: application/json');
print (json_encode($newCase));
} catch (Exception $e) {
$newCase['status'] = 'failure';
$newCase['message'] = $e->getMessage();
print_r(G::json_encode($newCase));
print_r(json_encode($newCase));
}
}