Author: mcantelon
Date: Thu Jan 12 12:15:36 2012
New Revision: 10658

Log:
Got rid of some magic numbers.

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

Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php      Thu Jan 12 11:33:47 2012        
(r10657)
+++ trunk/lib/task/csvImportTask.class.php      Thu Jan 12 12:15:36 2012        
(r10658)
@@ -104,9 +104,10 @@
 
     // Load taxonomies into variables to avoid use of magic numbers
     $termData = QubitFlatfileImport::loadTermsFromTaxonomies(array(
-      QubitTaxonomy::NOTE_TYPE_ID      => 'noteTypes',
-      QubitTaxonomy::RAD_TITLE_NOTE_ID => 'titleNoteTypes',
-      QubitTaxonomy::MATERIAL_TYPE_ID  => 'materialTypes'
+      QubitTaxonomy::NOTE_TYPE_ID        => 'noteTypes',
+      QubitTaxonomy::RAD_TITLE_NOTE_ID   => 'titleNoteTypes',
+      QubitTaxonomy::MATERIAL_TYPE_ID    => 'materialTypes',
+      QubitTaxonomy::COPYRIGHT_STATUS_ID => 'copyrightStatusTypes'
     ));
 
     // Define import
@@ -123,9 +124,10 @@
       /* the status array is a place to put data that should be accessible
          from closure logic using the getStatus method */
       'status' => array(
-        'options'       => $options,
-        'sourceName'    => basename($arguments['filename']),
-        'materialTypes' => $termData['materialTypes'],
+        'options'              => $options,
+        'sourceName'           => basename($arguments['filename']),
+        'materialTypes'        => $termData['materialTypes'],
+        'copyrightStatusTypes' => $termData['copyrightStatusTypes']
       ),
       'columnNames' => fgetcsv($fh, 60000), // 1st row supplies column 
names/order
       'defaultStatusId' => $defaultStatusId,
@@ -399,19 +401,36 @@
                   'restriction'       => 1,
                   'basisId'           => 170,
                   'actId'             => 305,
-                  'copyrightStatusId' => 306
+                  'copyrightStatusId' => array_search(
+                    'Under copyright',
+                    $self->getStatus('copyrightStatusTypes')
+                  )
                 );
                 if ($rightsHolderId) $rightAndRelation['rightsHolderId'] = 
$rightsHolderId;
                 $self->createRightAndRelation($rightAndRelation);
                 break;
 
               case 'unknown':
+                $self->createRightAndRelation(array(
+                  'restriction'       => 1,
+                  'basisId'           => 170,
+                  'actId'             => 305,
+                  'copyrightStatusId' => array_search(
+                    'Unknown',
+                    $self->getStatus('copyrightStatusTypes')
+                  )
+                ));
+                break;
+
               case 'public domain':
                 $self->createRightAndRelation(array(
                   'restriction'       => 1,
                   'basisId'           => 170,
                   'actId'             => 305,
-                  'copyrightStatusId' => 307
+                  'copyrightStatusId' => array_search(
+                    'Public domain',
+                    $self->getStatus('copyrightStatusTypes')
+                  )
                 ));
                 break;
 

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