From: <lei...@us...> - 2011-04-29 08:23:53
|
Author: leithoff Date: Fri Apr 29 10:23:46 2011 New Revision: 34805 URL: http://www.egroupware.org/viewvc/egroupware?rev=34805&view=rev Log: make sure the prefs are up to date for the profile to load Modified: trunk/felamimail/inc/class.bopreferences.inc.php trunk/felamimail/inc/class.felamimail_bo.inc.php Modified: trunk/felamimail/inc/class.bopreferences.inc.php URL: http://www.egroupware.org/viewvc/egroupware/trunk/felamimail/inc/class.bopreferences.inc.php?rev=34805&r1=34804&r2=34805&view=diff ============================================================================== --- trunk/felamimail/inc/class.bopreferences.inc.php (original) +++ trunk/felamimail/inc/class.bopreferences.inc.php Fri Apr 29 10:23:46 2011 @@ -214,9 +214,10 @@ * getPreferences - fetches the active profile for a user * * @param boolean $getUserDefinedProfiles + * @param int $_profileID - use this profile to be set its prefs as active profile (0) * @return object ea_preferences object with the active emailprofile set to ID = 0 */ - function getPreferences($getUserDefinedProfiles=true) + function getPreferences($getUserDefinedProfiles=true,$_profileID=0) { if (isset($this->sessionData['profileData']) && is_a($this->sessionData['profileData'],'ea_preferences')) { @@ -266,8 +267,17 @@ if(is_a($accountData['identity'],'ea_identity')) $profileData->setIdentity($profileData->identities[$icProfileID],$k); - - if($accountData['active']) + if (empty($_profileID)) + { + $setAsActive = $accountData['active']; + if($setAsActive) error_log(__METHOD__.__LINE__." Setting Profile with ID=$k (using Active Info) for ActiveProfile"); + } + else + { + $setAsActive = ($_profileID==$k); + if($setAsActive) error_log(__METHOD__.__LINE__." Setting Profile with ID=$_profileID for ActiveProfile"); + } + if($setAsActive) { // replace the global defined IMAP Server if(is_a($accountData['icServer'],'defaultimap')) Modified: trunk/felamimail/inc/class.felamimail_bo.inc.php URL: http://www.egroupware.org/viewvc/egroupware/trunk/felamimail/inc/class.felamimail_bo.inc.php?rev=34805&r1=34804&r2=34805&view=diff ============================================================================== --- trunk/felamimail/inc/class.felamimail_bo.inc.php (original) +++ trunk/felamimail/inc/class.felamimail_bo.inc.php Fri Apr 29 10:23:46 2011 @@ -110,6 +110,19 @@ { self::$instances[$_profileID] = new felamimail_bo('utf-8',$_restoreSession,$_profileID); } + else + { + // make sure the prefs are up to date for the profile to load + self::$instances[$_profileID]->mailPreferences = self::$instances[$_profileID]->bopreferences->getPreferences(true,$_profileID); + //error_log(__METHOD__.__LINE__." ReRead the Prefs for ProfileID ".$_profileID.' called from:'.function_backtrace()); + if (self::$instances[$_profileID]->mailPreferences) { + self::$instances[$_profileID]->icServer = self::$instances[$_profileID]->mailPreferences->getIncomingServer($_profileID); + if ($_profileID != 0) self::$instances[$_profileID]->mailPreferences->setIncomingServer(self::$instances[$_profileID]->icServer,0); + self::$instances[$_profileID]->ogServer = self::$instances[$_profileID]->mailPreferences->getOutgoingServer($_profileID); + if ($_profileID != 0) self::$instances[$_profileID]->mailPreferences->setOutgoingServer(self::$instances[$_profileID]->ogServer,0); + self::$instances[$_profileID]->htmlOptions = self::$instances[$_profileID]->mailPreferences->preferences['htmlOptions']; + } + } self::$instances[$_profileID]->profileID = $_profileID; //error_log(__METHOD__.__LINE__.' RestoreSession:'.$_restoreSession.' ProfileId:'.$_profileID); return self::$instances[$_profileID]; @@ -147,7 +160,7 @@ $this->bopreferences = CreateObject('felamimail.bopreferences',$_restoreSession); - $this->mailPreferences = $this->bopreferences->getPreferences(); + $this->mailPreferences = $this->bopreferences->getPreferences(true,$this->profileID); //error_log(__METHOD__.__LINE__." ProfileID ".$this->profileID.' called from:'.function_backtrace()); if ($this->mailPreferences) { $this->icServer = $this->mailPreferences->getIncomingServer($this->profileID); |