示例#1
0
 public static function ExtractUrnFromMessage(&$messageData, $codeAllocation = false)
 {
     if (!is_array($messageData) || empty($messageData)) {
         return '';
     }
     if ($codeAllocation === false) {
         $codeAllocation = CCrmEMailCodeAllocation::GetCurrent();
     }
     $subject = isset($messageData['SUBJECT']) ? $messageData['SUBJECT'] : '';
     $body = isset($messageData['BODY']) ? $messageData['BODY'] : '';
     $result = '';
     if ($codeAllocation === CCrmEMailCodeAllocation::Subject) {
         $result = CCrmActivity::ExtractUrnFromSubject($subject);
         if ($result === '') {
             $result = CCrmActivity::ExtractUrnFromBody($body);
         }
     } elseif ($codeAllocation === CCrmEMailCodeAllocation::Body) {
         $result = CCrmActivity::ExtractUrnFromBody($body);
         if ($result === '') {
             $result = CCrmActivity::ExtractUrnFromSubject($subject);
         }
     }
     return $result;
 }