Author: sevein
Date: Mon Jul 25 22:50:10 2011
New Revision: 9380
Log:
Add contact information fields to donor dialog
Modified:
trunk/plugins/qtAccessionPlugin/modules/accession/actions/relatedDonorComponent.class.php
trunk/plugins/qtAccessionPlugin/modules/accession/templates/_relatedDonor.php
Modified:
trunk/plugins/qtAccessionPlugin/modules/accession/actions/relatedDonorComponent.class.php
==============================================================================
---
trunk/plugins/qtAccessionPlugin/modules/accession/actions/relatedDonorComponent.class.php
Mon Jul 25 14:23:19 2011 (r9379)
+++
trunk/plugins/qtAccessionPlugin/modules/accession/actions/relatedDonorComponent.class.php
Mon Jul 25 22:50:10 2011 (r9380)
@@ -24,7 +24,17 @@
$NAMES = array(
'authorizedFormOfName',
'resource',
- 'type');
+ 'type',
+
+ // Contact information
+ 'city',
+ 'contactPerson',
+ 'countryCode',
+ 'email',
+ 'postalCode',
+ 'region',
+ 'streetAddress',
+ 'telephone');
protected function addField($name)
{
@@ -43,12 +53,59 @@
break;
+ case 'countryCode':
+ $this->form->setValidator('countryCode', new
sfValidatorI18nChoiceCountry);
+ $this->form->setWidget('countryCode', new
sfWidgetFormI18nChoiceCountry(array('add_empty' => true, 'culture' =>
$this->context->user->getCulture())));
+
+ case 'city':
+ case 'contactPerson':
+ case 'email':
+ case 'postalCode':
+ case 'region':
+ case 'streetAddress':
+ case 'telephone':
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormInput);
+
default:
return parent::addField($name);
}
}
+ protected function processField($field)
+ {
+ switch ($field->getName())
+ {
+ case 'city':
+ case 'contactPerson':
+ case 'email':
+ case 'postalCode':
+ case 'region':
+ case 'streetAddress':
+ case 'telephone':
+ $this->contact[$field->getName()] =
$this->form->getValue($field->getName());
+
+ default:
+
+ parent::processField($field);
+ }
+ }
+
+ public function processForm()
+ {
+ if (null === $contact = $this->relation->object->getPrimaryContact())
+ {
+ $this->contact = new QubitContactInformation;
+ $this->contact->actor = $this->relation->object;
+ }
+
+ parent::processForm();
+
+ $this->contact->save();
+ $this->contact->makePrimaryContact();
+ }
+
public function execute($request)
{
parent::execute($request);
Modified:
trunk/plugins/qtAccessionPlugin/modules/accession/templates/_relatedDonor.php
==============================================================================
---
trunk/plugins/qtAccessionPlugin/modules/accession/templates/_relatedDonor.php
Mon Jul 25 14:23:19 2011 (r9379)
+++
trunk/plugins/qtAccessionPlugin/modules/accession/templates/_relatedDonor.php
Mon Jul 25 22:50:10 2011 (r9380)
@@ -94,6 +94,24 @@
<input class="list" type="hidden" value="<?php echo
url_for(array('module' => 'donor', 'action' => 'autocomplete')) ?>"/>
</div>
+ <?php echo $form->streetAddress->renderRow() ?>
+
+ <?php echo $form->region
+ ->label(__('Region/province'))
+ ->renderRow() ?>
+
+ <?php echo $form->countryCode
+ ->label(__('Country'))
+ ->renderRow(array('class' => 'form-autocomplete')) ?>
+
+ <?php echo $form->postalCode->renderRow() ?>
+
+ <?php echo $form->telephone->renderRow() ?>
+
+ <?php echo $form->email->renderRow() ?>
+
+ <?php echo $form->contactPerson->renderRow() ?>
+
</div>
</div>
--
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.