Merged in bugfix/PMCORE-4120 (pull request #8704)

PMCORE-4128
This commit is contained in:
Julio Cesar Laura Avendaño
2023-01-27 19:07:30 +00:00
2 changed files with 19 additions and 1 deletions

View File

@@ -6165,6 +6165,7 @@ class G
define('PM_HASH_PASSWORD', 1018); define('PM_HASH_PASSWORD', 1018);
define('PM_SCHEDULER_CREATE_CASE_BEFORE', 1019); define('PM_SCHEDULER_CREATE_CASE_BEFORE', 1019);
define('PM_SCHEDULER_CREATE_CASE_AFTER', 1020); define('PM_SCHEDULER_CREATE_CASE_AFTER', 1020);
define('PM_SWAP_TEMPORARY_APP_NUMBER', 1021);
} }
/** /**

View File

@@ -9,9 +9,11 @@ use Illuminate\Support\Facades\DB;
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
use ProcessMaker\Model\Application; use ProcessMaker\Model\Application;
use ProcessMaker\Model\WebEntry as WebEntryModel; use ProcessMaker\Model\WebEntry as WebEntryModel;
use ProcessMaker\Plugins\PluginRegistry;
use Publisher; use Publisher;
use RBAC; use RBAC;
use ResultSet; use ResultSet;
use stdClass;
use WebEntryPeer; use WebEntryPeer;
class WebEntry class WebEntry
@@ -1208,7 +1210,7 @@ class WebEntry
public function swapTemporaryAppNumber($appUid) public function swapTemporaryAppNumber($appUid)
{ {
// Get the application // Get the application
$application = Application::query()->select(['APP_NUMBER'])->where('APP_UID', '=', $appUid)->first()->toArray(); $application = Application::query()->select(['PRO_UID', 'APP_NUMBER'])->where('APP_UID', '=', $appUid)->first()->toArray();
// If application exists, swap the number // If application exists, swap the number
if (!empty($application)) { if (!empty($application)) {
@@ -1233,6 +1235,21 @@ class WebEntry
// Execute the query // Execute the query
DB::connection('workflow')->unprepared($query); DB::connection('workflow')->unprepared($query);
// Plugin Hook PM_SWAP_TEMPORARY_APP_NUMBER for upload document
$pluginRegistry = PluginRegistry::loadSingleton();
// If the hook exists try to execute
if ($pluginRegistry->existsTrigger(PM_SWAP_TEMPORARY_APP_NUMBER)) {
// Build the object to send
$data = new stdClass();
$data->sProcessUid = $application['PRO_UID'];
$data->appUid = $appUid;
$data->appNumber = $appNumber;
// Execute hook
$pluginRegistry->executeTriggers(PM_SWAP_TEMPORARY_APP_NUMBER, $data);
}
// Return new application number // Return new application number
return $appNumber; return $appNumber;
} }