mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-07 22:10:01 +01:00
fix error reported with the stylite tracker(#2447) cannot print mail, as rare setup prevented the access of a drafted message for printing (wrong folder selected)
This commit is contained in:
parent
9cd7b40add
commit
0a375be392
@ -114,13 +114,13 @@
|
||||
$formData['isDraft'] = 1;
|
||||
// pint the composed message. therefore save it as draft and reopen it as plain printwindow
|
||||
$formData['subject'] = "[".lang('printview').":]".$formData['subject'];
|
||||
$messageUid = $this->bocompose->saveAsDraft($formData);
|
||||
$messageUid = $this->bocompose->saveAsDraft($formData,$destinationFolder);
|
||||
if (!$messageUid) {
|
||||
print "<script type=\"text/javascript\">alert('".lang("Error: Could not save Message as Draft")."');</script>";
|
||||
return;
|
||||
}
|
||||
$uidisplay = CreateObject('felamimail.uidisplay');
|
||||
$uidisplay->printMessage($messageUid, $formData['printit']);
|
||||
$uidisplay->printMessage($messageUid, $formData['printit'],$destinationFolder);
|
||||
//$GLOBALS['egw']->link('/index.php',array('menuaction' => 'felamimail.uidisplay.printMessage','uid'=>$messageUid));
|
||||
return;
|
||||
}
|
||||
|
@ -1487,40 +1487,44 @@ pre {
|
||||
return $body;
|
||||
}
|
||||
|
||||
function printMessage($messageId = NULL, $callfromcompose = NULL)
|
||||
function printMessage($messageId = NULL, $callfromcompose = NULL, $mailFolder = '')
|
||||
{
|
||||
if (!empty($messageId) && empty($this->uid)) $this->uid = $messageId;
|
||||
$partID = $this->partID = $_GET['part'];
|
||||
// figure out which folder to select, can be passed by GET, preset by this->mailbox or passed by parameter
|
||||
if (!empty($_GET['folder'])) $this->mailbox = base64_decode($_GET['folder']);
|
||||
|
||||
//$transformdate =& CreateObject('felamimail.transformdate');
|
||||
//$htmlFilter =& CreateObject('felamimail.htmlfilter');
|
||||
//$uiWidgets =& CreateObject('felamimail.uiwidgets');
|
||||
// (regis) seems to be necessary to reopen...
|
||||
$folder = $this->mailbox;
|
||||
// the folder for callfromcompose is hardcoded, because the message to be printed from the compose window is saved as draft, and can be
|
||||
// reopened for composing (only) from there
|
||||
// mailFolder set but not existing, no use to be tried for message
|
||||
if (!empty($mailFolder) && !felamimail_bo::folderExists($mailFolder,true)) $mailFolder = '';
|
||||
// fall back to constructor/preset class var for folder, or use the passed parameter (which is validated by now for existance)
|
||||
if (empty($mailFolder)) $folder = $this->mailbox;
|
||||
else $folder = $mailFolder;
|
||||
// the folder for callfromcompose was hardcoded, because the message to be printed from the compose window is saved as draft,
|
||||
// within the configured draftfolder and can be reopened for composing (only) from there, we pass the folder used as
|
||||
// destinationFolder (by saveAsDraft) in mailFolder to pass it on now when comming from uicompose as special setups
|
||||
// broke the earlier assumption -> still no mailFolder, try to recover with the defaults
|
||||
if ($callfromcompose)
|
||||
{
|
||||
if (isset($this->mailPreferences->preferences['draftFolder']) &&
|
||||
$this->mailPreferences->preferences['draftFolder'] != 'none')
|
||||
{
|
||||
$folder = $this->mailPreferences->preferences['draftFolder'];
|
||||
if (empty($mailFolder)) $folder = $this->mailPreferences->preferences['draftFolder'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder = $GLOBALS['egw_info']['user']['preferences']['felamimail']['draftFolder'];
|
||||
if (empty($mailFolder)) $folder = $GLOBALS['egw_info']['user']['preferences']['felamimail']['draftFolder'];
|
||||
}
|
||||
}
|
||||
// it is necessary to reopen... to make sure you are within the folder the message is in
|
||||
//error_log(__METHOD__.__LINE__.$folder);
|
||||
$this->bofelamimail->reopen($folder);
|
||||
# print "$this->mailbox, $this->uid, $partID<br>";
|
||||
//print "$this->mailbox, $this->uid, $partID<br>";
|
||||
$headers = $this->bofelamimail->getMessageHeader($this->uid, $partID);
|
||||
$envelope = $this->bofelamimail->getMessageEnvelope($this->uid, $partID,true);
|
||||
# _debug_array($headers);exit;
|
||||
//_debug_array($headers);exit;
|
||||
$rawheaders = $this->bofelamimail->getMessageRawHeader($this->uid, $partID);
|
||||
$bodyParts = $this->bofelamimail->getMessageBody($this->uid,'',$partID);
|
||||
$attachments = $this->bofelamimail->getMessageAttachments($this->uid,$partID);
|
||||
# _debug_array($nextMessage); exit;
|
||||
//_debug_array($nextMessage); exit;
|
||||
|
||||
$webserverURL = $GLOBALS['egw_info']['server']['webserver_url'];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user