Author: mcantelon
Date: Fri Jan 27 16:42:40 2012
New Revision: 10757
Log:
Added support in rough for adding create dates with no creator.
Modified:
trunk/lib/task/import/csvImportTask.class.php
Modified: trunk/lib/task/import/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/import/csvImportTask.class.php Fri Jan 27 13:27:07
2012 (r10756)
+++ trunk/lib/task/import/csvImportTask.class.php Fri Jan 27 16:42:40
2012 (r10757)
@@ -422,42 +422,7 @@
// Init eventData array and add creator name
$eventData = array('actorName' => $creator);
- // add dates if specified
- if (
- isset($self->rowStatusVars['datesOfCreationStart'][$index])
- || (
- isset($self->rowStatusVars['datesOfCreationStart'][$index])
- && isset($self->rowStatusVars['datesOfCreationEnd'][$index])
- )
- )
- {
- // Start and end date
- foreach(array(
- 'datesOfCreationEnd' => 'endDate',
- 'datesOfCreationStart' => 'startDate'
- )
- as $statusVar => $eventProperty
- )
- {
- if (isset($self->rowStatusVars[$statusVar][$index])) {
- $eventData[$eventProperty] =
$self->rowStatusVars[$statusVar][$index] .'-00-00';
- }
- }
-
- // Other date info
- foreach(array(
- 'datesOfCreationNote' => 'description',
- 'datesOfCreation' => 'date'
- )
- as $statusVar => $eventProperty
- )
- {
- if (isset($self->rowStatusVars[$statusVar][$index]))
- {
- $eventData[$eventProperty] =
$self->rowStatusVars[$statusVar][$index];
- }
- }
- }
+ setupEventDateData($self, $eventData, $index);
// Add creator history if specified
if(isset($self->rowStatusVars['creatorHistory'][$index]))
@@ -472,6 +437,24 @@
);
}
}
+ else if(
+ isset($self->rowStatusVars['datesOfCreationStart'])
+ || isset($self->rowStatusVars['datesOfCreationEnd'])
+ ) {
+ foreach($self->rowStatusVars['datesOfCreationStart'] as $index =>
$date)
+ {
+ $eventData = array();
+
+ setupEventDateData($self, $eventData, $index);
+
+ // Create event
+ $event = $self->createEvent(
+ QubitTerm::CREATION_ID,
+ $eventData
+ );
+ }
+print 'Created for '. $self->object->title ."\n";
+ }
// if a role is found, create term and actor if need be
if (isset($self->rowStatusVars['actorRoles']))
@@ -552,4 +535,46 @@
$import->csv($fh, $skipRows);
}
+
+}
+
+function setupEventDateData(&$self, &$eventData, $index)
+{
+
+ // add dates if specified
+ if (
+ isset($self->rowStatusVars['datesOfCreationStart'][$index])
+ || (
+ isset($self->rowStatusVars['datesOfCreationStart'][$index])
+ && isset($self->rowStatusVars['datesOfCreationEnd'][$index])
+ )
+ )
+ {
+ // Start and end date
+ foreach(array(
+ 'datesOfCreationEnd' => 'endDate',
+ 'datesOfCreationStart' => 'startDate'
+ )
+ as $statusVar => $eventProperty
+ )
+ {
+ if (isset($self->rowStatusVars[$statusVar][$index])) {
+ $eventData[$eventProperty] = $self->rowStatusVars[$statusVar][$index]
.'-00-00';
+ }
+ }
+
+ // Other date info
+ foreach(array(
+ 'datesOfCreationNote' => 'description',
+ 'datesOfCreation' => 'date'
+ )
+ as $statusVar => $eventProperty
+ )
+ {
+ if (isset($self->rowStatusVars[$statusVar][$index]))
+ {
+ $eventData[$eventProperty] = $self->rowStatusVars[$statusVar][$index];
+ }
+ }
+ }
}
--
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.