Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0

Conflicts:
	htdocs/core/actions_sendmails.inc.php
This commit is contained in:
Laurent Destailleur
2016-09-26 14:10:39 +02:00
2 changed files with 21 additions and 21 deletions

View File

@@ -88,11 +88,11 @@ if (GETPOST('removAll'))
{ {
$pathtodelete = $value; $pathtodelete = $value;
$filetodelete = $listofnames[$key]; $filetodelete = $listofnames[$key];
$result = dol_delete_file($pathtodelete,1); // Delete uploded Files $result = dol_delete_file($pathtodelete,1); // Delete uploded Files
$langs->load("other"); $langs->load("other");
setEventMessages($langs->trans("FileWasRemoved",$filetodelete), null, 'mesgs'); setEventMessages($langs->trans("FileWasRemoved",$filetodelete), null, 'mesgs');
$formmail->remove_attached_files($key); // Update Session $formmail->remove_attached_files($key); // Update Session
} }
} }
@@ -253,35 +253,35 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$mailboxconfig = new IMAP($db); $mailboxconfig = new IMAP($db);
$mailboxconfig->fetch($mbid); $mailboxconfig->fetch($mbid);
if ($mailboxconfig->mailbox_imap_host) $ref=$mailboxconfig->get_ref(); if ($mailboxconfig->mailbox_imap_host) $ref=$mailboxconfig->get_ref();
$mailboxconfig->folder_id=$mailboxconfig->mailbox_imap_outbox; $mailboxconfig->folder_id=$mailboxconfig->mailbox_imap_outbox;
$mailboxconfig->userfolder_fetch(); $mailboxconfig->userfolder_fetch();
if ($mailboxconfig->mailbox_save_sent_mails == 1) if ($mailboxconfig->mailbox_save_sent_mails == 1)
{ {
$folder=str_replace($ref, '', $mailboxconfig->folder_cache_key); $folder=str_replace($ref, '', $mailboxconfig->folder_cache_key);
if (!$folder) $folder = "Sent"; // Default Sent folder if (!$folder) $folder = "Sent"; // Default Sent folder
$mailboxconfig->mbox = imap_open($mailboxconfig->get_connector_url().$folder, $mailboxconfig->mailbox_imap_login, $mailboxconfig->mailbox_imap_password); $mailboxconfig->mbox = imap_open($mailboxconfig->get_connector_url().$folder, $mailboxconfig->mailbox_imap_login, $mailboxconfig->mailbox_imap_password);
if (FALSE === $mailboxconfig->mbox) if (FALSE === $mailboxconfig->mbox)
{ {
$info = FALSE; $info = FALSE;
$err = $langs->trans('Error3_Imap_Connection_Error'); $err = $langs->trans('Error3_Imap_Connection_Error');
setEventMessages($err,$mailboxconfig->element, null, 'errors'); setEventMessages($err,$mailboxconfig->element, null, 'errors');
} }
else else
{ {
$mailboxconfig->mailboxid=$_POST['frommail']; $mailboxconfig->mailboxid=$_POST['frommail'];
$mailboxconfig->foldername=$folder; $mailboxconfig->foldername=$folder;
$from = $mailfromid[0] . $mailfromid[2]; $from = $mailfromid[0] . $mailfromid[2];
$imap=1; $imap=1;
} }
} }
} }
} }
// Send mail // Send mail
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid);
@@ -296,7 +296,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if ($result) if ($result)
{ {
$error=0; $error=0;
// FIXME This must be moved into a trigger for action $trigger_name // FIXME This must be moved into a trigger for action $trigger_name
if (! empty($conf->dolimail->enabled)) if (! empty($conf->dolimail->enabled))
{ {
@@ -307,13 +307,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$dolimail=new DoliMail($db); $dolimail=new DoliMail($db);
$dolimail->id = $mid; $dolimail->id = $mid;
$res=$dolimail->set_prop($user, 'answered',1); $res=$dolimail->set_prop($user, 'answered',1);
} }
if ($imap==1) if ($imap==1)
{ {
// write mail to IMAP Server // write mail to IMAP Server
$movemail = $mailboxconfig->putMail($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$folder,$deliveryreceipt,$mailfile); $movemail = $mailboxconfig->putMail($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$folder,$deliveryreceipt,$mailfile);
if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs'); if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs');
else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings'); else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
} }
} }
@@ -331,7 +331,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf); $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
if ($result < 0) { if ($result < 0) {
$error++; $this->errors=$interface->errors; $error++; $errors=$interface->errors;
} }
// End call of triggers // End call of triggers
@@ -345,8 +345,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// This avoid sending mail twice if going out and then back to page // This avoid sending mail twice if going out and then back to page
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
setEventMessages($mesg, null, 'mesgs'); setEventMessages($mesg, null, 'mesgs');
if($conf->dolimail->enabled) header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id.'&'.($paramname2?$paramname2:'mid').'='.$parm2val); if ($conf->dolimail->enabled) header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id.'&'.($paramname2?$paramname2:'mid').'='.$parm2val);
else header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id); else header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id);
exit; exit;
} }
} }

View File

@@ -5411,7 +5411,7 @@ function printCommonFooter($zone='private')
print 'window.console && console.log("'; print 'window.console && console.log("';
if (! empty($conf->global->MEMCACHED_SERVER)) print 'MEMCACHED_SERVER='.$conf->global->MEMCACHED_SERVER.' - '; if (! empty($conf->global->MEMCACHED_SERVER)) print 'MEMCACHED_SERVER='.$conf->global->MEMCACHED_SERVER.' - ';
print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED)?$conf->global->MAIN_OPTIMIZE_SPEED:'off'); print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED)?$conf->global->MAIN_OPTIMIZE_SPEED:'off');
if ($micro_start_time) if (! empty($micro_start_time)) // Works only if MAIN_SHOW_TUNING_INFO is defined at $_SERVER level. Not in global variable.
{ {
$micro_end_time = microtime(true); $micro_end_time = microtime(true);
print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms'; print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms';