Author: mcantelon
Date: Wed May 30 14:43:53 2012
New Revision: 11712

Log:
Reverting to some older accessions import logic.

Modified:
   trunk/lib/task/import/csvAccessionImportTask.class.php

Modified: trunk/lib/task/import/csvAccessionImportTask.class.php
==============================================================================
--- trunk/lib/task/import/csvAccessionImportTask.class.php      Wed May 30 
00:02:53 2012        (r11711)
+++ trunk/lib/task/import/csvAccessionImportTask.class.php      Wed May 30 
14:43:53 2012        (r11712)
@@ -91,14 +91,6 @@
         'processingStatus' => $termData['processingStatus']
       ),
 
-      'standardColumns' => array(
-        'title',
-        'locationInformation',
-        'scopeAndContent',
-        'archivalHistory',
-        'receivedExtentUnits'
-      ),
-
       /* import columns that should be redirected to QubitInformationObject
          properties (and optionally transformed)
       
@@ -121,15 +113,17 @@
         'TITLE'             => 'title',
         'LOCATION'          => 'locationInformation',
         'SCOPE AND CONTENT' => 'scopeAndContent',
+        'scopeAndContent'   => 'scopeAndContent',
         'physicalCondition' => 'physicalCharacteristics',
         'CONSERVATION NOTE' => 'physicalCharacteristics',
+        'extent'            => 'receivedExtentUnits',
         'primaryNotes'      => 'notes',
         'notes'             => 'notes'
       ),
 
       /* these values get stored to the rowStatusVars array */
       'variableColumns' => array(
-        'accessionNumber',
+        'ACCESSION NUMBER',
         'TYPE',
         'DONOR',
         'EMAIL',
@@ -148,7 +142,7 @@
       /* import logic to load accession */
       'rowInitLogic' => function(&$self)
       {
-        $accessionNumber =  $self->rowStatusVars['accessionNumber'];
+        $accessionNumber =  $self->rowStatusVars['ACCESSION NUMBER'];
 
         // look up Qubit ID of pre-created accession
         $statement = $self->sqlQuery(
@@ -185,6 +179,11 @@
             );
           }
 
+          if (isset($self->rowStatusVars['receivedExtentUnits']))
+          {
+            $self->object->receivedExtentUnits = 
$self->rowStatusVars['receivedExtentUnits'];
+          }
+
           if (isset($self->rowStatusVars['processingNotes']))
           {
             $self->object->processingNotes = 
$self->rowStatusVars['processingNotes'];
@@ -305,7 +304,7 @@
     $this->setUpExtentColumnHandling($import);
     $this->setUpProcessingNoteColumnHandling($import);
 
-    $import->addColumnHandler('acquisionDate', function(&$self, $data)
+    $import->addColumnHandler('DATE OF ACQUISITION', function(&$self, $data)
     {
       if ($data)
       {
@@ -416,6 +415,51 @@
     }
   }
 
+  protected function setUpExtentColumnHandling(&$import)
+  {
+    // map of extent-related column names to their corresponding prefixes
+    $extentColumnsAndPrefixes = array(
+      'INARCHITECTURALPLAN' => "Plans (count): ",
+      'INAUDIOCASSETTE'     => "Audio Cassettes (count): ",
+      'INAUDIOREEL'         => "Audio Reels (count): ",
+      'INCOMPACTDISC'       => "CDs (count): ",
+      'INDIGITALPHOTO'      => "Digital Photos (count): ",
+      'INDOCUMENTARYART'    => "Doc Art (count): ",
+      'INDVD'               => "DVDs (count): ",
+      'INFILMREEL'          => "Film Reels (count): ",
+      'INMAP'               => "Maps (count): ",
+      'INMICROFICHE'        => "Microfiche (count): ",
+      'INMICROFILM'         => "Microfilm Reels (count): ",
+      'INNEGATIVE'          => "Photo Negs (count): ",
+      'INOTHER MATERIALS'   => "Other Materials (count): ",
+      'INPHOTOGRAPHICPRINT' => "Photo Prints (count): ",
+      'INSLIDE'             => "Slides (count): ",
+      'INTEXTUALRECORDS'    => "Textual (m): ",
+      'INVIDEOCASSETTE'     => "Video Cassettes (count): "
+    );
+
+    // store column/prefix data as we need to access it from inside a handler
+    $import->setStatus('extentColumnsAndPrefixes', $extentColumnsAndPrefixes);
+
+    // handling logic for extent columns
+    $extentColumnHandler = function(&$self, $data)
+    {
+      csvAccessionImportTask::appendColumnDataToRowVarWithColumnSpecificPrefix(
+        $self,
+        $self->status['currentColumn'],
+        $data,
+        'receivedExtentUnits',
+        $self->getStatus('extentColumnsAndPrefixes')
+      );
+    };
+
+    // add handler for each extent-related column
+    $import->addColumnHandlers(
+      array_keys($extentColumnsAndPrefixes), 
+      $extentColumnHandler
+    );
+  }
+
   protected function setUpProcessingNoteColumnHandling(&$import)
   {
     // map of processing-note-related column names to their corresponding 
prefixes
@@ -437,7 +481,7 @@
     // store column/prefix data as we need to access it from inside a handler
     $import->setStatus('processingNoteColumnsAndPrefixes', 
$processingNoteColumnsAndPrefixes);
 
-    // handling logic for processing note columns
+    // handling logic for extent columns
     $processingNoteColumnHandler = function(&$self, $data)
     {
       csvAccessionImportTask::appendColumnDataToRowVarWithColumnSpecificPrefix(
@@ -449,7 +493,7 @@
       );
     };
 
-    // add handler for each processing-note-related column
+    // add handler for each extent-related column
     $import->addColumnHandlers(
       array_keys($processingNoteColumnsAndPrefixes),
       $processingNoteColumnHandler

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