Esempio n. 1
0
 /** @return bool */
 protected final function filterConnectorData()
 {
     $result = true;
     $endpoint = $this->getConnector();
     if (is_array($endpoint) && !empty($endpoint['CODE'])) {
         // do not send mails if connector will not found
         $result = false;
         // try to find connector
         $connector = ConnectorManager::getConnector($endpoint);
         $this->connector = $connector;
     } elseif (is_object($endpoint) && $endpoint instanceof Connector) {
         $this->connector = $endpoint;
     }
     if ($this->connector) {
         // merge connector filter and proxy fields. proxy fields have priority
         $connectorFields = $this->getProxyFieldsFromEventToConnector();
         if (!empty($connectorFields)) {
             $connectorFields = $connectorFields + $this->getFields();
         }
         // set fields to connector
         $this->connector->setFieldValues($connectorFields);
         $result = false;
         // add recipient from data if connector get it
         $recipientDb = $this->connector->getData();
         if ($recipient = $recipientDb->Fetch()) {
             $this->recipient = $recipient;
             $result = true;
         }
     }
     return $result;
 }