mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-15 12:34:57 +01:00
Add last date & next date as exportable fields
This commit is contained in:
parent
4295d84746
commit
d8ffcb1d74
@ -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
|
||||
{
|
||||
|
@ -242,6 +242,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.
|
||||
foreach ($selection as $_contact) {
|
||||
@ -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']) {
|
||||
|
@ -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