mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Add last date & next date as exportable fields
This commit is contained in:
parent
393a35ad70
commit
ec9be026dd
@ -13,7 +13,11 @@
|
||||
|
||||
/**
|
||||
* class addressbook_egw_record
|
||||
* compability layer for iface_egw_record needet for importexport
|
||||
* compability layer for iface_egw_record needed for importexport
|
||||
*
|
||||
* Note that last_event and next_event are not automatically loaded by
|
||||
* addressbook_bo->read(), so if you need them use:
|
||||
* addressbook_bo->read_calendar();
|
||||
*/
|
||||
class addressbook_egw_record implements importexport_iface_egw_record
|
||||
{
|
||||
|
@ -241,6 +241,24 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
||||
}
|
||||
|
||||
$export_object->set_mapping($options['mapping']);
|
||||
|
||||
// Add in last/next event, if needed
|
||||
if($options['mapping']['last_date'] || $options['mapping']['next_date'])
|
||||
{
|
||||
$contact_ids = array();
|
||||
foreach($selection as $_contact)
|
||||
{
|
||||
if(is_array($_contact) && $_contact['id'])
|
||||
{
|
||||
$contact_ids[] = $_contact['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$contact_ids[] = $contact;
|
||||
}
|
||||
}
|
||||
$events = $this->ui->read_calendar($contact_ids, false);
|
||||
}
|
||||
|
||||
// $options['selection'] is array of identifiers as this plugin doesn't
|
||||
// support other selectors atm.
|
||||
@ -257,6 +275,14 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
||||
} else {
|
||||
$contact = new addressbook_egw_record($_contact);
|
||||
}
|
||||
|
||||
if($events && $events[$contact->id])
|
||||
{
|
||||
// NB: last_date and next_date are used instead of last_event & next_event
|
||||
// to avoid automatic conversion - we want to export link title, not date-time
|
||||
$contact->last_date = $events[$contact->id]['last_link']['title'];
|
||||
$contact->next_date = $events[$contact->id]['next_link']['title'];
|
||||
}
|
||||
// Some conversion
|
||||
$this->convert($contact, $options);
|
||||
if($options['convert']) {
|
||||
@ -400,12 +426,12 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
||||
* Adjust automatically generated filter fields
|
||||
*/
|
||||
public function get_filter_fields(Array &$filters)
|
||||
{
|
||||
{
|
||||
unset($filters['last_event']);
|
||||
unset($filters['next_event']);
|
||||
foreach($filters as $field_name => &$settings)
|
||||
{
|
||||
if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name];
|
||||
if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name];
|
||||
}
|
||||
$filters['owner'] = array(
|
||||
'name' => 'owner',
|
||||
|
@ -24,6 +24,12 @@ class addressbook_wizard_export_contacts_csv extends importexport_wizard_basic_e
|
||||
$this->export_fields['#'.$name] = $data['label'];
|
||||
}
|
||||
unset($this->export_fields['jpegphoto']); // can't cvs export that
|
||||
|
||||
// Add in last/next appointments
|
||||
// NB: last_date and next_date are used instead of last_event & next_event
|
||||
// to avoid automatic conversion - we want to export link title, not date-time
|
||||
$this->export_fields['last_date'] = lang('Last date');
|
||||
$this->export_fields['next_date'] = lang('Next date');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user