phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r716 - in trunk/invoicing: . include


From: phpcompta-dev
Subject: [Phpcompta-dev] r716 - in trunk/invoicing: . include
Date: Sat, 1 Mar 2014 22:33:03 +0100 (CET)

Author: danydb
Date: 2014-03-01 22:33:03 +0100 (Sat, 01 Mar 2014)
New Revision: 716

Modified:
   trunk/invoicing/include/invoice_send_mail.inc.php
   trunk/invoicing/include/invoicing.inc.php
   trunk/invoicing/index.php
Log:
Bug : use copy instead of email_copy
Bug : cannot send to sender
Bug : exception whenever message empty was not catch

Modified: trunk/invoicing/include/invoice_send_mail.inc.php
===================================================================
--- trunk/invoicing/include/invoice_send_mail.inc.php   2014-03-01 01:40:41 UTC 
(rev 715)
+++ trunk/invoicing/include/invoice_send_mail.inc.php   2014-03-01 21:33:03 UTC 
(rev 716)
@@ -33,7 +33,7 @@
 $from = HtmlInput::default_value_get('email_from', 'null');
 $subject = HtmlInput::default_value_get('email_subject', 'null');
 $message = HtmlInput::default_value_get('email_message', 'null');
-$copy = HtmlInput::default_value_get('email_copy', 'null');
+$copy = HtmlInput::default_value_get('email_copy', '-1');
 $pdf = HtmlInput::default_value_get('pdf', 'null');
 if ($from == "null") {
     die (_("Désolé mais il faut donner l'email de celui qui envoie"));
@@ -41,6 +41,11 @@
 if ($subject == "null") {
     die (_("Le sujet est obligatoire"));
 }
+
+if ( $message=="null")
+{
+    $message=$subject;
+}
 $feedback = array();
 $dirname = tempnam($_ENV['TMP'], 'invoice');
 unlink($dirname);
@@ -97,23 +102,28 @@
         $sendmail->set_from($from);
         $to = $dest_mail;
 
-        if ($copy != 'null')
+        if ($copy != '-1')
         {
             $dest_mail= $dest_mail . ',' . $from;
         }
         $sendmail->mailto($dest_mail);
         $sendmail->set_subject($subject);
+        
+        if (strlen(trim($message))==0) {
+            $message=$subject;
+        }
+        
         $sendmail->set_message($message);
         $ofile = new FileToSend($filetosend);
         $sendmail->add_file($ofile);
-        $sendmail->compose();
         try
         {
+            $sendmail->compose();
             $sendmail->send();
             $feedback[] = _('Envoi facture ') . $invoice['jr_pj_name'] . _(' 
destinataire ') . $dest_qcode . " " . $dest_name . " " . $dest_mail;
         } catch (Exception $e)
         {
-            $feedback[] = _('Envoi echoué') . " $dest_qcode $dest_name 
$dest_mail";
+            $feedback[] = _('Envoi echoué') ." ".$e->getMessage(). " 
$dest_qcode $dest_name $dest_mail ";
         }
     } else if ($invoice['jr_pj_name'] == "" || $invoice['jr_pj'] == "")
     {

Modified: trunk/invoicing/include/invoicing.inc.php
===================================================================
--- trunk/invoicing/include/invoicing.inc.php   2014-03-01 01:40:41 UTC (rev 
715)
+++ trunk/invoicing/include/invoicing.inc.php   2014-03-01 21:33:03 UTC (rev 
716)
@@ -121,7 +121,7 @@
                     <textarea style="vertical-align: top;width:23%;height:10%" 
name="email_message" class="input_text">               </textarea>
                 </p>
                 <p>
-                    <input type="checkbox" name="copy"> <?php echo _("Envoyer 
copie à l'expéditeur"); ?>
+                    <input type="checkbox" name="email_copy"> <?php echo 
_("Envoyer copie à l'expéditeur"); ?>
                    
                 </p>
             </div>

Modified: trunk/invoicing/index.php
===================================================================
--- trunk/invoicing/index.php   2014-03-01 01:40:41 UTC (rev 715)
+++ trunk/invoicing/index.php   2014-03-01 21:33:03 UTC (rev 716)
@@ -37,8 +37,8 @@
 $version_plugin=SVNINFO;
 Extension::check_version(5500);
 require_once 'class_acc_ledger_sold.php';
-require_once 'include/invoicing.inc.php';
 require_once('class_zip_extended.php');
 require_once 'class_sendmail.php';
 require_once 'class_filetosend.php';
+require_once 'include/invoicing.inc.php';
 ?>



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]