? storm--741466-6.patch
? storm--741466-7.patch
? storminvoice_fix744690.patch
Index: storminvoice/storminvoice.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/storm/storminvoice/storminvoice.admin.inc,v
retrieving revision 1.2.4.25
diff -u -p -r1.2.4.25 storminvoice.admin.inc
--- storminvoice/storminvoice.admin.inc	28 Oct 2009 22:16:14 -0000	1.2.4.25
+++ storminvoice/storminvoice.admin.inc	20 Mar 2010 14:02:23 -0000
@@ -367,20 +367,18 @@ function storminvoice_send_page($node, $
 function storminvoice_send_form(&$form_state, $path = NULL, $node = NULL, $language) {
   global $base_url, $user;
 
-  $pdffile=variable_get('storminvoice_email_pdf_file_path', '');
-
   $organization = node_load($node->organization_nid);
   $organization_email = $organization->email;
 
   $form = array();
-  $cid = array();
 
   $emailtype = 'email';
 
   $form['message']['instructions'] = array(
     '#type' => 'item',
-    '#value' => variable_get('storminvoice_email_pdf_instructions', t('<p>From here you can send PDF file of invoice as attachment to your client</p><p><b>NOTE:</b> You can change subject and cover note of email. If <i>Bcc</i> field is checked you will also get copy of email.</p>')),
+    '#value' => variable_get('storminvoice_email_pdf_instructions', t('<p>From here you can send a PDF file of the invoice as attachment to your client</p><p><b>NOTE:</b> You can change subject and cover note of email. If <i>Bcc</i> field is checked, you will also get a copy of the email.</p>')),
   );
+
   $form['message']['yemail'] = array(
     '#type' => 'textfield',
     '#title' => t('Your Email'),
@@ -388,6 +386,7 @@ function storminvoice_send_form(&$form_s
     '#maxlength' => 256,
     '#required' => TRUE,
   );
+
   $form['message']['yname'] = array(
     '#type' => 'textfield',
     '#title' => t('Your Name'),
@@ -395,6 +394,7 @@ function storminvoice_send_form(&$form_s
     '#maxlength' => 256,
     '#required' => TRUE,
   );
+
   $form['message']['recipients'] = array(
     '#type' => 'textfield',
     '#title' => t('Send To'),
@@ -422,7 +422,7 @@ function storminvoice_send_form(&$form_s
     '#type' => 'textfield',
     '#title' => t('Message Subject'),
     '#value' => variable_get('storminvoice_cover_note_subject', ''),
-    '#description' => t('Enter subject for email.'),
+    '#description' => t('Subect line for email.'),
   );
   $form['message']['body'] = array(
     '#type' => 'textarea',
@@ -466,8 +466,7 @@ function storminvoice_send_form_submit($
   $params['subject'] = $form_filled['subject'];
   $params['bcc'] = $form_state['values']['bcc'];
 
-  $trenner  = md5(uniqid(time()));
-  variable_set('storminvoice_email_pdf_trenner', $trenner);
+  $params['trenner'] = $trenner = md5(uniqid(time()));
 
   $headers['Content-Type'] = "multipart/mixed; boundary=$trenner";
   $params['body']  = "\n--$trenner\n";
@@ -480,9 +479,8 @@ function storminvoice_send_form_submit($
   $language = $form['#parameters'][4];
   $filedata = theme('storminvoice_report_pdf', $node, $language, 'email');
 
-  $pdffile = variable_get('storminvoice_email_pdf_file_path', '');
   $pdffile_name = variable_get('storminvoice_email_pdf_file_name', '');
-  $pdffile_mime = file_get_mimetype($pdffile);
+  $pdffile_mime = ' application/pdf';
   $params['body']  .= "--$trenner"."\n";
   $params['body']  .= "Content-Type:$pdffile_mime; name='$pdffile_name'\n";
   $params['body']  .= "Content-Disposition: attachment; filename='$pdffile_name'\n";
@@ -492,19 +490,17 @@ function storminvoice_send_form_submit($
 
   drupal_mail('storminvoice', 'invoice', $to, $language, $params, $from , True);
 
-  drupal_set_message(variable_get('storminvoice_sent', t('You have sent invoice to !email.', array('!email' => $to ))));
+  drupal_set_message(variable_get('storminvoice_sent', t('The invoice has been sent.')));
 }
 
 /**
  * Implementation of hook_mail().
  */
 function storminvoice_mail($key, &$message, $params) {
-
-  $trenner = variable_get('storminvoice_email_pdf_trenner', '');
   $message['subject'] = $params['subject'];
   $message['body'][] = $params['body'];
   $message['headers']['MIME-Version'] = '1.0';
-  $message['headers']['Content-Type'] = "multipart/mixed; boundary=$trenner";
+  $message['headers']['Content-Type'] = "multipart/mixed; boundary=$params['trenner']";
   if ($params['bcc']){
     $message['headers']['Bcc'] = $message['headers']['From'];
   }
Index: storminvoice/storminvoice.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/storm/storminvoice/storminvoice.theme.inc,v
retrieving revision 1.2.4.48
diff -u -p -r1.2.4.48 storminvoice.theme.inc
--- storminvoice/storminvoice.theme.inc	20 Mar 2010 13:12:31 -0000	1.2.4.48
+++ storminvoice/storminvoice.theme.inc	20 Mar 2010 14:02:24 -0000
@@ -623,13 +623,13 @@ function theme_storminvoice_report_pdf($
 
   //Close and output PDF document
   if ($output == 'screen') {
+    // Pipe document inline to browser
     $pdf->Output($filename, "I");
   }
   else if ($output == 'email') {
-    $dir = file_directory_path().'/';
-    variable_set('storminvoice_email_pdf_file_path', $dir.$filename);
     variable_set('storminvoice_email_pdf_file_name', $filename);
-    return $pdf->Output($dir.$filename, "S");
+    // Return pdf as string
+    return $pdf->Output(NULL, "S");
   }
 }
 
