fix remainig issues with moving mail 2 archive; fix issue when using quick-move-actions (target folder not set)

This commit is contained in:
Klaus Leithoff 2016-04-29 13:19:32 +00:00
parent 31279adb44
commit 2a03cc7ca9
2 changed files with 16 additions and 4 deletions

View File

@ -912,7 +912,8 @@ class mail_ui
//error_log(__METHOD__.__LINE__."$i => $lastFolderUsedForMoveCont"); //error_log(__METHOD__.__LINE__."$i => $lastFolderUsedForMoveCont");
if (!empty($lastFolderUsedForMoveCont)) // only 10 entries per mailaccount.Control this on setting the buffered folders if (!empty($lastFolderUsedForMoveCont)) // only 10 entries per mailaccount.Control this on setting the buffered folders
{ {
$moveaction = 'move_'; $moveaction = 'move_'.$lastFolderUsedForMoveCont;
//error_log(__METHOD__.__LINE__.'#'.$moveaction);
$fS = array(); $fS = array();
$fS['profileID'] = $pid; $fS['profileID'] = $pid;
$fS['profileName'] = $accArray[$pid]; $fS['profileName'] = $accArray[$pid];
@ -4744,17 +4745,27 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
* @param array _folderName target folder * @param array _folderName target folder
* @param array _messageList list of UID's * @param array _messageList list of UID's
* @param string _copyOrMove method to use copy or move allowed * @param string _copyOrMove method to use copy or move allowed
* @param string _move2ArchiveMarker marker to indicate if a move 2 archive was triggered
* *
* @return xajax response * @return xajax response
*/ */
function ajax_copyMessages($_folderName, $_messageList, $_copyOrMove='copy') function ajax_copyMessages($_folderName, $_messageList, $_copyOrMove='copy', $_move2ArchiveMarker='_')
{ {
if(Mail::$debug) error_log(__METHOD__."->".$_folderName.':'.print_r($_messageList,true).' Method:'.$_copyOrMove); if(Mail::$debug) error_log(__METHOD__."->".$_folderName.':'.print_r($_messageList,true).' Method:'.$_copyOrMove.' ArchiveMarker:'.$_move2ArchiveMarker);
translation::add_app('mail'); translation::add_app('mail');
$_folderName = $this->mail_bo->decodeEntityFolderName($_folderName); $_folderName = $this->mail_bo->decodeEntityFolderName($_folderName);
// only copy or move are supported as method // only copy or move are supported as method
if (!($_copyOrMove=='copy' || $_copyOrMove=='move')) $_copyOrMove='copy'; if (!($_copyOrMove=='copy' || $_copyOrMove=='move')) $_copyOrMove='copy';
list($targetProfileID,$targetFolder) = explode(self::$delimiter,$_folderName,2); list($targetProfileID,$targetFolder) = explode(self::$delimiter,$_folderName,2);
// check if move2archive was called with the correct archiveFolder
$archiveFolder = $this->mail_bo->getArchiveFolder();
if ($_move2ArchiveMarker=='2' && $targetFolder != $archiveFolder)
{
error_log(__METHOD__.__LINE__."#Move to Archive called with:"."$targetProfileID,$targetFolder");
$targetProfileID = $this->mail_bo->profileID;
$targetFolder = $archiveFolder;
error_log(__METHOD__.__LINE__."#Fixed ArchiveFolder:"."$targetProfileID,$targetFolder");
}
$lastFoldersUsedForMoveCont = egw_cache::getCache(egw_cache::INSTANCE,'email','lastFolderUsedForMove'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*60*1); $lastFoldersUsedForMoveCont = egw_cache::getCache(egw_cache::INSTANCE,'email','lastFolderUsedForMove'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*60*1);
$changeFolderActions = false; $changeFolderActions = false;
//error_log(__METHOD__.__LINE__."#"."$targetProfileID,$targetFolder"); //error_log(__METHOD__.__LINE__."#"."$targetProfileID,$targetFolder");

View File

@ -3136,7 +3136,8 @@ app.classes.mail = AppJS.extend(
var self = this; var self = this;
var nm = this.et2.getWidgetById(this.nm_index); var nm = this.et2.getWidgetById(this.nm_index);
egw.json('mail.mail_ui.ajax_copyMessages',[target, messages, 'move'], function(){ // thev 4th param indicates if it is a normal move messages action. if not the action is a move2.... (archiveFolder) action
egw.json('mail.mail_ui.ajax_copyMessages',[target, messages, 'move', (_action.id.substr(0,4)=='move'&&_action.id.substr(4,1)=='2'?'2':'_') ], function(){
self.unlock_tree(); self.unlock_tree();
// Nextmatch automatically selects the next row and calls preview. // Nextmatch automatically selects the next row and calls preview.
// Unselect it and thanks to the timeout selectionMgr uses, preview // Unselect it and thanks to the timeout selectionMgr uses, preview