if (!empty($_REQUEST['parent_module'])) {
     $note = new Note();
     $note->name = $focus->name;
     if ($zuckerreports_config["debug"] == "yes") {
         $note->description = $focus->report_output;
     }
     $note->filename = $focus->report_result_name;
     if ($_REQUEST['parent_module'] == 'Contacts') {
         $note->contact_id = $_REQUEST['parent_id'];
     } else {
         $note->parent_type = $_REQUEST['parent_module'];
         $note->parent_id = $_REQUEST['parent_id'];
     }
     $note->save();
     $uf = new UploadFile("upload");
     $uf->set_for_soap($focus->report_result_name, file_get_contents($focus->report_result));
     $uf->stored_file_name = $uf->create_stored_filename();
     $uf->final_move($note->id);
     $note_url = "index.php?action=DetailView&module=Notes&record=" . $note->id . "&return_module=ZuckerReports&return_action=ReportOnDemand";
 }
 if (!empty($_REQUEST['send_email'])) {
     $mail = new SugarPHPMailer();
     $emails = split(",", $_REQUEST['send_email']);
     foreach ($emails as $email) {
         $mail->AddAddress($email);
     }
     $admin = new Administration();
     $admin->retrieveSettings();
     if ($admin->settings['mail_sendtype'] == "SMTP") {
         $mail->Mailer = "smtp";
         $mail->Host = $admin->settings['mail_smtpserver'];
Exemple #2
0
 /**
  * Create a new Note object
  * @param array $data Note data
  * @param Email $email parent email
  */
 protected function createNote($data, $email)
 {
     require_once 'include/upload_file.php';
     $upload_file = new UploadFile('uploadfile');
     $decodedFile = base64_decode($data['content']);
     $upload_file->set_for_soap($data['filename'], $decodedFile);
     $ext_pos = strrpos($upload_file->stored_file_name, ".");
     $upload_file->file_ext = substr($upload_file->stored_file_name, $ext_pos + 1);
     $note = BeanFactory::getBean('Notes');
     $note->id = create_guid();
     $note->new_with_id = true;
     if (in_array($upload_file->file_ext, $this->config['upload_badext'])) {
         $upload_file->stored_file_name .= ".txt";
         $upload_file->file_ext = "txt";
     }
     $note->filename = $upload_file->get_stored_file_name();
     if (isset($data['type'])) {
         $note->file_mime_type = $data['type'];
     } else {
         $note->file_mime_type = $upload_file->getMimeSoap($note->filename);
     }
     $note->team_id = $email->team_id;
     $note->team_set_id = $email->team_set_id;
     $note->assigned_user_id = $email->assigned_user_id;
     $note->parent_type = 'Emails';
     $note->parent_id = $email->id;
     $note->name = $note->filename;
     $note->save();
     $upload_file->final_move($note->id);
 }