Fix info on email sent

This commit is contained in:
Laurent Destailleur 2018-01-29 12:46:07 +01:00
parent 424e8a3139
commit 0a11d52d53
3 changed files with 33 additions and 13 deletions

View File

@ -875,7 +875,16 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlright=''; $morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; $nbtry = $nbok = 0;
if ($object->statut == 2 || $object->statut == 3)
{
$nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko');
$morehtmlright.=' ('.$nbtry.'/'.$object->nbemail;
if ($nbko) $morehtmlright.=' - '.$nbko.' '.$langs->trans("Error");
$morehtmlright.=') &nbsp; ';
}
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
@ -907,7 +916,7 @@ else
if (is_numeric($nbemail)) if (is_numeric($nbemail))
{ {
$text=''; $text='';
if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2)) if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail)))
{ {
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
{ {

View File

@ -185,7 +185,16 @@ if ($object->fetch($id) >= 0)
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlright=''; $morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; $nbtry = $nbok = 0;
if ($object->statut == 2 || $object->statut == 3)
{
$nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko');
$morehtmlright.=' ('.$nbtry.'/'.$object->nbemail;
if ($nbko) $morehtmlright.=' - '.$nbko.' '.$langs->trans("Error");
$morehtmlright.=') &nbsp; ';
}
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
@ -210,7 +219,7 @@ if ($object->fetch($id) >= 0)
if (is_numeric($nbemail)) if (is_numeric($nbemail))
{ {
$text=''; $text='';
if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2)) if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail)))
{ {
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
{ {

View File

@ -485,7 +485,7 @@ class Mailing extends CommonObject
/** /**
* Count number of target with status * Count number of target with status
* *
* @param string $mode Mode ('alreadysent' = Sent success or error) * @param string $mode Mode ('alreadysent' = Sent success or error, 'alreadysentok' = Sent success, 'alreadysentko' = Sent error)
* @return int Nb of target with status * @return int Nb of target with status
*/ */
function countNbOfTargets($mode) function countNbOfTargets($mode)
@ -493,6 +493,8 @@ class Mailing extends CommonObject
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
$sql.= " WHERE fk_mailing = ".$this->id; $sql.= " WHERE fk_mailing = ".$this->id;
if ($mode == 'alreadysent') $sql.= " AND statut <> 0"; if ($mode == 'alreadysent') $sql.= " AND statut <> 0";
elseif ($mode == 'alreadysentok') $sql.= " AND statut > 0";
elseif ($mode == 'alreadysentko') $sql.= " AND statut = -1";
else else
{ {
$this->error='BadValueForParameterMode'; $this->error='BadValueForParameterMode';
@ -515,7 +517,7 @@ class Mailing extends CommonObject
/** /**
* Retourne le libelle du statut d'un mailing (brouillon, validee, ... * Return label of status of emailing (draft, validated, ...)
* *
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Label * @return string Label