From 39d3d1a34e7cc87b6b0532f83e1551471d4494b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2013 12:00:31 +0200 Subject: [PATCH] Enhance script to send email to sale representatives --- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/fr_FR/admin.lang | 2 +- .../email_unpaid_invoices_to_representatives.php | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 290707219bb..13cd8e505f8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -298,7 +298,7 @@ DoTestServerAvailability=Test server connectivity DoTestSend=Test sending DoTestSendHTML=Test sending HTML ErrorCantUseRazInStartedYearIfNoYearMonthInMask=Error, can't use option @ if sequence {yy}{mm} or {yyyy}{mm} is not in mask. -UMask=UMask parameter for new files on Unix/Linux/BSD file system. +UMask=UMask parameter for new files on Unix/Linux/BSD/Mac file system. UMaskExplanation=This parameter allow you to define permissions set by default on files created by Dolibarr on server (during upload for example).
It must be the octal value (for example, 0666 means read and write for everyone).
This parameter is useless on a Windows server. SeeWikiForAllTeam=Take a look at the wiki page for full list of all actors and their organisation UseACacheDelay= Delay for caching export response in seconds (0 or empty for no cache) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index cc2ee5b2a4e..5e9d958858e 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -293,7 +293,7 @@ DoTestServerAvailability= Tester disponibilité serveur DoTestSend= Tester envoi DoTestSendHTML= Tester envoi HTML ErrorCantUseRazInStartedYearIfNoYearMonthInMask= Erreur, ne peut utiliser l'option @ si la séquence {yy}{mm} ou {yyyy}{mm} n'est pas dans le masque. -UMask= Paramètre UMask des nouveaux fichiers sous Unix/Linux/BSD. +UMask= Paramètre UMask des nouveaux fichiers sous Unix/Linux/BSD/Mac. UMaskExplanation= Ce paramètre permet de définir les droits des fichiers créés sur le serveur par Dolibarr (lors d'upload par exemple).
Ce doit être la valeur octale (par exemple 0666 signifie lecture/écriture pour tous).
Ce paramètre n'a aucun effet sur un serveur Windows. SeeWikiForAllTeam= Voir le wiki pour le détail de tous les acteurs et leur organisation UseACacheDelay= Délai de mise en cache de l'export en secondes (0 ou vide pour aucun cache) diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index e62403366fb..abeb8296493 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -50,6 +50,7 @@ $mode=$argv[1]; require($path."../../htdocs/master.inc.php"); require_once (DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"); +$langs->load('main'); /* @@ -62,7 +63,7 @@ $duration_value=$argv[2]; $error = 0; print $script_file." launched with mode ".$mode.($duration_value?" delay=".$duration_value:"")."\n"; -$sql = "SELECT f.facnumber, f.total_ttc, s.nom as name, u.rowid as uid, u.lastname, u.firstname, u.email, u.lang"; +$sql = "SELECT f.facnumber, f.total_ttc, f.date_lim_reglement as due_date, s.nom as name, u.rowid as uid, u.lastname, u.firstname, u.email, u.lang"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " , ".MAIN_DB_PREFIX."societe as s"; $sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -110,7 +111,7 @@ if ($resql) if (dol_strlen($oldemail)) { $message .= $langs->trans("Invoice")." ".$obj->facnumber." : ".price($obj->total_ttc)." : ".$obj->name."\n"; - print "Invoice ".$obj->facnumber.", price ".price2num($obj->total_ttc).", linked to company ".$obj->name." with sale representative ".dolGetFirstLastname($obj->firstname, $obj->lastname)." qualified.\n"; + print "Unpaid invoice ".$obj->facnumber.", price ".price2num($obj->total_ttc).", due date ".dol_print_date($db->jdate($obj->due_date),'day')." (linked to company ".$obj->name.", sale representative ".dolGetFirstLastname($obj->firstname, $obj->lastname).", email ".$obj->email.") qualified.\n"; dol_syslog("email_unpaid_invoices_to_representatives.php: ".$obj->email); } @@ -129,7 +130,7 @@ if ($resql) } else { - print "No unpaid invoices to companies linked to a particular commercial dolibarr user\n"; + print "No unpaid invoices (for companies linked to a particular commercial dolibarr user) found\n"; } } else @@ -213,6 +214,8 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang) } else { + print "No email sent (test mode)\n"; + dol_syslog("No email sent (test mode)"); $mail->dump_mail(); $result=1; }