/** * Returns the List of Matching records with the Email Address * @global Users Instance $current_user * @param String $module * @param Email Address $email * @return Array */ function lookupModuleRecordsWithEmail($module, $email, $msguid) { global $current_user; $query = $this->buildSearchQuery($module, $email, 'EMAIL'); $qresults = vtws_query($query, $current_user); $describe = $this->ws_describe($module); $labelFields = $describe['labelFields']; switch ($module) { case 'HelpDesk': $labelFields = 'ticket_title'; break; case 'Documents': $labelFields = 'notes_title'; break; } $labelFields = explode(',', $labelFields); $results = array(); foreach ($qresults as $qresult) { $labelValues = array(); foreach ($labelFields as $fieldname) { if (isset($qresult[$fieldname])) { $labelValues[] = $qresult[$fieldname]; } } $ids = vtws_getIdComponents($qresult['id']); $linkedto = MailManager::isEMailAssociatedWithCRMID($msguid, $ids[1]); $results[] = array('wsid' => $qresult['id'], 'id' => $ids[1], 'label' => implode(' ', $labelValues), 'linked' => $linkedto); } return $results; }