From c85b120b9ff5d04427644a0cbc3123a67d421ba3 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 1 Apr 2004 20:34:35 +0000 Subject: [PATCH] fix for bug [ 872031 ] Custom fields don't work with csv import --- calendar/csv_import.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/calendar/csv_import.php b/calendar/csv_import.php index 719241e9db..4a5ae91619 100644 --- a/calendar/csv_import.php +++ b/calendar/csv_import.php @@ -182,6 +182,15 @@ // 'groups' => 'Groups (dont know what this field is for)', // 'cal_type' => 'cal_type: single_event=E (default) else M', ); + $custom_fields = CreateObject('calendar.bocustom_fields'); + //echo "custom-fields=
".print_r($custom_fields,True)."
"; + foreach ($custom_fields->fields as $name => $data) + { + if ($name[0] == '#') // a custom field ? + { + $cal_names[$name] = $data['name'].': Custom field, varchar('.$data['length'].')'; + } + } // the next line is used in the help-text too $mktime_lotus = "${PSep}0?([0-9]+)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*).*$ASep@mktime(${VPre}4,${VPre}5,${VPre}6,${VPre}2,${VPre}3,${VPre}1)"; @@ -483,6 +492,14 @@ { $calendar->add_attribute('participants','A',$values['owner']); } + // add custom-fields + foreach($values as $name => $val) + { + if ($name[0] == '#') + { + $calendar->add_attribute($name,$values[$name]); + } + } //echo "add_entry(
".print_r($calendar->cal->event,True).")
\n"; $calendar->add_entry( $calendar->cal->event ); }