X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/56f1fd19f2c9c72878395b3275f03f192ccca082..bf300dab88607ee209b83f16a6915bb9d61787bb:/WEB-INF/lib/ttOrgImportHelper.class.php diff --git a/WEB-INF/lib/ttOrgImportHelper.class.php b/WEB-INF/lib/ttOrgImportHelper.class.php index 622b3fec..2cb69344 100644 --- a/WEB-INF/lib/ttOrgImportHelper.class.php +++ b/WEB-INF/lib/ttOrgImportHelper.class.php @@ -32,6 +32,7 @@ import('ttTaskHelper'); import('ttProjectHelper'); import('ttClientHelper'); import('ttInvoiceHelper'); +import('ttCustomFieldHelper'); // ttOrgImportHelper - this class is a future replacement for ttImportHelper. // Currently, it is work in progress. @@ -55,6 +56,8 @@ class ttOrgImportHelper { var $currentGroupUserMap = array(); var $currentGroupInvoiceMap = array(); var $currentGroupLogMap = array(); + var $currentGroupCustomFieldMap = array(); + var $currentGroupCustomFieldOptionMap = array(); // Constructor. function __construct(&$errors) { @@ -311,6 +314,28 @@ class ttOrgImportHelper { $this->currentGroupLogMap[$attrs['ID']] = $log_item_id; } else $this->errors->add($i18n->get('error.db')); } + + if ($name == 'CUSTOM_FIELDS') { + // If we get here, we have to recycle $currentGroupCustomFieldMap. + unset($this->currentGroupCustomFieldMap); + $this->currentGroupCustomFieldMap = array(); + // Custom field map is reconstructed after processing elements in XML. See below. + } + + if ($name == 'CUSTOM_FIELD') { + // We get here when processing tags for the current group. + $custom_field_id = ttCustomFieldHelper::insertField(array( + 'group_id' => $this->current_group_id, + // 'org_id' => $this->org_id, TODO: add this when org_id field is added to the table. + 'type' => $attrs['TYPE'], + 'label' => $attrs['LABEL'], + 'required' => $attrs['REQUIRED'], + 'status' => $attrs['STATUS'])); + if ($custom_field_id) { + // Add a mapping. + $this->currentGroupCustomFieldMap[$attrs['ID']] = $custom_field_id; + } else $this->errors->add($i18n->get('error.db')); + } } }