mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:07 +01:00
* Addressbook - When viewing a user account's calendar or next/previous dates, use the account calendar over the contact calendar
This commit is contained in:
parent
53d0ef7705
commit
4195fdb306
@ -251,11 +251,11 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
||||
{
|
||||
if(is_array($_contact) && $_contact['id'])
|
||||
{
|
||||
$contact_ids[] = $_contact['id'];
|
||||
$contact_ids[] = $_contact['account_id'] ? $_contact['account_id'] : 'c'.$_contact['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$contact_ids[] = $contact;
|
||||
$contact_ids[] = 'c'.$contact;
|
||||
}
|
||||
}
|
||||
$events = $this->ui->read_calendar($contact_ids, false);
|
||||
|
@ -1640,6 +1640,7 @@ window.egw_LAB.wait(function() {
|
||||
$columsel = $this->prefs['nextmatch-addressbook.'.($do_email ? 'email' : 'index').'.rows'];
|
||||
$available_distib_lists=$this->get_lists(Acl::READ);
|
||||
$columselection = $columsel && !$query['csv_export'] ? explode(',',$columsel) : array();
|
||||
$ids = $calendar_participants = array();
|
||||
if (!$id_only && $rows)
|
||||
{
|
||||
$show_custom_fields = (!$columselection || in_array('customfields',$columselection) || $query['csv_export']) && $this->customfields;
|
||||
@ -1650,6 +1651,7 @@ window.egw_LAB.wait(function() {
|
||||
foreach($rows as $val)
|
||||
{
|
||||
$ids[] = $val['id'];
|
||||
$calendar_participants[$val['id']] = $val['account_id'] ? $val['account_id'] : 'c'.$val['id'];
|
||||
}
|
||||
if ($show_custom_fields)
|
||||
{
|
||||
@ -1659,7 +1661,7 @@ window.egw_LAB.wait(function() {
|
||||
}
|
||||
$customfields = $this->read_customfields($ids,$selected_cfs);
|
||||
}
|
||||
if ($show_calendar && !empty($ids)) $calendar = $this->read_calendar($ids);
|
||||
if ($show_calendar && !empty($ids)) $calendar = $this->read_calendar($calendar_participants);
|
||||
// distributionlist memership for the entrys
|
||||
//_debug_array($this->get_lists(Acl::EDIT));
|
||||
if ($show_distributionlist && $available_distib_lists)
|
||||
@ -1766,9 +1768,9 @@ window.egw_LAB.wait(function() {
|
||||
$row['distrib_lists'] = implode("\n",array_values($distributionlist[$row['id']]));
|
||||
//if ($show_distributionlist) $readonlys['distrib_lists'] =true;
|
||||
}
|
||||
if (isset($calendar[$row['id']]))
|
||||
if (isset($calendar[$calendar_participants[$row['id']]]))
|
||||
{
|
||||
foreach($calendar[$row['id']] as $name => $data)
|
||||
foreach($calendar[$calendar_participants[$row['id']]] as $name => $data)
|
||||
{
|
||||
$row[$name] = $data;
|
||||
}
|
||||
@ -2234,7 +2236,7 @@ window.egw_LAB.wait(function() {
|
||||
if ($content['id'])
|
||||
{
|
||||
// last and next calendar date
|
||||
list(,$dates) = each($this->read_calendar(array($content['id']),false));
|
||||
list(,$dates) = each($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']),false));
|
||||
if(is_array($dates)) $content += $dates;
|
||||
}
|
||||
// Avoid ID conflict with tree & selectboxes
|
||||
@ -2738,7 +2740,7 @@ window.egw_LAB.wait(function() {
|
||||
if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0;
|
||||
|
||||
// last and next calendar date
|
||||
if (!empty($content['id'])) list(,$dates) = each($this->read_calendar(array($content['id']),false));
|
||||
if (!empty($content['id'])) list(,$dates) = each($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']),false));
|
||||
if(is_array($dates)) $content += $dates;
|
||||
|
||||
// Disable importexport
|
||||
|
@ -253,7 +253,17 @@ app.classes.addressbook = AppJS.extend(
|
||||
}
|
||||
else
|
||||
{
|
||||
extras.owner.push('c'+ids);
|
||||
// Check to see if this is a user account, we prefer to use
|
||||
// account ID in calendar
|
||||
var data = this.egw.dataGetUIDdata(_senders[i].id);
|
||||
if(data && data.data && data.data.account_id)
|
||||
{
|
||||
extras.owner.push(data.data.account_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
extras.owner.push('c'+ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1601,21 +1601,14 @@ class Contacts extends Contacts\Storage
|
||||
/**
|
||||
* Read the next and last event of given contacts
|
||||
*
|
||||
* @param array $ids contact_id's
|
||||
* @param array $uids participant IDs. Contacts should be c<contact_id>, user accounts <account_id>
|
||||
* @param boolean $extra_title =true if true, use a short date only title and put the full title as extra_title (tooltip)
|
||||
* @return array
|
||||
*/
|
||||
function read_calendar($ids,$extra_title=true)
|
||||
function read_calendar($uids,$extra_title=true)
|
||||
{
|
||||
if (!$GLOBALS['egw_info']['user']['apps']['calendar']) return array();
|
||||
|
||||
$uids = array();
|
||||
foreach($ids as $id)
|
||||
{
|
||||
if (is_numeric($id)) $uids[] = 'c'.$id;
|
||||
}
|
||||
if (!$uids) return array();
|
||||
|
||||
$bocal = new calendar_bo();
|
||||
$events = $bocal->search(array(
|
||||
'users' => $uids,
|
||||
@ -1629,17 +1622,16 @@ class Contacts extends Contacts\Storage
|
||||
{
|
||||
foreach($event['participants'] as $uid => $status)
|
||||
{
|
||||
if ($uid[0] != 'c' || ($status == 'R' && !$GLOBALS['egw_info']['user']['preferences']['calendar']['show_rejected']))
|
||||
if ($status == 'R' && !$GLOBALS['egw_info']['user']['preferences']['calendar']['show_rejected'])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$id = (int)substr($uid,1);
|
||||
|
||||
if ($event['start'] < $this->now_su) // past event --> check for last event
|
||||
{
|
||||
if (!isset($calendars[$id]['last_event']) || $event['start'] > $calendars[$id]['last_event'])
|
||||
if (!isset($calendars[$uid]['last_event']) || $event['start'] > $calendars[$uid]['last_event'])
|
||||
{
|
||||
$calendars[$id]['last_event'] = $event['start'];
|
||||
$calendars[$uid]['last_event'] = $event['start'];
|
||||
$link = array(
|
||||
'id' => $event['id'],
|
||||
'app' => 'calendar',
|
||||
@ -1653,14 +1645,14 @@ class Contacts extends Contacts\Storage
|
||||
$link['extra_title'] = $link['title'];
|
||||
$link['title'] = date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'],$event['start']);
|
||||
}
|
||||
$calendars[$id]['last_link'] = $link;
|
||||
$calendars[$uid]['last_link'] = $link;
|
||||
}
|
||||
}
|
||||
else // future event --> check for next event
|
||||
{
|
||||
if (!isset($calendars[$id]['next_event']) || $event['start'] < $calendars[$id]['next_event'])
|
||||
if (!isset($calendars[$uid]['next_event']) || $event['start'] < $calendars[$uid]['next_event'])
|
||||
{
|
||||
$calendars[$id]['next_event'] = $event['start'];
|
||||
$calendars[$uid]['next_event'] = $event['start'];
|
||||
$link = array(
|
||||
'id' => $event['id'],
|
||||
'app' => 'calendar',
|
||||
@ -1674,7 +1666,7 @@ class Contacts extends Contacts\Storage
|
||||
$link['extra_title'] = $link['title'];
|
||||
$link['title'] = date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'],$event['start']);
|
||||
}
|
||||
$calendars[$id]['next_link'] = $link;
|
||||
$calendars[$uid]['next_link'] = $link;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user