Merged in bugfix/PMCORE-864 (pull request #7273)

PMCORE-864

Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
Julio Cesar Laura Avendaño
2020-02-27 12:18:50 +00:00
3 changed files with 24 additions and 2 deletions

View File

@@ -111,6 +111,16 @@ class SpoolRun
return $this->spoolId;
}
/**
* Set the fileData property
*
* @param array $fileData
*/
public function setFileData($fileData)
{
$this->fileData = $fileData;
}
/**
* Get the fileData property
*

View File

@@ -1007,10 +1007,21 @@ class WsBase
$result = "";
if ($gmail != 1) {
$closure = function() use ($setup, $messageArray, $gmail, $to) {
// Create always the record in APP_MESSAGE table
$spool = new SpoolRun();
$spool->setConfig($setup);
$spool->create($messageArray);
// Get the data of the record created
$fileData = $spool->getFileData();
$fileData['spoolId'] = $spool->getSpoolId();
// Create the closure and send the required data
$closure = function() use ($setup, $fileData, $gmail, $to) {
$spool = new SpoolRun();
$spool->setConfig($setup);
$spool->create($messageArray);
$spool->setSpoolId($fileData['spoolId']);
$spool->setFileData($fileData);
$spool->sendMail();
return $spool;
};

View File

@@ -190,6 +190,7 @@ class JobsManager
$callback($environment);
} catch (Exception $e) {
Log::error($e->getMessage() . ": " . $e->getTraceAsString());
throw $e;
}
});
$instance->delay($this->delay);