Fix: Attached files on orders

This commit is contained in:
Laurent Destailleur 2008-07-12 12:53:14 +00:00
parent 507d96ec25
commit 5bf4a7203e
2 changed files with 54 additions and 59 deletions

View File

@ -674,23 +674,18 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel'])
$actionmsg2=$langs->transnoentities('Action'.$actiontypecode); $actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
} }
// Get list of attached files // Create form object
$listofpaths=array(); include_once('../html.formmail.class.php');
$listofnames=array(); $formmail = new FormMail($db);
$listofmimes=array();
if (! empty($_SESSION["listofpaths"])) $listofpaths=split(';',$_SESSION["listofpaths"]); $attachedfiles=$formmail->get_attached_files();
if (! empty($_SESSION["listofnames"])) $listofnames=split(';',$_SESSION["listofnames"]); $filepath = $attachedfiles['paths'];
if (! empty($_SESSION["listofmimes"])) $listofmimes=split(';',$_SESSION["listofmimes"]); $filename = $attachedfiles['names'];
if (! empty($_FILES['addedfile']['tmp_name'])) $mimetype = $attachedfiles['mimes'];
{
$listofpaths[] = $_FILES['addedfile']['tmp_name'];
$listofnames[] = $_FILES['addedfile']['name'];
$listofmimes[] = $_FILES['addedfile']['type'];
}
// Send mail // Send mail
require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
$mailfile = new CMailFile($subject,$sendto,$from,$message,$listofpaths,$listofmimes,$listofnames,$sendtocc,'',$deliveryreceipt); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
if ($mailfile->error) if ($mailfile->error)
{ {
$mesg='<div class="error">'.$mailfile->error.'</div>'; $mesg='<div class="error">'.$mailfile->error.'</div>';
@ -1972,7 +1967,7 @@ else
$formmail->withto=$liste; $formmail->withto=$liste;
$formmail->withtocc=1; $formmail->withtocc=1;
$formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__'); $formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__');
$formmail->withfile=1; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;
$formmail->withdeliveryreceipt=1; $formmail->withdeliveryreceipt=1;
$formmail->withcancel=1; $formmail->withcancel=1;

View File

@ -1100,7 +1100,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
$filename = $attachedfiles['names']; $filename = $attachedfiles['names'];
$mimetype = $attachedfiles['mimes']; $mimetype = $attachedfiles['mimes'];
// Envoi de la facture // Send mail
require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
if ($mailfile->error) if ($mailfile->error)