+
+ // getReportOptions - returns an array of report options constructed from session bean.
+ //
+ // Note: similarly to ttFavReportHelper::getReportOptions, this function is a part of
+ // refactoring to simplify maintenance of report generating functions, as we currently
+ // have 2 sets: normal reporting (from bean), and fav report emailing (from db fields).
+ // Using options obtained from either db or bean shall allow us to use only one set of functions.
+ static function getReportOptions($bean) {
+ global $user;
+
+ // Prepare an array of report options.
+ $options = array();
+
+ // Construct one by one.
+ $options['name'] = null; // No name required.
+ $options['user_id'] = $user->id; // Not sure if we need user_id here. Fav reports use it to recycle $user object in cron.php.
+ $options['client_id'] = $bean->getAttribute('client');
+
+/*
+ * TODO: remaining fields to fill in...
+ `client_id` int(11) default NULL, # client id (if selected)
+ `cf_1_option_id` int(11) default NULL, # custom field 1 option id (if selected)
+ `project_id` int(11) default NULL, # project id (if selected)
+ `task_id` int(11) default NULL, # task id (if selected)
+ `billable` tinyint(4) default NULL, # whether to include billable, not billable, or all records
+ `invoice` tinyint(4) default NULL, # whether to include invoiced, not invoiced, or all records
+ `paid_status` tinyint(4) default NULL, # whether to include paid, not paid, or all records
+ `users` text default NULL, # Comma-separated list of user ids. Nothing here means "all" users.
+ `period` tinyint(4) default NULL, # selected period type for report
+ `period_start` date default NULL, # period start
+ `period_end` date default NULL, # period end
+ `show_client` tinyint(4) NOT NULL default 0, # whether to show client column
+ `show_invoice` tinyint(4) NOT NULL default 0, # whether to show invoice column
+ `show_paid` tinyint(4) NOT NULL default 0, # whether to show paid column
+ `show_ip` tinyint(4) NOT NULL default 0, # whether to show ip column
+ `show_project` tinyint(4) NOT NULL default 0, # whether to show project column
+ `show_start` tinyint(4) NOT NULL default 0, # whether to show start field
+ `show_duration` tinyint(4) NOT NULL default 0, # whether to show duration field
+ `show_cost` tinyint(4) NOT NULL default 0, # whether to show cost field
+ `show_task` tinyint(4) NOT NULL default 0, # whether to show task column
+ `show_end` tinyint(4) NOT NULL default 0, # whether to show end field
+ `show_note` tinyint(4) NOT NULL default 0, # whether to show note column
+ `show_custom_field_1` tinyint(4) NOT NULL default 0, # whether to show custom field 1
+ `show_work_units` tinyint(4) NOT NULL default 0, # whether to show work units
+ `show_totals_only` tinyint(4) NOT NULL default 0, # whether to show totals only
+ `group_by` varchar(20) default NULL, # group by field
+ `status` tinyint(4) default 1, # favorite report status
+ PRIMARY KEY (`id`)
+);
+ */
+ return $options;
+ }