Skip to Content.
Sympa Menu

comanage-dev - [comanage-dev] r572 - in registry/trunk/app: Config/Schema Lib Model View/CoEnrollmentAttributes

Subject: COmanage Developers List

List archive

[comanage-dev] r572 - in registry/trunk/app: Config/Schema Lib Model View/CoEnrollmentAttributes


Chronological Thread 
  • From:
  • To:
  • Subject: [comanage-dev] r572 - in registry/trunk/app: Config/Schema Lib Model View/CoEnrollmentAttributes
  • Date: Sat, 3 Aug 2013 18:16:48 -0400

Author: benno
Date: 2013-08-03 18:16:47 -0400 (Sat, 03 Aug 2013)
New Revision: 572

Modified:
registry/trunk/app/Config/Schema/schema.xml
registry/trunk/app/Lib/lang.php
registry/trunk/app/Model/CoEnrollmentAttribute.php
registry/trunk/app/Model/CoPetition.php
registry/trunk/app/View/CoEnrollmentAttributes/fields.inc
Log:
Single Petition Field Populates Org Identity and CO Person Record (CO-485)

Modified: registry/trunk/app/Config/Schema/schema.xml
===================================================================
--- registry/trunk/app/Config/Schema/schema.xml 2013-08-01 21:17:53 UTC (rev
571)
+++ registry/trunk/app/Config/Schema/schema.xml 2013-08-03 22:16:47 UTC (rev
572)
@@ -570,6 +570,7 @@
</field>
<field name="required" type="I" />
<field name="ordr" type="I" />
+ <field name="copy_to_coperson" type="L" />
<field name="created" type="T" />
<field name="modified" type="T" />


Modified: registry/trunk/app/Lib/lang.php
===================================================================
--- registry/trunk/app/Lib/lang.php 2013-08-01 21:17:53 UTC (rev 571)
+++ registry/trunk/app/Lib/lang.php 2013-08-03 22:16:47 UTC (rev 572)
@@ -47,7 +47,7 @@

// COs Controllers
'co.cm.gradmin' => 'COmanage Platform Administrators',
- 'co.cm.desc' => 'COmanage Gears Internal CO',
+ 'co.cm.desc' => 'COmanage Registry Internal CO',
'co.init' => 'No COs found, initial CO created',
'co.nomember' => 'You are not a member of any COs',
'co.select' => 'Select the CO you wish to work with.',
@@ -410,6 +410,7 @@
'fd.directory' => 'Directory',
'fd.domain' => 'Domain',
// Enrollment configuration fields
+ 'fd.ea.attr.copy2cop' => 'Copy this attribute to the CO Person record',
'fd.ea.desc' => 'Description',
'fd.ea.desc.desc' => 'Descriptive text to be displayed when prompting for
this attribute (like this text you\'re reading now)',
'fd.ea.label' => 'Label',

Modified: registry/trunk/app/Model/CoEnrollmentAttribute.php
===================================================================
--- registry/trunk/app/Model/CoEnrollmentAttribute.php 2013-08-01 21:17:53
UTC (rev 571)
+++ registry/trunk/app/Model/CoEnrollmentAttribute.php 2013-08-03 22:16:47
UTC (rev 572)
@@ -71,6 +71,9 @@
'rule' => '/.*/',
'required' => false,
'allowEmpty' => true
+ ),
+ 'copy_to_coperson' => array(
+ 'rule' => 'boolean'
)
);


Modified: registry/trunk/app/Model/CoPetition.php
===================================================================
--- registry/trunk/app/Model/CoPetition.php 2013-08-01 21:17:53 UTC (rev
571)
+++ registry/trunk/app/Model/CoPetition.php 2013-08-03 22:16:47 UTC (rev
572)
@@ -299,6 +299,14 @@
$fArgs['fields'] = array('CoEnrollmentAttribute.id',
'CoEnrollmentAttribute.required');
$reqAttrs = $this->CoEnrollmentFlow->CoEnrollmentAttribute->find("list",
$fArgs);

+ // Obtain a list of attributes that are to be copied to the CO Person
(Role) from the Org Identity
+
+ $cArgs = array();
+ $cArgs['conditions']['CoEnrollmentAttribute.co_enrollment_flow_id'] =
$enrollmentFlowID;
+ $cArgs['conditions']['CoEnrollmentAttribute.copy_to_coperson'] = true;
+ $cArgs['fields'] = array('CoEnrollmentAttribute.id',
'CoEnrollmentAttribute.attribute');
+ $copyAttrs =
$this->CoEnrollmentFlow->CoEnrollmentAttribute->find("list", $cArgs);
+
// Adjust validation rules for top level attributes only (OrgIdentity,
CO Person, CO Person Role)
// and validate those models without validating the associated models.

@@ -430,6 +438,19 @@
$fail = true;
}

+ // Loop through all EmailAddresses, Identifiers, and Names to see if
there are any
+ // we should copy to the CO Person.
+
+ foreach(array('EmailAddress', 'Identifier', 'Name') as $m) {
+ foreach(array_keys($orgData[$m]) as $a) {
+ // $a will be the co_enrollment_attribute:id, so we can tell
different
+ // addresses apart
+ if(isset($copyAttrs[$a])) {
+ $coData[$m][$a] = $orgData[$m][$a];
+ }
+ }
+ }
+
// Save the CO Person Data

if(!$fail) {
@@ -499,6 +520,19 @@
throw new InvalidArgumentException(_txt('er.fields'));
}

+ // Loop through all Addresses and Telephone Numbers to see if there
are any
+ // we should copy to the CO Person Role.
+
+ foreach(array('Address', 'TelephoneNumber') as $m) {
+ foreach(array_keys($orgData[$m]) as $a) {
+ // $a will be the co_enrollment_attribute:id, so we can tell
different
+ // addresses apart
+ if(isset($copyAttrs[$a])) {
+ $coRoleData[$m][$a] = $orgData[$m][$a];
+ }
+ }
+ }
+
// Save the CO Person Role data

if($this->EnrolleeCoPersonRole->saveAssociated($coRoleData,
array("validate" => false, "atomic" => true))) {

Modified: registry/trunk/app/View/CoEnrollmentAttributes/fields.inc
===================================================================
--- registry/trunk/app/View/CoEnrollmentAttributes/fields.inc 2013-08-01
21:17:53 UTC (rev 571)
+++ registry/trunk/app/View/CoEnrollmentAttributes/fields.inc 2013-08-03
22:16:47 UTC (rev 572)
@@ -25,6 +25,7 @@
<script type="text/javascript">
function js_local_onload() {
toggle_attr_def_div();
+ toggle_copy_to_coperson_div();
}

function ext_attr_type(attrname) {
@@ -127,6 +128,18 @@
$("#attr_def_div").hide("slide", { "direction" : "up" });
}
}
+
+ function toggle_copy_to_coperson_div() {
+ var curattr =
document.getElementById('CoEnrollmentAttributeAttribute').value;
+ var attrtype = curattr[0];
+
+ if(attrtype == "i") {
+ $("#copy_to_coperson_div").show("fade");
+ } else {
+ $("#copy_to_coperson_div").hide("fade");
+
document.getElementById('CoEnrollmentAttributeCopyToCoperson').checked=false;
+ }
+ }
</script>
<?php
// Determine if fields are editable
@@ -183,7 +196,7 @@
?
$co_enrollment_attributes[0]['CoEnrollmentAttribute']['attribute']
: null);
$attrs['empty'] = false;
- $attrs['onchange'] = "toggle_attr_def_div()";
+ $attrs['onchange'] =
"toggle_attr_def_div();toggle_copy_to_coperson_div();";

if($e) {
print $this->Form->select('attribute',
@@ -194,9 +207,18 @@
print $this->Form->error('status');
}
} else {
- print
Sanitize::html($co_enrollment_flows[0]['CoEnrollmentAttribute']['attribute']);
+ print
Sanitize::html($co_enrollment_attributes[0]['CoEnrollmentAttribute']['attribute']);
}
?>
+ <div id="copy_to_coperson_div" style="display: none">
+ <?php print ($e
+ ? $this->Form->input('copy_to_coperson',
+ array('default' => false))
+ :
($co_enrollment_attributes[0]['CoEnrollmentAttribute'][0]['copy_to_coperson']
+ ? _txt('fd.yes') : _txt('fd.no')));
+ print _txt('fd.ea.attr.copy2cop');
+ ?>
+ </div>
</td>
</tr>
<tr class="line2">



  • [comanage-dev] r572 - in registry/trunk/app: Config/Schema Lib Model View/CoEnrollmentAttributes, svnlog, 08/03/2013

Archive powered by MHonArc 2.6.16.

Top of Page