Author: mcantelon
Date: Thu Dec 29 12:50:39 2011
New Revision: 10466

Log:
Added helper method to import class for creating events; implemented for create 
date.

Modified:
   trunk/lib/task/csvImportTask.class.php

Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php      Thu Dec 29 12:37:39 2011        
(r10465)
+++ trunk/lib/task/csvImportTask.class.php      Thu Dec 29 12:50:39 2011        
(r10466)
@@ -131,16 +131,15 @@
             && isset($self->rowStatusVars['end_year'])
           )
         ) {
-          $date = new QubitEvent;
-          $date->informationObjectId = $self->information_object->id;
-          $date->typeId = QubitTerm::CREATION_ID;
-          $date->startDate = $self->rowStatusVars['start_year'] .'-00-00';
-          if (isset($self->rowStatusVars['end_year'])) {
-            $date->endDate = $self->rowStatusVars['start_year'] .'-00-00';
-          }
-          if (!isset($self->testing) || !$self->testing) {
-            $date->save();
-          }
+          $endDate = (isset($self->rowStatusVars['end_year']))
+             ? $self->rowStatusVars['end_year'] .'-00-00'
+             : false;
+
+          $self->createEvent(
+            QubitTerm::CREATION_ID,
+            $self->rowStatusVars['start_year'] .'-00-00',
+            $endDate
+          );
         }
       }
     ));
@@ -320,4 +319,18 @@
 
     return $note;
   }
+
+  public function createEvent($typeId, $startDate, $endDate = false)
+  {
+    $date = new QubitEvent;
+    $date->informationObjectId = $this->information_object->id;
+    $date->typeId = $typeId;
+    $date->startDate = $startDate;
+    if ($endDate) {
+      $date->endDate = $endDate;
+    }
+    if (!isset($self->testing) || !$self->testing) {
+      $date->save();
+    }
+  }
 }

-- 
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.

Reply via email to