New: Can join files on emailing campaigns.
This commit is contained in:
parent
f6175c2213
commit
fd04ae0500
@ -3,6 +3,7 @@ English Dolibarr ChangeLog
|
|||||||
***** ChangeLog for 2.9 compared to 2.8 *****
|
***** ChangeLog for 2.9 compared to 2.8 *****
|
||||||
|
|
||||||
For users:
|
For users:
|
||||||
|
- New: Can join files on emailing campaigns.
|
||||||
- New: Add statistics on trips and expenses module.
|
- New: Add statistics on trips and expenses module.
|
||||||
- New: Can reopen a closed customer order.
|
- New: Can reopen a closed customer order.
|
||||||
- New: Add module externalsite to add a web site/tools inside
|
- New: Add module externalsite to add a web site/tools inside
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
require("../../main.inc.php");
|
require("../../main.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/emailing.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/emailing.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/comm/mailing/mailing.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/comm/mailing/mailing.class.php");
|
||||||
@ -105,6 +106,8 @@ if ($_REQUEST["action"] == 'sendallconfirmed' && $_REQUEST['confirm'] == 'yes')
|
|||||||
$mil=new Mailing($db);
|
$mil=new Mailing($db);
|
||||||
$result=$mil->fetch($_REQUEST['id']);
|
$result=$mil->fetch($_REQUEST['id']);
|
||||||
|
|
||||||
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($mil->id,2,0,1);
|
||||||
|
|
||||||
if ($mil->statut == 0)
|
if ($mil->statut == 0)
|
||||||
{
|
{
|
||||||
dol_print_error('','ErrorMailIsNotValidated');
|
dol_print_error('','ErrorMailIsNotValidated');
|
||||||
@ -186,10 +189,26 @@ if ($_REQUEST["action"] == 'sendallconfirmed' && $_REQUEST['confirm'] == 'yes')
|
|||||||
$newsubject=make_substitutions($subject,$substitutionarray,$langs);
|
$newsubject=make_substitutions($subject,$substitutionarray,$langs);
|
||||||
$newmessage=make_substitutions($message,$substitutionarray,$langs);
|
$newmessage=make_substitutions($message,$substitutionarray,$langs);
|
||||||
|
|
||||||
|
$arr_file = array();
|
||||||
|
$arr_mime = array();
|
||||||
|
$arr_name = array();
|
||||||
|
$arr_css = array();
|
||||||
|
|
||||||
|
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,1);
|
||||||
|
if (sizeof($listofpaths))
|
||||||
|
{
|
||||||
|
foreach($listofpaths as $key => $val)
|
||||||
|
{
|
||||||
|
$arr_file[]=$listofpaths[$key]['fullname'];
|
||||||
|
$arr_mime[]=dol_mimetype($listofpaths[$key]['name']);
|
||||||
|
$arr_name[]=$listofpaths[$key]['name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fabrication du mail
|
// Fabrication du mail
|
||||||
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage,
|
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage,
|
||||||
array(), array(), array(),
|
$arr_file, $arr_mime, $arr_name,
|
||||||
'', '', 0, $msgishtml, $errorsto);
|
'', '', 0, $msgishtml, $errorsto, $arr_css);
|
||||||
|
|
||||||
if ($mail->error)
|
if ($mail->error)
|
||||||
{
|
{
|
||||||
@ -278,6 +297,8 @@ if ($_POST["action"] == 'send' && empty($_POST["cancel"]))
|
|||||||
$mil = new Mailing($db);
|
$mil = new Mailing($db);
|
||||||
$result=$mil->fetch($_POST["mailid"]);
|
$result=$mil->fetch($_POST["mailid"]);
|
||||||
|
|
||||||
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($mil->id,2,0,1);
|
||||||
|
|
||||||
$mil->sendto = $_POST["sendto"];
|
$mil->sendto = $_POST["sendto"];
|
||||||
if (! $mil->sendto)
|
if (! $mil->sendto)
|
||||||
{
|
{
|
||||||
@ -285,11 +306,6 @@ if ($_POST["action"] == 'send' && empty($_POST["cancel"]))
|
|||||||
}
|
}
|
||||||
if ($mil->sendto)
|
if ($mil->sendto)
|
||||||
{
|
{
|
||||||
$arr_file = array();
|
|
||||||
$arr_mime = array();
|
|
||||||
$arr_name = array();
|
|
||||||
$arr_css = array();
|
|
||||||
|
|
||||||
// Ajout CSS
|
// Ajout CSS
|
||||||
if (!empty($mil->bgcolor)) $arr_css['bgcolor'] = $mil->bgcolor;
|
if (!empty($mil->bgcolor)) $arr_css['bgcolor'] = $mil->bgcolor;
|
||||||
if (!empty($mil->bgimage)) $arr_css['bgimage'] = $mil->bgimage;
|
if (!empty($mil->bgimage)) $arr_css['bgimage'] = $mil->bgimage;
|
||||||
@ -302,6 +318,23 @@ if ($_POST["action"] == 'send' && empty($_POST["cancel"]))
|
|||||||
$mil->sujet=make_substitutions($mil->sujet,$substitutionarrayfortest,$langs);
|
$mil->sujet=make_substitutions($mil->sujet,$substitutionarrayfortest,$langs);
|
||||||
$mil->body=make_substitutions($mil->body,$substitutionarrayfortest,$langs);
|
$mil->body=make_substitutions($mil->body,$substitutionarrayfortest,$langs);
|
||||||
|
|
||||||
|
$arr_file = array();
|
||||||
|
$arr_mime = array();
|
||||||
|
$arr_name = array();
|
||||||
|
$arr_css = array();
|
||||||
|
|
||||||
|
// Attached files
|
||||||
|
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,1);
|
||||||
|
if (sizeof($listofpaths))
|
||||||
|
{
|
||||||
|
foreach($listofpaths as $key => $val)
|
||||||
|
{
|
||||||
|
$arr_file[]=$listofpaths[$key]['fullname'];
|
||||||
|
$arr_mime[]=dol_mimetype($listofpaths[$key]['name']);
|
||||||
|
$arr_name[]=$listofpaths[$key]['name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$mailfile = new CMailFile($mil->sujet,$mil->sendto,$mil->email_from,$mil->body,
|
$mailfile = new CMailFile($mil->sujet,$mil->sendto,$mil->email_from,$mil->body,
|
||||||
$arr_file,$arr_mime,$arr_name,'', '', 0, $msgishtml,$mil->email_errorsto,$arr_css);
|
$arr_file,$arr_mime,$arr_name,'', '', 0, $msgishtml,$mil->email_errorsto,$arr_css);
|
||||||
|
|
||||||
@ -360,6 +393,8 @@ if ($_REQUEST["action"] == 'setdesc' || $_REQUEST["action"] == 'setfrom' || $_RE
|
|||||||
$mil = new Mailing($db);
|
$mil = new Mailing($db);
|
||||||
$mil->fetch($_POST["id"]);
|
$mil->fetch($_POST["id"]);
|
||||||
|
|
||||||
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($mil->id,2,0,1);
|
||||||
|
|
||||||
if ($_REQUEST["action"] == 'setdesc') $mil->titre = trim($_REQUEST["desc"]);
|
if ($_REQUEST["action"] == 'setdesc') $mil->titre = trim($_REQUEST["desc"]);
|
||||||
if ($_REQUEST["action"] == 'setfrom') $mil->email_from = trim($_REQUEST["from"]);
|
if ($_REQUEST["action"] == 'setfrom') $mil->email_from = trim($_REQUEST["from"]);
|
||||||
if ($_REQUEST["action"] == 'setreplyto') $mil->email_replyto = trim($_REQUEST["replyto"]);
|
if ($_REQUEST["action"] == 'setreplyto') $mil->email_replyto = trim($_REQUEST["replyto"]);
|
||||||
@ -384,11 +419,74 @@ if ($_REQUEST["action"] == 'setdesc' || $_REQUEST["action"] == 'setfrom' || $_RE
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Action update emailing
|
// Action update emailing
|
||||||
if ($_POST["action"] == 'update' && empty($_POST["cancel"]))
|
if (! empty($_POST["removedfile"]))
|
||||||
{
|
{
|
||||||
$mil = new Mailing($db);
|
$mil = new Mailing($db);
|
||||||
$mil->fetch($_POST["id"]);
|
$mil->fetch($_POST["id"]);
|
||||||
|
|
||||||
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($mil->id,2,0,1);
|
||||||
|
|
||||||
|
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,1);
|
||||||
|
|
||||||
|
// Remove file
|
||||||
|
$filenb=($_POST["removedfile"]-1);
|
||||||
|
if (isset($listofpaths[$filenb]))
|
||||||
|
{
|
||||||
|
$result=dol_delete_file($listofpaths[$filenb]['fullname'],1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$_GET["action"]="edit";
|
||||||
|
$_GET["id"]=$_POST["id"];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action update emailing
|
||||||
|
if ($_POST["action"] == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"]))
|
||||||
|
{
|
||||||
|
$mil = new Mailing($db);
|
||||||
|
$mil->fetch($_POST["id"]);
|
||||||
|
|
||||||
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($mil->id,2,0,1);
|
||||||
|
|
||||||
|
$isupload=0;
|
||||||
|
|
||||||
|
// If upload file
|
||||||
|
$i='';
|
||||||
|
//$i=0;
|
||||||
|
//while ($i < 4)
|
||||||
|
//{
|
||||||
|
if (! empty($_POST["addfile".$i]) && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||||
|
{
|
||||||
|
$isupload=1;
|
||||||
|
|
||||||
|
if (! is_dir($upload_dir)) create_exdir($upload_dir);
|
||||||
|
|
||||||
|
if (is_dir($upload_dir))
|
||||||
|
{
|
||||||
|
$result = dol_move_uploaded_file($_FILES['addedfile'.$i]['tmp_name'], $upload_dir . "/" . $_FILES['addedfile'.$i]['name'],1);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||||
|
//print_r($_FILES);
|
||||||
|
}
|
||||||
|
else if ($result == -99)
|
||||||
|
{
|
||||||
|
// Files infected by a virus
|
||||||
|
$langs->load("errors");
|
||||||
|
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>';
|
||||||
|
}
|
||||||
|
else if ($result < 0)
|
||||||
|
{
|
||||||
|
// Echec transfert (fichier depassant la limite ?)
|
||||||
|
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
|
||||||
|
// print_r($_FILES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// $i++;
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (! $isupload)
|
||||||
|
{
|
||||||
$mil->sujet = trim($_POST["sujet"]);
|
$mil->sujet = trim($_POST["sujet"]);
|
||||||
$mil->body = trim($_POST["body"]);
|
$mil->body = trim($_POST["body"]);
|
||||||
$mil->bgcolor = trim($_POST["bgcolor"]);
|
$mil->bgcolor = trim($_POST["bgcolor"]);
|
||||||
@ -410,6 +508,12 @@ if ($_POST["action"] == 'update' && empty($_POST["cancel"]))
|
|||||||
$message='<div class="error">'.$message.'</div>';
|
$message='<div class="error">'.$message.'</div>';
|
||||||
$_GET["action"]="edit";
|
$_GET["action"]="edit";
|
||||||
$_GET["id"]=$_POST["id"];
|
$_GET["id"]=$_POST["id"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$_GET["action"]="edit";
|
||||||
|
$_GET["id"]=$_POST["id"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action confirmation validation
|
// Action confirmation validation
|
||||||
@ -568,6 +672,8 @@ else
|
|||||||
{
|
{
|
||||||
if ($mil->fetch($_GET["id"]) >= 0)
|
if ($mil->fetch($_GET["id"]) >= 0)
|
||||||
{
|
{
|
||||||
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($mil->id,2,0,1);
|
||||||
|
|
||||||
$head = emailing_prepare_head($mil);
|
$head = emailing_prepare_head($mil);
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email');
|
dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email');
|
||||||
@ -787,15 +893,30 @@ else
|
|||||||
print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td colspan="3">'.$mil->sujet.'</td></tr>';
|
print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td colspan="3">'.$mil->sujet.'</td></tr>';
|
||||||
|
|
||||||
// Mails
|
// Mails
|
||||||
/*
|
$i='';
|
||||||
$i=0;
|
//$i=0;
|
||||||
while ($i < 4)
|
//while ($i < 4)
|
||||||
|
//{
|
||||||
|
// $i++;
|
||||||
|
//$property='joined_file'.$i;
|
||||||
|
print '<tr><td>'.$langs->trans("MailFile").' '.$i.'</td><td colspan="3">';
|
||||||
|
// List of files
|
||||||
|
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,1);
|
||||||
|
if (sizeof($listofpaths))
|
||||||
{
|
{
|
||||||
$i++;
|
foreach($listofpaths as $key => $val)
|
||||||
$property='joined_file'.$i;
|
{
|
||||||
print '<tr><td>'.$langs->trans("MailFile").' '.$i.'</td><td colspan="3">'.$mil->$property.'</td></tr>';
|
print img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name'];
|
||||||
|
//print ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key+1).'" name="removedfile">';
|
||||||
|
print '<br>';
|
||||||
}
|
}
|
||||||
*/
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("NoAttachedFiles").'<br>';
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
//}
|
||||||
|
|
||||||
// Message
|
// Message
|
||||||
print '<tr><td valign="top">'.$langs->trans("MailMessage").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("MailMessage").'</td>';
|
||||||
@ -819,8 +940,8 @@ else
|
|||||||
|
|
||||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'.$mil->id.'</td></tr>';
|
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'.$mil->id.'</td></tr>';
|
||||||
print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$mil->titre.'</td></tr>';
|
print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$mil->titre.'</td></tr>';
|
||||||
print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($mil->email_from,0,0,1).'</td></tr>';
|
print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($mil->email_from,0,0,0,0,1).'</td></tr>';
|
||||||
print '<tr><td width="25%">'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($mil->email_errorsto,0,0,1).'</td></tr>';
|
print '<tr><td width="25%">'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($mil->email_errorsto,0,0,0,0,1).'</td></tr>';
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
print '<tr><td width="25%">'.$langs->trans("Status").'</td><td colspan="3">'.$mil->getLibStatut(4).'</td></tr>';
|
print '<tr><td width="25%">'.$langs->trans("Status").'</td><td colspan="3">'.$mil->getLibStatut(4).'</td></tr>';
|
||||||
@ -844,8 +965,8 @@ else
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|
||||||
|
print "\n";
|
||||||
print '<form name="edit_mailing" action="fiche.php" method="post">'."\n";
|
print '<form name="edit_mailing" action="fiche.php" method="post" enctype="multipart/form-data">'."\n";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<input type="hidden" name="id" value="'.$mil->id.'">';
|
print '<input type="hidden" name="id" value="'.$mil->id.'">';
|
||||||
@ -857,20 +978,38 @@ else
|
|||||||
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat" type="text" size=60 name="sujet" value="'.$mil->sujet.'"></td></tr>';
|
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat" type="text" size=60 name="sujet" value="'.$mil->sujet.'"></td></tr>';
|
||||||
|
|
||||||
// Add joined files
|
// Add joined files
|
||||||
/* $i=0;
|
$i='';
|
||||||
while ($i < 4)
|
//$i=0;
|
||||||
{
|
//while ($i < 4)
|
||||||
$i++;
|
//{
|
||||||
$property='joined_file'.$i;
|
// $i++;
|
||||||
|
//$property='joined_file'.$i;
|
||||||
print '<tr><td>'.$langs->trans("MailFile").' '.$i.'</td>';
|
print '<tr><td>'.$langs->trans("MailFile").' '.$i.'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
print '<input type="file" class="flat" name="addedfile" value="'.$langs->trans("Upload").'"/>';
|
// List of files
|
||||||
print ' ';
|
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,1);
|
||||||
print '<input type="submit" class="button" name="'.$addfileaction.'" value="'.$langs->trans("MailingAddFile").'">';
|
if (sizeof($listofpaths))
|
||||||
print $mil->$property?'<br>'.$mil->$property:'';
|
{
|
||||||
print '</td></tr>';
|
foreach($listofpaths as $key => $val)
|
||||||
|
{
|
||||||
|
print img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name'];
|
||||||
|
print ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key+1).'" name="removedfile">';
|
||||||
|
print '<br>';
|
||||||
}
|
}
|
||||||
*/
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("NoAttachedFiles").'<br>';
|
||||||
|
}
|
||||||
|
// Add link to add file
|
||||||
|
print '<input type="file" class="flat" name="addedfile'.$i.'" value="'.$langs->trans("Upload").'"/>';
|
||||||
|
print ' ';
|
||||||
|
print '<input type="submit" class="button" name="addfile'.$i.'" value="'.$langs->trans("MailingAddFile").'">';
|
||||||
|
//print $mil->$property?'<br>'.$mil->$property:'';
|
||||||
|
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
|
//}
|
||||||
|
|
||||||
print '<tr><td width="25%">'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
|
print '<tr><td width="25%">'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
|
||||||
$htmlother->select_color($mil->bgcolor,'bgcolor','edit_mailing');
|
$htmlother->select_color($mil->bgcolor,'bgcolor','edit_mailing');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user