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

@ -482,7 +482,7 @@ if ($_GET['action'] == 'modif' && $user->rights->commande->creer)
$commande->set_draft($user);
$result = $commande->set_draft($user);
if ($result >= 0)
if ($result >= 0)
{ //regeneration pdf
if ($_REQUEST['lang_id'])
{
@ -674,23 +674,18 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel'])
$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
}
// Get list of attached files
$listofpaths=array();
$listofnames=array();
$listofmimes=array();
if (! empty($_SESSION["listofpaths"])) $listofpaths=split(';',$_SESSION["listofpaths"]);
if (! empty($_SESSION["listofnames"])) $listofnames=split(';',$_SESSION["listofnames"]);
if (! empty($_SESSION["listofmimes"])) $listofmimes=split(';',$_SESSION["listofmimes"]);
if (! empty($_FILES['addedfile']['tmp_name']))
{
$listofpaths[] = $_FILES['addedfile']['tmp_name'];
$listofnames[] = $_FILES['addedfile']['name'];
$listofmimes[] = $_FILES['addedfile']['type'];
}
// Create form object
include_once('../html.formmail.class.php');
$formmail = new FormMail($db);
$attachedfiles=$formmail->get_attached_files();
$filepath = $attachedfiles['paths'];
$filename = $attachedfiles['names'];
$mimetype = $attachedfiles['mimes'];
// Send mail
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)
{
$mesg='<div class="error">'.$mailfile->error.'</div>';
@ -1972,7 +1967,7 @@ else
$formmail->withto=$liste;
$formmail->withtocc=1;
$formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__');
$formmail->withfile=1;
$formmail->withfile=2;
$formmail->withbody=1;
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;

View File

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