Fix: count of notification emails was wrong

This commit is contained in:
Laurent Destailleur 2015-03-13 14:11:59 +01:00
parent c1432eb2da
commit dfe1ee7e7d
2 changed files with 24 additions and 10 deletions

View File

@ -54,7 +54,7 @@ MaxSize=Maximum size
AttachANewFile=Attach a new file/document
LinkedObject=Linked object
Miscellaneous=Miscellaneous
NbOfActiveNotifications=Number of notifications
NbOfActiveNotifications=Number of notifications (nb of recipient emails)
PredefinedMailTest=This is a test mail.\nThe two lines are separated by a carriage return.\n\n__SIGNATURE__
PredefinedMailTestHtml=This is a <b>test</b> mail (the word test must be in bold).<br>The two lines are separated by a carriage return.<br><br>__SIGNATURE__
PredefinedMailContentSendInvoice=__CONTACTCIVNAME__\n\nYou will find here the invoice __FACREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__

View File

@ -169,6 +169,8 @@ if ($result > 0)
print '<tr><td>'.$langs->trans("NbOfActiveNotifications").'</td>';
print '<td colspan="3">';
$nb=0;
// List of per contact notifications
$sql = "SELECT COUNT(n.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n";
$sql.= " WHERE fk_soc = ".$object->id;
@ -187,6 +189,13 @@ if ($result > 0)
else {
dol_print_error($db);
}
// List of notifications enabled for fixed email
foreach($conf->global as $key => $val)
{
if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_(.*)/', $key, $reg)) continue;
$listtmp=explode(',',$val);
$nb+=count($listtmp);
}
print $nb;
print '</td></tr>';
print '</table>';
@ -273,16 +282,21 @@ if ($result > 0)
foreach($conf->global as $key => $val)
{
if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_(.*)/', $key, $reg)) continue;
//print $key.' - '.$val.' - '.$reg[1].'<br>';
print '<tr '.$bc[$var].'><td>'.$val;
if (isValidEmail($val))
print '<tr '.$bc[$var].'><td>';
$listtmp=explode(',',$val);
foreach($listtmp as $keyemail => $valemail)
{
print ' &lt;'.$val.'&gt;';
}
else
{
$langs->load("errors");
print ' &nbsp; '.img_warning().' '.$langs->trans("ErrorBadEMail",$val);
$valemail=trim($valemail);
//print $keyemail.' - '.$valemail.' - '.$reg[1].'<br>';
if (isValidEmail($valemail))
{
print ' &lt;'.$valemail.'&gt;';
}
else
{
$langs->load("errors");
print ' &nbsp; '.img_warning().' '.$langs->trans("ErrorBadEMail",$valemail);
}
}
print '</td>';
print '<td>';