comanage-dev - [comanage-dev] r340 - registry/trunk/app/Model
Subject: COmanage Developers List
List archive
- From:
- To:
- Subject: [comanage-dev] r340 - registry/trunk/app/Model
- Date: Thu, 16 Aug 2012 23:52:45 -0400
Author: benno
Date: 2012-08-16 23:52:45 -0400 (Thu, 16 Aug 2012)
New Revision: 340
Modified:
registry/trunk/app/Model/CoEnrollmentAttribute.php
registry/trunk/app/Model/CoPetition.php
Log:
Fix calls to wrong method to get extended types (CO-413)
Modified: registry/trunk/app/Model/CoEnrollmentAttribute.php
===================================================================
--- registry/trunk/app/Model/CoEnrollmentAttribute.php 2012-08-15 08:05:21
UTC (rev 339)
+++ registry/trunk/app/Model/CoEnrollmentAttribute.php 2012-08-17 03:52:45
UTC (rev 340)
@@ -105,8 +105,8 @@
$ret['p:name:'.$k] = _txt('fd.name') . " (" . $cm_texts[ $cm_lang
]['en.name'][$k] . ", " . _txt('ct.co_people.1') . ")";
// Identifier types can be extended, and so require a bit of work to
assemble
- $coExtendedType = ClassRegistry::init('CoExtendedType');
- $identifierTypes = $coExtendedType->active($coid, 'Identifier', 'list');
+ $Identifier = ClassRegistry::init('Identifier');
+ $identifierTypes = $Identifier->types($coid);
foreach(array_keys($identifierTypes) as $k)
$ret['p:identifier:'.$k] = _txt('fd.identifier.identifier') . " (" .
$identifierTypes[$k] . ", " . _txt('ct.co_people.1') . ")";
@@ -144,8 +144,9 @@
foreach(array_keys($cm_texts[ $cm_lang ]['en.name']) as $k)
$ret['i:name:'.$k] = _txt('fd.name') . " (" . $cm_texts[ $cm_lang
]['en.name'][$k] . ", " . _txt('ct.org_identities.1') . ")";
- foreach(array_keys($cm_texts[ $cm_lang ]['en.identifier']) as $k)
- $ret['i:identifier:'.$k] = _txt('fd.identifier.identifier') . " (" .
$cm_texts[ $cm_lang ]['en.identifier'][$k] . ", " .
_txt('ct.org_identities.1') . ")";
+ // Handle extended types, using the same types as above
+ foreach(array_keys($identifierTypes) as $k)
+ $ret['i:identifier:'.$k] = _txt('fd.identifier.identifier') . " (" .
$identifierTypes[$k] . ", " . _txt('ct.org_identities.1') . ")";
foreach(array_keys($cm_texts[ $cm_lang ]['en.contact.address']) as $k)
$ret['i:address:'.$k] = _txt('fd.address') . " (" . $cm_texts[
$cm_lang ]['en.contact.address'][$k] . ", " . _txt('ct.org_identities.1') .
")";
Modified: registry/trunk/app/Model/CoPetition.php
===================================================================
--- registry/trunk/app/Model/CoPetition.php 2012-08-15 08:05:21 UTC (rev
339)
+++ registry/trunk/app/Model/CoPetition.php 2012-08-17 03:52:45 UTC (rev
340)
@@ -230,16 +230,18 @@
// rule for validateExtendedType.
if(isset($this->$m[0]->$m[1]->validate[ $efAttr['field']
]['rule'][0])
- && $this->$m[0]->$m[1]->validate[ $efAttr['field'] ]['rule'][0]
== 'validateExtendedType') {
- // Change rule[0] to inList and rule[1] to the list as returned by
CoExtendedType::active
+ && $this->$m[0]->$m[1]->validate[ $efAttr['field'] ]['rule'][0]
== 'validateExtendedType') {
+ // Change rule[0] to inList and rule[1] to the list as returned by
Model->types(). We need to retrieve
+ // the list before we start changing the validation rules, since
Model->types() needs to know
+ // the default values.
+ // Load the model this extended type applies to so we can figure
out its instantiated types
+ $extTypeModel = ClassRegistry::init($m[1]);
+ $extTypeValues = $extTypeModel->types($coId);
+
$this->$m[0]->$m[1]->validate[ $efAttr['field'] ]['rule'] =
array();
$this->$m[0]->$m[1]->validate[ $efAttr['field'] ]['rule'][] =
'inList';
-
- $coExtendedType = ClassRegistry::init('CoExtendedType');
- $this->$m[0]->$m[1]->validate[ $efAttr['field'] ]['rule'][] =
array_keys($coExtendedType->active($coId,
-
$m[1],
-
'list'));
+ $this->$m[0]->$m[1]->validate[ $efAttr['field'] ]['rule'][] =
array_keys($extTypeValues);
}
}
}
- [comanage-dev] r340 - registry/trunk/app/Model, svnlog, 08/16/2012
Archive powered by MHonArc 2.6.16.