some bugfixes:

- InfoLogs create via the addressbook show the address as Contact again
- Mail --> InfoLog creates address as Contact now
This commit is contained in:
Ralf Becker 2006-10-17 07:13:12 +00:00
parent c207eb47f9
commit 1707c87d89
2 changed files with 14 additions and 28 deletions

View File

@ -729,7 +729,6 @@ class boinfolog
trim($address->host)); trim($address->host));
$name[] = !empty($address->personal) ? $address->personal : $emailadr; $name[] = !empty($address->personal) ? $address->personal : $emailadr;
} }
$info = array( $info = array(
'info_id' => 0, 'info_id' => 0,
'info_type' => isset($this->enums['type']['email']) ? 'email' : 'note', 'info_type' => isset($this->enums['type']['email']) ? 'email' : 'note',
@ -747,7 +746,6 @@ class boinfolog
'to_id' => 0, 'to_id' => 0,
), ),
); );
// find the addressbookentry to link with // find the addressbookentry to link with
$addressbook =& CreateObject('addressbook.bocontacts'); $addressbook =& CreateObject('addressbook.bocontacts');
$contacts = array(); $contacts = array();
@ -759,28 +757,32 @@ class boinfolog
'email_home' => $mailadr 'email_home' => $mailadr
),True,'','','',false,'OR',false,null,'',false)); ),True,'','','',false,'OR',false,null,'',false));
} }
if (!$contacts || !is_array($contacts) || !is_array($contacts[0]))
if (empty($contacts) || empty($contacts[0]))
{ {
$info['msg'] = lang('Attension: No Contact with address %1 found.',$info['info_addr']); $info['msg'] = lang('Attention: No Contact with address %1 found.',$info['info_addr']);
$info['info_custom_from'] = true; // show the info_from line and NOT only the link
} }
else else
{ {
foreach ((array)$contacts as $contact) // create the first address as info_contact
$contact = array_shift($contacts);
$info['info_contact'] = 'addressbook:'.$contact['id'];
// create the rest a "ordinary" links
foreach ($contacts as $contact)
{ {
if(!is_readable($attachment['tmp_name'])) continue;
$this->link->link('infolog',$info['link_to']['to_id'],'addressbook',$contact['id']); $this->link->link('infolog',$info['link_to']['to_id'],'addressbook',$contact['id']);
} }
} }
if (is_array($_attachments)) if (is_array($_attachments))
{ {
foreach ($_attachments as $attachment) foreach ($_attachments as $attachment)
{ {
$this->link->link('infolog',$info['link_to']['to_id'],'file',$attachment); if(is_readable($attachment['tmp_name']))
{
$this->link->link('infolog',$info['link_to']['to_id'],'file',$attachment);
}
} }
} }
return $info; return $info;
} }

View File

@ -581,10 +581,6 @@ class uiinfolog
$no_popup = $content['no_popup']; $no_popup = $content['no_popup'];
$caller = $content['caller']; $caller = $content['caller'];
/* if (isset($content['link_to']['primary']))
{
$content['info_link_id'] = $content['link_to']['primary'];
}*/
list($button) = @each($content['button']); list($button) = @each($content['button']);
unset($content['button']); unset($content['button']);
if ($button) if ($button)
@ -667,7 +663,7 @@ class uiinfolog
$this->link->link('infolog',$info_id,$content['link_to']['to_id']); $this->link->link('infolog',$info_id,$content['link_to']['to_id']);
$content['link_to']['to_id'] = $info_id; $content['link_to']['to_id'] = $info_id;
} }
if (strstr($info_link_id,':') !== false) // updating info_link_id if necessary if ($info_link_id && strstr($info_link_id,':') !== false) // updating info_link_id if necessary
{ {
list($app,$id) = explode(':',$info_link_id); list($app,$id) = explode(':',$info_link_id);
$link = $this->link->get_link('infolog',$info_id,$app,$id); $link = $this->link->get_link('infolog',$info_id,$app,$id);
@ -827,7 +823,7 @@ class uiinfolog
case 'projects': case 'projects':
case 'calendar': case 'calendar':
default: // to allow other apps to participate default: // to allow other apps to participate
$content['info_link_id'] = $this->link->link('infolog',$content['link_to']['to_id'],$action,$action_id); $content['info_contact'] = $action.':'.$action_id;
$content['blur_title'] = $this->link->title($action,$action_id); $content['blur_title'] = $this->link->title($action,$action_id);
case '': case '':
@ -870,8 +866,6 @@ class uiinfolog
$readonlys['#'.$name] = true; $readonlys['#'.$name] = true;
} }
} }
// we allways need to set a non-empty/-zero primary, to make the radiobutton appear
// $content['link_to']['primary'] = $content['info_link_id'] ? $content['info_link_id'] : '#';
$content['hide_from_css'] = $content['info_custom_from'] ? '' : 'hideFrom'; $content['hide_from_css'] = $content['info_custom_from'] ? '' : 'hideFrom';
if (!($readonlys['button[delete]'] = !$info_id || !$this->bo->check_access($info_id,EGW_ACL_DELETE))) if (!($readonlys['button[delete]'] = !$info_id || !$this->bo->check_access($info_id,EGW_ACL_DELETE)))
@ -902,16 +896,6 @@ class uiinfolog
$content['duration_format'] = $this->duration_format; $content['duration_format'] = $this->duration_format;
// make the content of the first linked address availible to show in a custom template
if ($this->tmpl->name != 'infolog.edit' &&
($addr = $this->link->get_links('infolog',$content['link_to']['to_id'],'addressbook')) &&
($contact_id = array_shift($addr)) && ($addr = ExecMethod('phpgwapi.contacts.read',$contact_id)))
{
foreach($addr as $name => $value)
{
$content['~'.$name] = $value;
}
}
$old_pm_id = is_array($pm_links) ? array_shift($pm_links) : $content['old_pm_id']; $old_pm_id = is_array($pm_links) ? array_shift($pm_links) : $content['old_pm_id'];
if (!isset($content['pm_id']) && $old_pm_id) $content['pm_id'] = $old_pm_id; if (!isset($content['pm_id']) && $old_pm_id) $content['pm_id'] = $old_pm_id;