Ejemplo n.º 1
0
 /**
  * handles functionality specific to the Mailbox type (Cases, bounced
  * campaigns, etc.)
  *
  * @param object email Email object passed as a reference
  * @param object header Header object generated by imap_headerinfo();
  */
 function handleMailboxType(&$email, &$header)
 {
     switch ($this->mailbox_type) {
         case 'support':
             $this->handleCaseAssignment($email);
             break;
         case 'bug':
             break;
         case 'info':
             // do something with this?
             break;
         case 'sales':
             // do something with leads? we don't have an email_leads table
             break;
         case 'task':
             // do something?
             break;
         case 'bounce':
             require_once 'modules/Campaigns/ProcessBouncedEmails.php';
             campaign_process_bounced_emails($email, $header);
             break;
         case 'pick':
             // do all except bounce handling
             $GLOBALS['log']->debug('looking for a case for ' . $email->name);
             $this->handleCaseAssignment($email);
             break;
     }
 }
 /**
  * handles functionality specific to the Mailbox type (Cases, bounced
  * campaigns, etc.)
  *
  * @param object email Email object passed as a reference
  * @param object header Header object generated by imap_headerinfo();
  */
 function handleMailboxType(&$email, &$header)
 {
     switch ($this->mailbox_type) {
         case 'support':
             if (!class_exists('aCase')) {
                 require_once 'modules/Cases/Case.php';
             }
             $c = new aCase();
             $GLOBALS['log']->debug('looking for a case for ' . $email->name);
             if ($caseId = $this->getCaseIdFromCaseNumber($email->name, $c)) {
                 $c->retrieve($caseId);
                 $c->load_relationship('emails');
                 $c->emails->add($email->id);
                 $email->retrieve($email->id);
                 $email->parent_type = "Cases";
                 $email->parent_id = $caseId;
                 $email->save();
                 $GLOBALS['log']->debug('InboundEmail found exactly 1 match for a case: ' . $c->name);
             }
             break;
         case 'bug':
             break;
         case 'info':
             // do something with this?
             break;
         case 'sales':
             // do something with leads? we don't have an email_leads table
             break;
         case 'task':
             // do something?
             break;
         case 'bounce':
             require_once 'modules/Campaigns/ProcessBouncedEmails.php';
             campaign_process_bounced_emails($email, $header);
             break;
         case 'pick':
             // do all except bounce handling
             require_once 'modules/Cases/Case.php';
             $c = new aCase();
             $GLOBALS['log']->debug('looking for a case for ' . $email->name);
             if ($caseId = $this->getCaseIdFromCaseNumber($email->name, $c)) {
                 $c->retrieve($caseId);
                 $c->load_relationship('emails');
                 $c->emails->add($email->id);
                 $email->retrieve($email->id);
                 $email->parent_type = "Cases";
                 $email->parent_id = $caseId;
                 $email->save();
                 $GLOBALS['log']->debug('InboundEmail found exactly 1 match for a case: ' . $c->name);
             }
             break;
     }
 }