Revision: 1239
http://sourceforge.net/p/gemstracker/code/1239
Author: matijsdejong
Date: 2013-04-18 15:59:52 +0000 (Thu, 18 Apr 2013)
Log Message:
-----------
Fixed that hardcoded values were not included in the original form data
Modified Paths:
--------------
trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php
Modified: trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php 2013-04-18 14:51:58 UTC (rev 1238)
+++ trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php 2013-04-18 15:59:52 UTC (rev 1239)
@@ -390,10 +390,10 @@
if ($this->request->isPost()) {
$this->formData = $this->request->getPost() + $this->formData;
} else {
- $model = $this->getModel();
-
// Assume that if formData is set it is the correct formData
if (! $this->formData) {
+ $model = $this->getModel();
+
if ($this->createData) {
$this->formData = $model->loadNew();
} else {
@@ -403,6 +403,15 @@
throw new Zend_Exception($this->_('Unknown edit data requested'));
}
}
+
+ // Check for values hardcoded in the model
+ if ($col = $model->getCol('value')) {
+ foreach ($col as $name => $value) {
+ if (! isset($this->formData[$name])) {
+ $this->formData[$name] = $value;
+ }
+ }
+ }
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|