Author: sevein
Date: Tue Jul 26 16:54:44 2011
New Revision: 9397

Log:
Override processForm to support primary contact details into donor form

Modified:
   
trunk/plugins/qtAccessionPlugin/modules/accession/actions/relatedDonorComponent.class.php

Modified: 
trunk/plugins/qtAccessionPlugin/modules/accession/actions/relatedDonorComponent.class.php
==============================================================================
--- 
trunk/plugins/qtAccessionPlugin/modules/accession/actions/relatedDonorComponent.class.php
   Tue Jul 26 16:44:42 2011        (r9396)
+++ 
trunk/plugins/qtAccessionPlugin/modules/accession/actions/relatedDonorComponent.class.php
   Tue Jul 26 16:54:44 2011        (r9397)
@@ -84,8 +84,20 @@
       case 'region':
       case 'streetAddress':
       case 'telephone':
+
+        if (!isset($this->contact) && isset($this->relation->object))
+        {
+          if (null === $this->contact = 
$this->relation->object->getPrimaryContact())
+          {
+            $this->contact = new QubitContactInformation;
+          }
+
+        }
+
         $this->contact[$field->getName()] = 
$this->form->getValue($field->getName());
 
+        break;
+
       default:
 
         parent::processField($field);
@@ -94,16 +106,14 @@
 
   public function processForm()
   {
-    if (null === $contact = $this->relation->object->getPrimaryContact())
+    parent::processForm();
+
+    if (isset($this->contact))
     {
-      $this->contact = new QubitContactInformation;
       $this->contact->actor = $this->relation->object;
+      $this->contact->save();
+      $this->contact->makePrimaryContact();
     }
-
-    parent::processForm();
-
-    $this->contact->save();
-    $this->contact->makePrimaryContact();
   }
 
   public function execute($request)

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