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

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