comanage-dev - [comanage-dev] r236 - registry/trunk/app/Controller
Subject: COmanage Developers List
List archive
- From:
- To:
- Subject: [comanage-dev] r236 - registry/trunk/app/Controller
- Date: Fri, 24 Feb 2012 04:08:01 -0500
Author: marie
Date: 2012-02-24 04:07:59 -0500 (Fri, 24 Feb 2012)
New Revision: 236
Modified:
registry/trunk/app/Controller/CoNsfDemographicsController.php
Log:
co257
Modified: registry/trunk/app/Controller/CoNsfDemographicsController.php
===================================================================
--- registry/trunk/app/Controller/CoNsfDemographicsController.php
2012-02-23 15:26:24 UTC (rev 235)
+++ registry/trunk/app/Controller/CoNsfDemographicsController.php
2012-02-24 09:07:59 UTC (rev 236)
@@ -89,7 +89,7 @@
* @return boolean true if dependency checks succeed, false otherwise.
*/
- function checkWriteDependencies($curdata = null) {
+ function checkWriteDependencies($reqdata, $curdata = null) {
// Look up id
$cmr = $this->calculateCMRoles();
@@ -132,16 +132,55 @@
return false;
}
+ return true;
+ }
- // Data doesn't already exist so encode for writing
- $encoded =
$this->CoNsfDemographic->encodeOptions($this->request->data['CoNsfDemographic']);
- if(isset($encoded['race']))
- $this->request->data['CoNsfDemographic']['race'] =
$encoded['race'];
- if(isset($encoded['disability']))
- $this->request->data['CoNsfDemographic']['disability'] =
$encoded['disability'];
+ /**
+ * Convert data to prepare for saving to database
+ * - precondition: $this->request->data['CoNsfDemographic'] holds data to
be saved
+ * - postcondition: $this->request->data['CoNsfDemographic'] is modified
+ *
+ * @since COmanage Registry v0.4
+ */
- return true;
+ function convertData(){
+ if(!empty($this->request->data))
+ {
+ // Data doesn't already exist so encode for writing
+ $encoded =
$this->CoNsfDemographic->encodeOptions($this->request->data['CoNsfDemographic']);
+ if(isset($encoded['race']))
+ $this->request->data['CoNsfDemographic']['race'] =
$encoded['race'];
+ if(isset($encoded['disability']))
+ $this->request->data['CoNsfDemographic']['disability'] =
$encoded['disability'];
+ }
}
+
+ /**
+ * Override add of StandardController to convert data before calling it
+ * - precondition: $this->request->data['CoNsfDemographic'] holds data to
be saved
+ * - postcondition: $this->request->data['CoNsfDemographic'] is modified
+ *
+ * @since COmanage Registry v0.4
+ */
+
+ function add() {
+ $this->convertData();
+ parent::add();
+ }
+
+ /**
+ * Override edit of StandardController to convert data before calling it
+ * - precondition: $this->request->data['CoNsfDemographic'] holds data to
be saved
+ * - postcondition: $this->request->data['CoNsfDemographic'] is modified
+ *
+ * @since COmanage Registry v0.4
+ * @param int id
+ */
+
+ function edit($id) {
+ $this->convertData();
+ parent::edit($id);
+ }
/**
* Redirect to add if no record found.
- [comanage-dev] r236 - registry/trunk/app/Controller, svnlog, 02/24/2012
Archive powered by MHonArc 2.6.16.