This manual is deprecated. Please visit https://groupoffice.readthedocs.io for the latest documentation. |
Difference between revisions of "Custom exports"
From Group-Office Groupware and CRM Documentation
(New page: Create a file in the folder: $config['file_storage_path']/customexports/mycustomexport.class.inc.php <pre> →* * Example override for a custom export: class custom_export_query exten...) |
(No difference)
|
Revision as of 10:49, 4 December 2009
Create a file in the folder:
$config['file_storage_path']/customexports/mycustomexport.class.inc.php
/** * Example override for a custom export */ class custom_export_query extends export_query { var $query='orders'; var $name='OSF gastouders'; /** * Optionally hardcode the list and text separator in the constructor */ function __construct() { parent::__construct(); $this->list_separator="\t"; $this->text_separator=''; } /** * Format the raw database record. */ function format_record(&$record){ $record['veld6']='T'; $record['veld8']='False'; $record['btime']=date('d/m/Y', $record['btime']); } /** * Initialize the columns. * Some example custom fields are used here */ function init_columns(){ $crediteurnummer = $this->cf->find_first_field_by_name(7, 'Crediteurnummer'); $tegenrekening = $this->cf->find_first_field_by_name(7, 'Tegenrekening'); $this->columns=array('order_id','btime','customer_name', 'col_'.$crediteurnummer['id'],'col_'.$tegenrekening['id'],'veld6', 'total', 'veld8'); $this->headers=array(); } }
Now in the billing module you will have this custom CSV export available.
It's for the billing module because the query is set to 'orders':
var $query='orders';
You can also use contacts, companies, tickets, log etc.