2005-01-04 17:24:44 +01:00
|
|
|
|
<?php
|
|
|
|
|
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2005-01-09 19:30:34 +01:00
|
|
|
|
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
2005-01-04 17:24:44 +01:00
|
|
|
|
*
|
|
|
|
|
|
* 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
|
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
*
|
|
|
|
|
|
* $Id$
|
|
|
|
|
|
* $Source$
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2005-02-26 20:06:39 +01:00
|
|
|
|
/**
|
|
|
|
|
|
\file htdocs/comm/mailing/index.php
|
2005-05-14 02:36:01 +02:00
|
|
|
|
\ingroup mailing
|
2005-01-09 19:30:34 +01:00
|
|
|
|
\brief Page accueil de la zone mailing
|
|
|
|
|
|
\version $Revision$
|
2005-01-04 17:24:44 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
require("./pre.inc.php");
|
|
|
|
|
|
|
|
|
|
|
|
$langs->load("commercial");
|
|
|
|
|
|
$langs->load("orders");
|
|
|
|
|
|
|
2005-04-07 01:49:06 +02:00
|
|
|
|
$user->getrights("mailing");
|
|
|
|
|
|
|
|
|
|
|
|
if (! $user->rights->mailing->lire || $user->societe_id > 0)
|
|
|
|
|
|
accessforbidden();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-01-04 17:24:44 +01:00
|
|
|
|
llxHeader('','Mailing');
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2005-08-11 20:54:01 +02:00
|
|
|
|
print_fiche_titre($langs->trans("MailingArea"));
|
2005-01-04 17:24:44 +01:00
|
|
|
|
|
2005-08-11 20:54:01 +02:00
|
|
|
|
print '<table class="notopnoleftnoright" width="100%">';
|
2005-01-04 17:24:44 +01:00
|
|
|
|
|
2005-08-11 20:54:01 +02:00
|
|
|
|
print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
2005-01-04 17:24:44 +01:00
|
|
|
|
|
2005-05-14 02:36:01 +02:00
|
|
|
|
|
|
|
|
|
|
// Recherche emails
|
|
|
|
|
|
$var=false;
|
|
|
|
|
|
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/mailing/liste.php">';
|
|
|
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
|
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAMailing").'</td></tr>';
|
|
|
|
|
|
print '<tr '.$bc[$var].'><td nowrap>';
|
2005-08-25 18:55:11 +02:00
|
|
|
|
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sref" size="18"></td>';
|
|
|
|
|
|
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
|
|
|
|
|
print '<tr '.$bc[$var].'><td nowrap>';
|
|
|
|
|
|
print $langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
|
|
|
|
|
|
|
2005-05-14 02:36:01 +02:00
|
|
|
|
print "</table></form><br>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-02-12 18:41:13 +01:00
|
|
|
|
// Affiche stats de tous les modules de destinataires mailings
|
|
|
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
|
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("TargetsStatistics").'</td></tr>';
|
2005-01-04 17:24:44 +01:00
|
|
|
|
|
2005-02-12 18:41:13 +01:00
|
|
|
|
$dir=DOL_DOCUMENT_ROOT."/includes/modules/mailings";
|
|
|
|
|
|
$handle=opendir($dir);
|
2005-01-04 17:24:44 +01:00
|
|
|
|
|
2005-02-12 18:41:13 +01:00
|
|
|
|
$var=True;
|
|
|
|
|
|
while (($file = readdir($handle))!==false)
|
2005-01-04 17:24:44 +01:00
|
|
|
|
{
|
2005-02-12 18:41:13 +01:00
|
|
|
|
if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
2005-01-04 17:24:44 +01:00
|
|
|
|
{
|
2005-03-05 20:17:21 +01:00
|
|
|
|
if (eregi("(.*)\.(.*)\.(.*)",$file,$reg))
|
|
|
|
|
|
{
|
2005-02-12 18:41:13 +01:00
|
|
|
|
$modulename=$reg[1];
|
|
|
|
|
|
|
|
|
|
|
|
// Chargement de la classe
|
|
|
|
|
|
$file = $dir."/".$modulename.".modules.php";
|
|
|
|
|
|
$classname = "mailing_".$modulename;
|
|
|
|
|
|
require_once($file);
|
2005-03-05 20:17:21 +01:00
|
|
|
|
$mailmodule = new $classname($db);
|
2005-02-12 18:41:13 +01:00
|
|
|
|
|
2005-03-15 17:32:24 +01:00
|
|
|
|
$qualified=1;
|
|
|
|
|
|
foreach ($mailmodule->require_module as $key)
|
2005-02-12 18:41:13 +01:00
|
|
|
|
{
|
2005-03-15 17:32:24 +01:00
|
|
|
|
if (! $conf->$key->enabled || (! $user->admin && $mailmodule->require_admin))
|
2005-02-12 18:41:13 +01:00
|
|
|
|
{
|
2005-03-15 17:32:24 +01:00
|
|
|
|
$qualified=0;
|
|
|
|
|
|
//print "Les pr<70>requis d'activation du module mailing ne sont pas respect<63>s. Il ne sera pas actif";
|
|
|
|
|
|
break;
|
2005-03-05 20:17:21 +01:00
|
|
|
|
}
|
2005-03-15 17:32:24 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Si le module mailing est qualifi<66>
|
|
|
|
|
|
if ($qualified)
|
|
|
|
|
|
{
|
|
|
|
|
|
$var = !$var;
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($mailmodule->statssql as $sql)
|
2005-02-12 18:41:13 +01:00
|
|
|
|
{
|
2005-03-05 20:17:21 +01:00
|
|
|
|
print '<tr '.$bc[$var].'>';
|
|
|
|
|
|
|
|
|
|
|
|
$result=$db->query($sql);
|
|
|
|
|
|
if ($result)
|
|
|
|
|
|
{
|
|
|
|
|
|
$num = $db->num_rows($result);
|
|
|
|
|
|
|
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
|
|
|
|
while ($i < $num )
|
|
|
|
|
|
{
|
|
|
|
|
|
$obj = $db->fetch_object($result);
|
2005-09-16 00:44:29 +02:00
|
|
|
|
print '<td>'.img_object('',$mailmodule->picto).' '.$obj->label.'</td><td align="right">'.$obj->nb.'<td>';
|
2005-03-05 20:17:21 +01:00
|
|
|
|
$i++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$db->free($result);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
dolibarr_print_error($db);
|
|
|
|
|
|
}
|
|
|
|
|
|
print '</tr>';
|
2005-02-12 18:41:13 +01:00
|
|
|
|
}
|
2005-03-05 20:17:21 +01:00
|
|
|
|
}
|
2005-02-12 18:41:13 +01:00
|
|
|
|
}
|
2005-01-04 17:24:44 +01:00
|
|
|
|
}
|
2005-02-12 18:41:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
closedir($handle);
|
|
|
|
|
|
|
2005-01-04 17:24:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
2005-02-12 18:41:13 +01:00
|
|
|
|
print "</table><br>";
|
2005-01-04 17:24:44 +01:00
|
|
|
|
|
2005-08-11 20:54:01 +02:00
|
|
|
|
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
|
2005-01-04 17:24:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2005-02-12 18:41:13 +01:00
|
|
|
|
* Liste des derniers mailings
|
2005-01-04 17:24:44 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
2005-02-12 01:00:52 +01:00
|
|
|
|
$sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut";
|
2005-01-04 17:24:44 +01:00
|
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
|
2005-01-05 14:22:48 +01:00
|
|
|
|
$sql .= " LIMIT 10";
|
2005-02-26 20:06:39 +01:00
|
|
|
|
$result=$db->query($sql);
|
|
|
|
|
|
if ($result)
|
2005-01-04 17:24:44 +01:00
|
|
|
|
{
|
2005-02-26 20:06:39 +01:00
|
|
|
|
print '<table class="noborder" width="100%">';
|
2005-08-25 18:55:11 +02:00
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
|
print '<td colspan="2">'.$langs->trans("LastMailings",10).'</td>';
|
2005-09-16 00:44:29 +02:00
|
|
|
|
print '<td align="center">'.$langs->trans("NbOfEMails").'</td>';
|
2005-05-14 02:36:01 +02:00
|
|
|
|
print '<td align="center">'.$langs->trans("Status").'</td></tr>';
|
2005-02-26 20:06:39 +01:00
|
|
|
|
|
|
|
|
|
|
$num = $db->num_rows($result);
|
2005-01-04 17:24:44 +01:00
|
|
|
|
if ($num > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
$var = true;
|
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
|
|
|
|
while ($i < $num )
|
|
|
|
|
|
{
|
2005-02-26 20:06:39 +01:00
|
|
|
|
$obj = $db->fetch_object($result);
|
2005-01-04 17:24:44 +01:00
|
|
|
|
$var=!$var;
|
|
|
|
|
|
|
|
|
|
|
|
print "<tr $bc[$var]>";
|
2005-08-25 18:55:11 +02:00
|
|
|
|
print '<td><a href="fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowEMail"),"email").' '.$obj->rowid.'</a></td>';
|
|
|
|
|
|
print '<td>'.$obj->titre.'</td>';
|
2005-09-16 00:44:29 +02:00
|
|
|
|
print '<td align="center">'.($obj->nbemail?$obj->nbemail:"0").'</td>';
|
2005-02-12 01:00:52 +01:00
|
|
|
|
$mail=new Mailing($db);
|
|
|
|
|
|
print '<td align="center">'.$mail->statuts[$obj->statut].'</td>';
|
2005-01-29 01:57:06 +01:00
|
|
|
|
print '</tr>';
|
2005-01-04 17:24:44 +01:00
|
|
|
|
$i++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2005-02-26 20:06:39 +01:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<tr><td>'.$langs->trans("None").'</td></tr>';
|
|
|
|
|
|
}
|
|
|
|
|
|
print "</table><br>";
|
|
|
|
|
|
$db->free($result);
|
2005-01-04 17:24:44 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
dolibarr_print_error($db);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
|
|
|
|
|
|
$db->close();
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-05-14 00:43:56 +02:00
|
|
|
|
if ($langs->file_exists("html/spam.html",0)) {
|
2005-09-03 21:22:29 +02:00
|
|
|
|
print "<br><br><br><br>".$langs->trans("Note")."<br>";
|
2005-05-14 02:36:01 +02:00
|
|
|
|
print '<div style="padding: 4px; background: #FAFAFA; border: 1px solid #BBBBBB;" >';
|
2005-05-14 00:43:56 +02:00
|
|
|
|
$langs->print_file("html/spam.html",0);
|
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
|
|
print '<br>';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
llxFooter('$Date$ - $Revision$');
|
2005-01-04 17:24:44 +01:00
|
|
|
|
|
|
|
|
|
|
?>
|