Author: mcantelon
Date: Mon Jan 2 11:43:11 2012
New Revision: 10508
Log:
Added standardColumns option for import class to eliminate need for redundant
mappings.
Modified:
trunk/lib/task/csvImportTask.class.php
Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php Mon Jan 2 10:34:02 2012
(r10507)
+++ trunk/lib/task/csvImportTask.class.php Mon Jan 2 11:43:11 2012
(r10508)
@@ -73,9 +73,23 @@
'defaultStatusId' => $defaultStatusId,
'defaultStatusTypeId' => $defaultStatusTypeId,
'ignoreColumns' => array(),
+ 'standardColumns' => array(
+ 'title',
+ 'accruals',
+ 'scopeAndContent',
+ 'extentAndMedium',
+ 'acquisition',
+ 'accessConditions',
+ 'locationOfCopies',
+ 'locationOfOriginals',
+ 'relatedUnitsOfDescription',
+ 'edition',
+ 'archivalHistory',
+ 'arrangement',
+ 'findingAids',
+ 'physicalCharacteristics'
+ ),
'columnMap' => array(
- 'title' => 'title',
- 'accruals' => 'accruals',
'RECORD_ID' => array(
'column' => 'sources',
'transformationLogic' => function(&$self, $text)
@@ -83,17 +97,6 @@
return 'CS-Records ID: '. $text;
}
),
- 'scopeAndContent' => 'scopeAndContent',
- 'extentAndMedium' => 'extentAndMedium',
- 'acquisition' => 'acquisition',
- 'accessConditions' => 'accessConditions',
- 'locationOfCopies' => 'locationOfCopies',
- 'locationOfOriginals' => 'locationOfOriginals',
- 'relatedUnitsOfDescription' => 'relatedUnitsOfDescription',
- 'edition' => 'edition',
- 'archivalHistory' => 'archivalHistory',
- 'arrangement' => 'arrangement',
- 'findingAids' => 'findingAids',
/*
'Revision history' => array(
'column' => 'revision',
@@ -116,7 +119,6 @@
}
),
*/
- 'physicalCharacteristics' => 'physicalCharacteristics'
),
'propertyMap' => array(
'titleStatementOfResponsibility' => 'titleStatementOfResponsibility',
@@ -269,7 +271,8 @@
'rowComplete',
'propertyMap',
'noteMap',
- 'columnMap'
+ 'columnMap',
+ 'standardColumns'
);
// set properties from options, halting upon invalid option
@@ -315,6 +318,7 @@
{
if (
!in_array($column, $this->ignoreColumns)
+ && !isset($this->standardColumns[$column])
&& !isset($this->columnMap[$column])
&& !isset($this->propertyMap[$column])
&& !isset($this->noteMap[$column])
@@ -398,8 +402,8 @@
}
}
else if (
- isset($self->columns[$index])
- && isset($self->handlers[($self->columns[$index])])
+ isset($self->columns[$index])
+ && isset($self->handlers[($self->columns[$index])])
)
{
// otherwise, if column is data and a handler is set, use it
@@ -408,6 +412,13 @@
array($self, $value)
);
}
+ else if (
+ isset($self->columns[$index])
+ && array_search($self->columns[$index], $self->standardColumns) !==
FALSE
+ )
+ {
+ $self->informationObject->{$self->columns[$index]} = $value;
+ }
});
// execute row completion logic
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.