diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a24e4da03c0..65b24e41c9d 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -59,6 +59,8 @@ require_once "../lib/CMailFile.class.php"; if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } +if (isset($_GET["msg"])) { $msg=urldecode($_GET["msg"]); } + /* * Sécurité accés client */ @@ -165,7 +167,7 @@ if ($_POST["action"] == 'add') } else { - print "Erreur"; + print $langs->trans("UnknownError"); } } } @@ -197,14 +199,14 @@ if ($_POST["action"] == 'add') } else { - print "Erreur"; + print $langs->trans("UnknownError"); } } else { print "
Erreur : la facture n'a pas été créée, vérifier le numéro !"; print "
Retour à la propale"; - print $db->error(); + dolibarr_print_error($db); } } @@ -334,7 +336,7 @@ if ($_POST["action"] == 'confirm_canceled' && $_POST["confirm"] == yes) /* - * + * Action envoi de mail */ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance') { @@ -347,6 +349,8 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance') if (is_readable($file)) { + $soc = new Societe($db, $fac->socidp); + if ($_POST["sendto"]) { // Le destinataire a été fourni via le champ libre $sendto = $_POST["sendto"]; @@ -354,7 +358,6 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance') } elseif ($_POST["receiver"]) { // Le destinataire a été fourni via la liste déroulante - $soc = new Societe($db, $fac->socidp); $sendto = $soc->contact_get_email($_POST["receiver"]); $sendtoid = $_POST["receiver"]; } @@ -374,8 +377,8 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance') $actionmsg2="Relance Facture par mail"; } $message = $_POST["message"]; - $from = $_POST["fromname"] . " <".$_POST["frommail"] .">"; - $replyto = $_POST["replytoname"]. " <".$_POST["replytomail"].">"; + $from = $_POST["fromname"] . " <" . $_POST["frommail"] .">"; + $replyto = $_POST["replytoname"]. " <" . $_POST["replytomail"].">"; $filepath[0] = $file; $filename[0] = $fac->ref.".pdf"; @@ -389,6 +392,8 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance') if ( $mailfile->sendfile() ) { + $msg='