Merged in bugfix/PMC-895 (pull request #6958)
PMC-895 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -132,46 +132,48 @@ class ResponseReader
|
|||||||
foreach ($mailsIds as $key => $mailId) {
|
foreach ($mailsIds as $key => $mailId) {
|
||||||
/** @var IncomingMail $mail */
|
/** @var IncomingMail $mail */
|
||||||
$mail = $mailbox->getMail($mailId, false);
|
$mail = $mailbox->getMail($mailId, false);
|
||||||
preg_match("/{(.*)}/", $mail->textPlain, $matches);
|
if (!empty($mail->textPlain)) {
|
||||||
if ($matches) {
|
preg_match("/{(.*)}/", $mail->textPlain, $matches);
|
||||||
$dataEmail = G::json_decode(Crypt::decryptString($matches[1]), true);
|
if ($matches) {
|
||||||
$dataAbeReq = loadAbeRequest($dataEmail['ABE_REQ_UID']);
|
$dataEmail = G::json_decode(Crypt::decryptString($matches[1]), true);
|
||||||
if (config("system.workspace") === $dataEmail['workspace']
|
$dataAbeReq = loadAbeRequest($dataEmail['ABE_REQ_UID']);
|
||||||
&& (array_key_exists('ABE_UID', $dataAbeReq) && $dataAbeReq['ABE_UID'] == $dataAbe['ABE_UID'])) {
|
if (config("system.workspace") === $dataEmail['workspace']
|
||||||
$this->case = $dataEmail;
|
&& (array_key_exists('ABE_UID', $dataAbeReq) && $dataAbeReq['ABE_UID'] == $dataAbe['ABE_UID'])) {
|
||||||
try {
|
$this->case = $dataEmail;
|
||||||
$appDelegate = new AppDelegation();
|
try {
|
||||||
$alreadyRouted = $appDelegate->alreadyRouted($this->case["appUid"], $this->case["delIndex"]);
|
$appDelegate = new AppDelegation();
|
||||||
//Verify if the current case is already routed.
|
$alreadyRouted = $appDelegate->alreadyRouted($this->case["appUid"], $this->case["delIndex"]);
|
||||||
if ($alreadyRouted) {
|
//Verify if the current case is already routed.
|
||||||
$this->setMessageResponseError(G::LoadTranslation('ID_ABE_RESPONSE_ALREADY_ROUTED'));
|
if ($alreadyRouted) {
|
||||||
throw (new Exception(G::LoadTranslation('ID_CASE_DELEGATION_ALREADY_CLOSED'), 400));
|
$this->setMessageResponseError(G::LoadTranslation('ID_ABE_RESPONSE_ALREADY_ROUTED'));
|
||||||
|
throw (new Exception(G::LoadTranslation('ID_CASE_DELEGATION_ALREADY_CLOSED'), 400));
|
||||||
|
}
|
||||||
|
$this->processABE($this->case, $mail, $dataAbe);
|
||||||
|
$mailbox->markMailAsRead($mailId);
|
||||||
|
Bootstrap::registerMonolog(
|
||||||
|
$this->channel,
|
||||||
|
100, // DEBUG
|
||||||
|
G::LoadTranslation('ID_ABE_LOG_PROCESSED_OK'),
|
||||||
|
$this->case,
|
||||||
|
config("system.workspace"),
|
||||||
|
'processmaker.log'
|
||||||
|
);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->sendMessageError(
|
||||||
|
$this->getMessageResponseError() ? $this->getMessageResponseError() : $e->getMessage(),
|
||||||
|
$this->case,
|
||||||
|
$mail,
|
||||||
|
$emailSetup
|
||||||
|
);
|
||||||
|
Bootstrap::registerMonolog(
|
||||||
|
$this->channel,
|
||||||
|
$e->getCode() != 0 ? $e->getCode() : 400,
|
||||||
|
$e->getMessage(),
|
||||||
|
$this->case,
|
||||||
|
config("system.workspace"),
|
||||||
|
'processmaker.log'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$this->processABE($this->case, $mail, $dataAbe);
|
|
||||||
$mailbox->markMailAsRead($mailId);
|
|
||||||
Bootstrap::registerMonolog(
|
|
||||||
$this->channel,
|
|
||||||
100, // DEBUG
|
|
||||||
G::LoadTranslation('ID_ABE_LOG_PROCESSED_OK'),
|
|
||||||
$this->case,
|
|
||||||
config("system.workspace"),
|
|
||||||
'processmaker.log'
|
|
||||||
);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->sendMessageError(
|
|
||||||
$this->getMessageResponseError() ? $this->getMessageResponseError() : $e->getMessage(),
|
|
||||||
$this->case,
|
|
||||||
$mail,
|
|
||||||
$emailSetup
|
|
||||||
);
|
|
||||||
Bootstrap::registerMonolog(
|
|
||||||
$this->channel,
|
|
||||||
$e->getCode() != 0 ? $e->getCode() : 400,
|
|
||||||
$e->getMessage(),
|
|
||||||
$this->case,
|
|
||||||
config("system.workspace"),
|
|
||||||
'processmaker.log'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user