Ajout logs d'erreur lors de l'envoi de la facture
This commit is contained in:
parent
d6ffdc8f6a
commit
d77a8b7697
@ -254,24 +254,23 @@ if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"]
|
|||||||
if ($action == 'send')
|
if ($action == 'send')
|
||||||
{
|
{
|
||||||
$fac = new Facture($db,"",$facid);
|
$fac = new Facture($db,"",$facid);
|
||||||
$fac->fetch($facid);
|
|
||||||
|
|
||||||
|
if ( $fac->fetch($facid) )
|
||||||
|
{
|
||||||
$soc = new Societe($db, $fac->socidp);
|
$soc = new Societe($db, $fac->socidp);
|
||||||
|
|
||||||
$file = FAC_OUTPUTDIR . "/" . $fac->ref . "/" . $fac->ref . ".pdf";
|
$file = FAC_OUTPUTDIR . "/" . $fac->ref . "/" . $fac->ref . ".pdf";
|
||||||
|
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
|
|
||||||
$sendto = $soc->contact_get_email($HTTP_POST_VARS["destinataire"]);
|
$sendto = $soc->contact_get_email($HTTP_POST_VARS["destinataire"]);
|
||||||
$sendtoid = $HTTP_POST_VARS["destinataire"];
|
$sendtoid = $HTTP_POST_VARS["destinataire"];
|
||||||
|
|
||||||
if (strlen($sendto))
|
if (strlen($sendto))
|
||||||
{
|
{
|
||||||
|
|
||||||
$subject = "Facture $fac->ref";
|
$subject = "Facture $fac->ref";
|
||||||
$message = "Veuillez trouver ci-joint la facture $fac->ref\n\nCordialement\n\n";
|
$message = "Veuillez trouver ci-joint la facture $fac->ref\n\nCordialement\n\n";
|
||||||
$filename = "$fac->ref.pdf";
|
$filename = $fac->ref.".pdf";
|
||||||
|
|
||||||
$replyto = $HTTP_POST_VARS["replytoname"] . " <".$HTTP_POST_VARS["replytomail"] .">";
|
$replyto = $HTTP_POST_VARS["replytoname"] . " <".$HTTP_POST_VARS["replytomail"] .">";
|
||||||
|
|
||||||
@ -297,9 +296,18 @@ if ($action == 'send')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "Can't get email $sendto";
|
dolibarr_syslog("Le mail du destinataire est vide");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Le fichier PDF n'existe pas");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Impossible de lire la facture");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user