Author: mcantelon
Date: Thu Jan 19 17:13:03 2012
New Revision: 10724
Log:
Added support for seven more columns in accessions import.
Modified:
trunk/lib/task/import/csvAccessionImportTask.class.php
Modified: trunk/lib/task/import/csvAccessionImportTask.class.php
==============================================================================
--- trunk/lib/task/import/csvAccessionImportTask.class.php Thu Jan 19
15:46:26 2012 (r10723)
+++ trunk/lib/task/import/csvAccessionImportTask.class.php Thu Jan 19
17:13:03 2012 (r10724)
@@ -112,7 +112,14 @@
/* these values get stored to the rowStatusVars array */
'variableColumns' => array(
'ACCESSION NUMBER',
- 'TYPE'
+ 'TYPE',
+ 'DONOR',
+ 'EMAIL',
+ 'POSTAL CODE',
+ 'TELEPHONE',
+ 'ADDRESS_Street',
+ 'ADDRESS_City',
+ 'ADDRESS_Province'
),
/* import logic to load accession */
@@ -163,6 +170,44 @@
$self->object->save();
//print 'Saved ID '. $self->object->id ."\n"; exit();
}
+ },
+
+ /* create related objects */
+ 'postSaveLogic' => function(&$self)
+ {
+ if(isset($self->object) && is_object($self->object))
+ {
+ if ($self->rowStatusVars['DONOR'])
+ {
+ // fetch/create actor
+ $actor = $self->createOrFetchActor($self->rowStatusVars['DONOR']);
+
+ // map column names to QubitContactInformation properties
+ $columnToProperty = array(
+ 'EMAIL' => 'email',
+ 'TELEPHONE' => 'telephone',
+ 'ADDRESS_Street' => 'streetAddress',
+ 'ADDRESS_City' => 'city',
+ 'ADDRESS_Province' => 'region'
+ );
+
+ // set up creation of contact infomation
+ $contactData = array();
+ foreach($columnToProperty as $column => $property)
+ {
+ if (isset($self->rowStatusVars[$column]))
+ {
+ $contactData[$property] = $self->rowStatusVars[$column];
+ }
+ }
+
+ // create contact information if none exists
+ $self->createOrFetchContactInformation($actor->id, $contactData);
+
+ // create relation between accession and donor
+ $self->createObjectTermRelation($actor->id, QubitTerm::DONOR_ID);
+ }
+ }
}
));
@@ -197,6 +242,7 @@
// Are there any in CVA that should get set to 'Incomplete'?
$cvaToQubit = array(
'Accession completed' => 'Complete',
+ 'Appraisal/selection completed' => 'Complete',
'Accession and Description/arrangement completed' => 'Complete',
'In Process' => 'In-Progress'
);
--
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.