×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Jakub Polok
Added: May 13, 2022 9:07 AM
Views: 10
Tags: no tags
  1. /** @var \Landax\Domain\Hierarchy\EmailLogNode $emailLogNode */
  2.                         $content = $emailLogNode->GetMailContent();
  3.  
  4.                         preg_match_all(MailService::UUID_REGEX, strip_tags($content), $matches);
  5.                         if(($uuids = $matches[0]) && ($uuid = array_last($uuids))) { // array_last fordi vi ønsker den som er nederst i mailen.
  6.                                 $uuid = substr($uuid, 4, -1); // Fjerner {LX- og }
  7.                                 $ThreadLog = $this->getDomain()->ModelLogic->EmailLog()->GetCollectionWithoutPermissions()
  8.                                         ->Where(fn(EmailLogKeyModel $model, ILinqFilter $f) => $f
  9.                                                 ->Equals($model->Uuid, $uuid)
  10.                                         )->First();
  11.  
  12.                                 /** @var EmailLog $ThreadLog */
  13.                                 if($ThreadLog && $ThreadLog->NodeModuleId === Modules::SURVEYRESULTS) {
  14.                                         $limit--;
  15.                                         if($limit<=0) {
  16.                                                 break;
  17.                                         }
  18.  
  19. //                                      $updateLog = EmailLog::GetEmptyModel();
  20. //                                      $updateLog->Id = $emailLogNode->GetId();
  21. //                                      $updateLog->NodeModuleId = $ThreadLog->NodeModuleId;
  22. //                                      $this->getDomain()->ModelLogic->EmailLog()->Update($updateLog);
  23.  
  24.                                         $candidates[] = [
  25.                                                 'log' => $emailLogNode->GetId(),
  26.                                                 'threded' => $ThreadLog->Id,
  27.                                                 'content' => $content,
  28.                                         ];
  29.                                 }
  30.                         }