This commit is contained in:
Laurent Destailleur 2009-03-07 01:44:45 +00:00
parent a66188563b
commit a3fd04bb25

View File

@ -1,7 +1,7 @@
#!/usr/bin/php #!/usr/bin/php
<?PHP <?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -19,7 +19,7 @@
*/ */
/** /**
* \file scripts/invoices/factures-impayees-commerciaux.php * \file scripts/invoices/email_unpayed_invoices_to_representatives.php
* \ingroup facture * \ingroup facture
* \brief Script to send a mail to dolibarr users linked to companies with unpayed invoices * \brief Script to send a mail to dolibarr users linked to companies with unpayed invoices
* \version $Id$ * \version $Id$
@ -33,7 +33,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
} }
// Recupere root dolibarr // Recupere root dolibarr
$path=eregi_replace('factures-impayees-commerciaux.php','',$_SERVER["PHP_SELF"]); $path=eregi_replace('email_unpayed_invoices_to_representatives.php','',$_SERVER["PHP_SELF"]);
require($path."../../htdocs/master.inc.php"); require($path."../../htdocs/master.inc.php");
@ -60,7 +60,7 @@ if ( $db->query($sql) )
$oldemail = ''; $oldemail = '';
$message = ''; $message = '';
$total = ''; $total = '';
dol_syslog("factures-impayees-commerciaux: "); dol_syslog("email_unpayed_invoices_to_representatives.php");
if ($num) if ($num)
{ {
@ -82,7 +82,7 @@ if ( $db->query($sql) )
$message .= "Facture ".$obj->facnumber." : ".price($obj->total_ttc)." : ".$obj->nom."\n"; $message .= "Facture ".$obj->facnumber." : ".price($obj->total_ttc)." : ".$obj->nom."\n";
$total += $obj->total_ttc; $total += $obj->total_ttc;
dol_syslog("factures-impayees-commerciaux: ".$obj->email); dol_syslog("email_unpayed_invoices_to_representatives.php: ".$obj->email);
$i++; $i++;
} }
@ -100,7 +100,7 @@ if ( $db->query($sql) )
else else
{ {
dol_print_error($db); dol_print_error($db);
dol_syslog("factures-impayees-commerciaux: Error"); dol_syslog("email_unpayed_invoices_to_representatives.php: Error");
} }
@ -114,10 +114,10 @@ function envoi_mail($oldemail,$message,$total)
$msgishtml = 0; $msgishtml = 0;
print "Envoi mail pour $oldemail, total: $total\n"; print "Envoi mail pour $oldemail, total: $total\n";
dol_syslog("factures-impayees-commerciaux: send mail to $oldemail"); dol_syslog("email_unpayed_invoices_to_representatives.php: send mail to $oldemail");
$allmessage = "List of unpayed invoices\n"; $allmessage = "List of unpayed invoices\n";
$allmessage .= "This list contains only invoices for third parties you are linked to as commercial.\n"; $allmessage .= "This list contains only invoices for third parties you are linked to as a sales representative.\n";
$allmessage .= "\n"; $allmessage .= "\n";
$allmessage .= $message; $allmessage .= $message;
$allmessage .= "\n"; $allmessage .= "\n";