Support moving from different folders

This commit is contained in:
Nathan Gray 2014-11-19 19:12:50 +00:00
parent 103c0c73ad
commit a885057213

View File

@ -4608,15 +4608,24 @@ class mail_ui
} }
} }
else else
{
$messageList = array();
while(count($_messageList['msg']) > 0)
{ {
$uidA = self::splitRowID($_messageList['msg'][0]); $uidA = self::splitRowID($_messageList['msg'][0]);
$folder = $uidA['folder']; // all messages in one set are supposed to be within the same folder $folder = $uidA['folder']; // all messages in one set are supposed to be within the same folder
$sourceProfileID = $uidA['profileID']; $sourceProfileID = $uidA['profileID'];
$moveList = array();
foreach($_messageList['msg'] as $rowID) foreach($_messageList['msg'] as $rowID)
{ {
//error_log(__METHOD__.__LINE__.$rowID);
$hA = self::splitRowID($rowID); $hA = self::splitRowID($rowID);
// If folder changes, stop and move what we've got
if($hA['folder'] != $folder) break;
array_shift($_messageList['msg']);
$messageList[] = $hA['msgUID']; $messageList[] = $hA['msgUID'];
$moveList[] = $hA['msgUID'];
if ($_copyOrMove=='move') if ($_copyOrMove=='move')
{ {
$helpvar = explode(self::$delimiter,$rowID); $helpvar = explode(self::$delimiter,$rowID);
@ -4626,14 +4635,15 @@ class mail_ui
} }
try try
{ {
//error_log(__METHOD__.__LINE__."->".print_r($messageList,true).' folder:'.$folder.' Method:'.$_forceDeleteMethod.' '.$targetProfileID.'/'.$sourceProfileID); //error_log(__METHOD__.__LINE__."->".print_r($moveList,true).' folder:'.$folder.' Method:'.$_forceDeleteMethod.' '.$targetProfileID.'/'.$sourceProfileID);
$this->mail_bo->moveMessages($targetFolder,$messageList,($_copyOrMove=='copy'?false:true),$folder,false,$sourceProfileID,($targetProfileID!=$sourceProfileID?$targetProfileID:null)); $this->mail_bo->moveMessages($targetFolder,$moveList,($_copyOrMove=='copy'?false:true),$folder,false,$sourceProfileID,($targetProfileID!=$sourceProfileID?$targetProfileID:null));
} }
catch (egw_exception $e) catch (egw_exception $e)
{ {
$error = str_replace('"',"'",$e->getMessage()); $error = str_replace('"',"'",$e->getMessage());
} }
} }
}
$response = egw_json_response::get(); $response = egw_json_response::get();
if ($error) if ($error)