/**
  * Conflict incoming mail
  * 
  * @param void
  * @return void
  */
 function conflict()
 {
     if ($this->active_mail->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     require_once INCOMING_MAIL_MODULE_PATH . '/models/IncomingMailImporter.class.php';
     $mail_data = $this->request->post('mail');
     if (!is_foreachable($mail_data)) {
         flash_error(incoming_mail_module_get_status_description($this->active_mail->getState()));
         $mail_data = array('subject' => $this->active_mail->getSubject(), 'body' => $this->active_mail->getBody(), 'created_by_id' => $this->active_mail->getCreatedById(), 'project_id' => $this->active_mail->getProjectId());
     }
     // if
     if ($this->request->isSubmitted()) {
         $this->active_mail->setSubject(array_var($mail_data, 'subject'));
         $this->active_mail->setBody(array_var($mail_data, 'body'));
         $creator_id = array_var($mail_data, 'created_by_id');
         if ($creator_id && $creator_id != 'original_author') {
             $creator = Users::findById($creator_id);
             if (instance_of($creator, 'User')) {
                 $this->active_mail->setCreatedBy($creator);
             }
             // if
         }
         // if
         $this->active_mail->setCreatedById(array_var($mail_data, 'created_by_id'));
         $this->active_mail->setObjectType(array_var($mail_data, 'object_type'));
         if (array_var($mail_data, 'object_type') == 'comment') {
             $this->active_mail->setParentId(array_var($mail_data, 'parent_id'));
         }
         // if
         // import email
         if (instance_of($importing_result = IncomingMailImporter::importPendingEmail($this->active_mail, $creator_id == 'original_author'), 'ProjectObject')) {
             // we have successfully imported email
             $this->active_mail->delete();
             if ($this->request->isAsyncCall()) {
                 $this->renderText(lang('<p>Conflict Solved Successfully!</p><p>View created <a href=":url">:object</a>.</p>', array('object' => $this->active_mail->getObjectType(), 'url' => $importing_result->getViewUrl())));
             } else {
                 flash_success('Conflict Solved Successfully!');
                 $this->redirectTo('incoming_mail');
             }
             // if
         } else {
             if ($this->request->isAsyncCall()) {
                 $this->httpError(HTTP_ERR_INVALID_PROPERTIES, null, false, 2);
             } else {
                 flash_error($importing_result->getMessage());
             }
             // if
         }
         // if
     }
     // if
     $user = $this->active_mail->getCreatedBy();
     if (instance_of($user, 'User')) {
         $this->smarty->assign('object_user', $user);
     } else {
         $this->smarty->assign('object_user', $this->logged_user);
     }
     // if
     $this->smarty->assign(array('async' => $this->request->isAsyncCall(), 'form_url' => $this->active_mail->getImportUrl() . ($this->request->isAsyncCall() ? '?skip_layout=1&async=1' : ''), 'status_message' => incoming_mail_module_get_status_description($this->active_mail->getState()), 'mail_data' => $mail_data, 'project' => $this->active_mail->getProject()));
     $flash =& Flash::instance();
     $flash->init();
     js_assign('additional_fields_url', assemble_url('incoming_mail_additional_form_fields'));
 }