PMCORE-864

This commit is contained in:
Julio Cesar Laura Avendaño
2020-02-26 16:23:08 -04:00
parent 483fc19366
commit 596a0b72bc
3 changed files with 24 additions and 2 deletions

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;
};