Permalink
Browse files

Clean up schema declarations and use more comprehensive source.

  • Loading branch information...
1 parent a61841c commit fa39b6043ce709b4f3feb421b7d81d9ea8b162e6 William Johnston committed Oct 31, 2013
Showing with 23 additions and 3 deletions.
  1. +2 −2 ACSSync.install
  2. +21 −1 ACSSync.module
View
@@ -1,6 +1,6 @@
<?php
-function acs_sync_schema() {
+function acssync_schema() {
$schema['accessacs_individuals'] = array(
'description' => t('The base table for AccessACS Individuals'),
'fields' => array(
@@ -10,7 +10,7 @@ function acs_sync_schema() {
'unsigned' => TRUE,
'not null' => TRUE
),
- 'FamId' => array(
+ 'PrimFamily' => array(
'description' => t('The primary identifier for a family'),
'type' => 'int',
'unsigned' => TRUE
View
@@ -84,9 +84,29 @@ function acssync_sync()
return;
}
+ db_truncate('accessacs_individuals')->execute();
+
foreach ($result->Page as $simple_person) {
$individual = $acsAPI->get_person($simple_person->IndvId);
- var_dump($individual);
+ // var_dump($individual);
+ $nid = db_insert('accessacs_individuals')
+ ->fields(array(
+ 'IndvId' => $individual->IndvId,
+ 'PrimFamily' => $individual->PrimFamily,
+ 'MiddleName' => $individual->MiddleName,
+ 'Title' => $individual->Title,
+ 'LastName' => $individual->LastName,
+ 'FirstName' => $individual->FirstName,
+ 'PictureUrl' => $individual->PictureUrl,
+ 'FamilyPosition' => $simple_person->FamilyPosition,
+ 'Suffix' => $individual->Suffix,
+ 'FullName' => $individual->FullName,
+ 'FriendlyName' => $individual->FriendlyName,
+ 'FamilyPictureUrl' => $individual->FamilyPictureUrl,
+ 'DateOfBirth' => $individual->DateOfBirth,
+ 'MemberStatus' => $individual->MemberStatus,
+ ))
+ ->execute();
return;
}

0 comments on commit fa39b60

Please sign in to comment.