using new historylog custom field stuff

This commit is contained in:
Ralf Becker 2011-04-20 06:22:29 +00:00
parent d7a6328c12
commit 0aac7e43a9
2 changed files with 7 additions and 27 deletions

View File

@ -61,10 +61,10 @@ class calendar_tracking extends bo_tracking
'start' => 'start', 'start' => 'start',
'end' => 'end', 'end' => 'end',
'participants' => array('user_id', 'status', 'role', 'recur'), 'participants' => array('user_id', 'status', 'role', 'recur'),
'participants-c' => array('user_id', 'status', 'quantity', 'role', 'recur'), 'participants-c' => array('user_id', 'status', 'quantity', 'role', 'recur'),
// Custom fields added in constructor // Custom fields added in constructor
); );
@ -89,7 +89,7 @@ class calendar_tracking extends bo_tracking
'start' => 'start', 'start' => 'start',
'end' => 'end', 'end' => 'end',
'participants' => 'Participants: User, Status, Role', 'participants' => 'Participants: User, Status, Role',
'participants-c'=> 'Participants: User, Status, Quantity, Role' 'participants-c'=> 'Participants: User, Status, Quantity, Role'
@ -110,15 +110,7 @@ class calendar_tracking extends bo_tracking
*/ */
public function __construct() public function __construct()
{ {
parent::__construct(); // calling the constructor of the extended class parent::__construct('calendar'); // adds custom fields
$custom = config::get_customfields('calendar', true);
if(is_array($custom)) {
foreach($custom as $name => $settings) {
$this->field2history['#'.$name] = '#'.$name;
$this->field2label['#'.$name] = $settings['label'];
}
}
} }
/** /**
@ -127,7 +119,7 @@ class calendar_tracking extends bo_tracking
*/ */
public function track(array $data,array $old=null,$user=null,$deleted=null,array $changed_fields=null) public function track(array $data,array $old=null,$user=null,$deleted=null,array $changed_fields=null)
{ {
// Don't try to track dates on recurring events. // Don't try to track dates on recurring events.
// It won't change for the base event, and any change to the time creates an exception // It won't change for the base event, and any change to the time creates an exception
if($data['recur_type']) { if($data['recur_type']) {
unset($data['start']); unset($data['end']); unset($data['start']); unset($data['end']);
@ -137,7 +129,7 @@ class calendar_tracking extends bo_tracking
/** /**
* Do some magic with the participants and recurrance. * Do some magic with the participants and recurrance.
* If this is one of a recurring event, append the recur_date to the participant field so we can * If this is one of a recurring event, append the recur_date to the participant field so we can
* filter by it later. * filter by it later.
*/ */
$recur_prefix = $data['recur_date'] ? $data['recur_date'] : ''; $recur_prefix = $data['recur_date'] ? $data['recur_date'] : '';
if(is_array($data['participants'])) { if(is_array($data['participants'])) {

View File

@ -2163,18 +2163,6 @@ function replace_eTemplate_onsubmit()
foreach($tracking->field2label as $field => $label) { foreach($tracking->field2label as $field => $label) {
$sel_options[$status][$field] = lang($label); $sel_options[$status][$field] = lang($label);
} }
// Get custom field options // custom fields are now "understood" directly by historylog widget
$custom = config::get_customfields('calendar', true);
if(is_array($custom)) {
foreach($custom as $name => $settings) {
if(!is_array($settings['values'])) {
$content['history']['status-widgets']['#'.$name] = $settings['type'];
} elseif($settings['values']['@']) {
$content['history']['status-widgets']['#'.$name] = customfields_widget::_get_options_from_file($settings['values']['@']);
} else {
$content['history']['status-widgets']['#'.$name] = $settings['values'];
}
}
}
} }
} }