applying system/default signature as default, when user has no signature assigned to user defined profile, and system signature is available.

This commit is contained in:
Klaus Leithoff 2010-04-06 15:39:09 +00:00
parent f654e9458e
commit 256e6ef220
2 changed files with 10 additions and 5 deletions

View File

@ -314,7 +314,7 @@
if(!empty($singleIdentity->default)) { if(!empty($singleIdentity->default)) {
#$defaultIdentity = $singleIdentity->id; #$defaultIdentity = $singleIdentity->id;
$defaultIdentity = $key; $defaultIdentity = $key;
$sessionData['signatureID'] = $singleIdentity->signature; $sessionData['signatureID'] = (!empty($singleIdentity->signature) ? $singleIdentity->signature : $sessionData['signatureID']);
} }
} }
$selectFrom = html::select('identity', ($presetId ? $presetId : $defaultIdentity), $identities, true, "style='width:100%;' onchange='changeIdentity(this);'"); $selectFrom = html::select('identity', ($presetId ? $presetId : $defaultIdentity), $identities, true, "style='width:100%;' onchange='changeIdentity(this);'");

View File

@ -297,10 +297,10 @@
if ($account2retrieve != 'new') { if ($account2retrieve != 'new') {
$accountData = $this->bopreferences->getAccountData($preferences, $account2retrieve); $accountData = $this->bopreferences->getAccountData($preferences, $account2retrieve);
$icServer =& $accountData['icServer']; $icServer =& $accountData['icServer'];
#_debug_array($icServer); //_debug_array($icServer);
$ogServer =& $accountData['ogServer']; $ogServer =& $accountData['ogServer'];
$identity =& $accountData['identity']; $identity =& $accountData['identity'];
#_debug_array($identity); //_debug_array($identity);
} }
if ($icServer) { if ($icServer) {
@ -346,10 +346,14 @@
$allSignatures = array( $allSignatures = array(
'-2' => lang('no signature') '-2' => lang('no signature')
); );
$systemsig = false;
foreach ($signatures as $sigkey => $sig) { foreach ($signatures as $sigkey => $sig) {
//echo "Keys to check: $sigkey with ".$sig['fm_signatureid']."<br>";
if ($sig['fm_signatureid'] == -1) $systemsig = true;
$allSignatures[$sig['fm_signatureid']] = $sig['fm_description']; $allSignatures[$sig['fm_signatureid']] = $sig['fm_description'];
} }
$sigvalue = -2; // if there is a system signature, then use the systemsignature as preset/default
$sigvalue = $defaultsig = ($systemsig ? -1 : -2);
if ($identity) { if ($identity) {
foreach($identity as $key => $value) { foreach($identity as $key => $value) {
if(is_object($value) || is_array($value)) { if(is_object($value) || is_array($value)) {
@ -357,7 +361,8 @@
} }
switch($key) { switch($key) {
case 'signature': case 'signature':
$sigvalue = $value; // if empty, use the default
$sigvalue = (!empty($value)?$value:$defaultsig);
break; break;
default: default:
$this->t->set_var("identity[$key]", $value); $this->t->set_var("identity[$key]", $value);