|
From: <gem...@li...> - 2013-03-12 19:59:44
|
Revision: 1173
http://sourceforge.net/p/gemstracker/code/1173
Author: matijsdejong
Date: 2013-03-12 19:59:39 +0000 (Tue, 12 Mar 2013)
Log Message:
-----------
Separated Dutch settings from main respondent model
cleaned up tabform
cleaned up Model order
fixed bug in OrganizationEditSnippet.php caused by new tabform snippet
Modified Paths:
--------------
trunk/library/classes/Gems/Model/RespondentModel.php
trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php
trunk/library/classes/Gems/TabForm.php
trunk/library/classes/MUtil/Model/ModelAbstract.php
trunk/library/classes/MUtil/Validate/Db/UniqueValue.php
trunk/library/classes/MUtil/Validate/SimpleEmail.php
trunk/library/configs/db/tables/gems__respondent2org.50.sql
trunk/library/snippets/Organization/OrganizationEditSnippet.php
Added Paths:
-----------
trunk/library/classes/Gems/Model/RespondentNlModel.php
trunk/library/classes/Gems/Validate/OneOf.php
Modified: trunk/library/classes/Gems/Model/RespondentModel.php
===================================================================
--- trunk/library/classes/Gems/Model/RespondentModel.php 2013-03-07 17:06:55 UTC (rev 1172)
+++ trunk/library/classes/Gems/Model/RespondentModel.php 2013-03-12 19:59:39 UTC (rev 1173)
@@ -97,8 +97,8 @@
}
if (self::SSN_HASH === $this->hashSsn) {
$this->setSaveWhen('grs_ssn', array($this, 'whenSSN'));
- $this->setOnLoad('grs_ssn', array($this, 'saveSSN'));
- $this->setOnSave('grs_ssn', array($this, 'formatSSN'));
+ $this->setOnLoad('grs_ssn', array($this, 'hideSSN'));
+ $this->setOnSave('grs_ssn', array($this, 'saveSSN'));
}
}
@@ -218,6 +218,7 @@
public function applyDetailSettings($locale = null)
{
$dbLookup = $this->util->getDbLookup();
+ $localized = $this->util->getLocalized();
$translated = $this->util->getTranslated();
$translator = $this->translate->getAdapter();
@@ -240,16 +241,14 @@
// The SSN
if ($this->hashSsn !== Gems_Model_RespondentModel::SSN_HIDE) {
- $this->set('grs_ssn', 'label', $translator->_('SSN'));
+ $this->set('grs_ssn', 'label', $translator->_('SSN'),
+ 'tab', $translator->_('Identification'));
}
- $this->setIfExists('gr2o_patient_nr', 'label', $translator->_('Respondent number'));
+ $this->setIfExists('gr2o_patient_nr', 'label', $translator->_('Respondent number'),
+ 'tab', $translator->_('Identification'));
$this->setIfExists('grs_first_name', 'label', $translator->_('First name'));
- $this->setIfExists('grs_surname_prefix',
- 'label', $translator->_('Surname prefix'),
- 'description', $translator->_('de, van der, \'t, etc...')
- );
$this->setIfExists('grs_last_name', 'label', $translator->_('Last name'));
$this->setIfExists('grs_gender',
@@ -257,17 +256,38 @@
'multiOptions', $translated->getGenderHello()
);
- $this->setIfExists('grs_email', 'label', $translator->_('E-Mail'));
+ $this->setIfExists('grs_birthday',
+ 'label', $translator->_('Birthday'),
+ 'dateFormat', Zend_Date::DATE_MEDIUM
+ );
+ $this->setIfExists('gr2o_treatment', 'label', $translator->_('Treatment'));
+ $this->setIfExists('gr2o_comments', 'label', $translator->_('Comments'));
+
+ $this->setIfExists('grs_email', 'label', $translator->_('E-Mail'),
+ 'tab', $translator->_('Contact information'));
+
$this->setIfExists('grs_address_1', 'label', $translator->_('Street'));
+ $this->setIfExists('grs_address_2', 'label', $translator->_(' '));
+
+ // MUtil_Echo::track($this->getItemsOrdered());
+ //MUtil_Echo::track($this->getItemsOrdered(), $this->getOrder('grs_email'));
+
$this->setIfExists('grs_zipcode', 'label', $translator->_('Zipcode'));
$this->setIfExists('grs_city', 'label', $translator->_('City'));
+ $this->setIfExists('grs_iso_country', 'label', $translator->_('Country'),
+ 'multiOptions', $localized->getCountries());
$this->setIfExists('grs_phone_1', 'label', $translator->_('Phone'));
+ $this->setIfExists('grs_phone_2', 'label', $translator->_('Phone 2'));
+ $this->setIfExists('grs_phone_3', 'label', $translator->_('Phone 3'));
- $this->setIfExists('grs_birthday',
- 'label', $translator->_('Birthday'),
- 'dateFormat', Zend_Date::DATE_MEDIUM
+ $this->setIfExists('grs_iso_lang', 'label', $translator->_('Language'),
+ 'multiOptions', $localized->getLanguages(),
+ 'tab', $translator->_('Settings'));
+
+ $this->setIfExists('gr2o_consent', 'label', $translator->_('Consent'),
+ 'multiOptions', $dbLookup->getUserConsents()
);
$this->setIfExists('gr2o_opened',
@@ -275,16 +295,6 @@
'formatFunction', $translated->formatDateTime
);
- $this->setIfExists('gr2o_consent',
- 'label', $translator->_('Consent'),
- 'multiOptions', $dbLookup->getUserConsents()
- );
-
- $this->set('gr2o_comments', 'label', $translator->_('Comments'));
- $this->set('gr2o_treatment', 'label', $translator->_('Treatment'));
-
- $this->addColumn('CASE WHEN grs_email IS NULL OR LENGTH(TRIM(grs_email)) = 0 THEN 1 ELSE 0 END', 'calc_email');
-
return $this;
}
@@ -304,23 +314,7 @@
$ucfirst = new Zend_Filter_Callback('ucfirst');
if ($this->hashSsn !== Gems_Model_RespondentModel::SSN_HIDE) {
- $this->set('grs_ssn',
- 'size', 10,
- 'maxlength', 12,
- 'filter', 'Digits');
-
- if (APPLICATION_ENV !== 'production') {
- $bsn = new MUtil_Validate_Dutch_Burgerservicenummer();
- $num = mt_rand(100000000, 999999999);
-
- while (! $bsn->isValid($num)) {
- $num++;
- }
-
- $this->setIfExists('grs_ssn', 'description', sprintf($translator->_('Random Example BSN: %s'), $num));
- } else {
- $this->setIfExists('grs_ssn', 'description', $translator->_('Enter a 9-digit SSN number.'));
- }
+ $this->set('grs_ssn', 'validator[]', $this->createUniqueValidator('grs_ssn'));
}
$this->setIfExists('gr2o_patient_nr',
@@ -331,7 +325,23 @@
array('gr2o_id_user' => 'grs_id_user', 'gr2o_id_organization')
)
);
+ $this->set('grs_id_user');
+ $this->set('grs_email',
+ 'size', 30,
+ 'validator', 'SimpleEmail');
+ $this->addColumn('CASE WHEN grs_email IS NULL OR LENGTH(TRIM(grs_email)) = 0 THEN 1 ELSE 0 END', 'calc_email');
+ $this->set('calc_email',
+ 'label', $translator->_('Respondent has no e-mail'),
+ 'elementClass', 'Checkbox',
+ 'order', $this->getOrder('grs_email') + 1,
+ 'validator', new Gems_Validate_OneOf(
+ $translator->_('Respondent has no e-mail'),
+ 'grs_email',
+ $this->get('grs_email', 'label')
+ )
+ );
+
$this->setIfExists('grs_first_name', 'filter', $ucfirst);
$this->setIfExists('grs_last_name', 'filter', $ucfirst, 'required', true);
@@ -342,12 +352,34 @@
'tab', $translator->_('Medical data')
);
+ $this->setIfExists('grs_birthday',
+ 'jQueryParams', array('defaultDate' => '-30y', 'maxDate' => 0, 'yearRange' => 'c-130:c0'),
+ 'elementClass', 'Date',
+ 'validator', new MUtil_Validate_Date_DateBefore());
+
+ $this->setIfExists('gr2o_treatment', 'size', 30);
+ $this->setIfExists('gr2o_comments', 'elementClass', 'Textarea', 'rows', 4, 'cols', 60);
+
+ $this->setIfExists('grs_address_1',
+ 'size', 40,
+ 'description', $translator->_('With housenumber'),
+ 'filter', $ucfirst
+ );
+ $this->setIfExists('grs_address_2', 'size', 40);
+ $this->setIfExists('grs_city', 'filter', $ucfirst);
+ $this->setIfExists('grs_phone_1', 'size', 15);
+ $this->setIfExists('grs_phone_2', 'size', 15);
+ $this->setIfExists('grs_phone_3', 'size', 15);
+
$this->setIfExists('gr2o_opened', 'elementClass', 'Exhibitor');
- $this->setIfExists('gr2o_consent', 'default', $this->util->getDefaultConsent());
+ $this->setIfExists('gr2o_consent',
+ 'default', $this->util->getDefaultConsent(),
+ 'elementClass', 'Radio',
+ 'separator', '',
+ 'description', $translator->_('Has the respondent signed the informed consent letter?'),
+ 'required', true);
- $this->setIfExists('grs_iso_lang', 'default', 'nl');
-
return $this;
}
Added: trunk/library/classes/Gems/Model/RespondentNlModel.php
===================================================================
--- trunk/library/classes/Gems/Model/RespondentNlModel.php (rev 0)
+++ trunk/library/classes/Gems/Model/RespondentNlModel.php 2013-03-12 19:59:39 UTC (rev 1173)
@@ -0,0 +1,140 @@
+<?php
+
+/**
+ * Copyright (c) 2012, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Model
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @version $id: RespondentNlModel.php 203 2012-01-01t 12:51:32Z matijs $
+ */
+
+/**
+ * Class containing the Netherlands specific model extensions.
+ *
+ * Extend your project specific RespondentModel from this model to make it go Dutch.
+ *
+ * @package Gems
+ * @subpackage Model
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.6
+ */
+class Gems_Model_RespondentNlModel extends Gems_Model_RespondentModel
+{
+ /**
+ * Set those settings needed for the detailed display
+ *
+ * @param mixed $locale The locale for the settings
+ * @return \Gems_Model_RespondentModel
+ */
+ public function applyDetailSettings($locale = null)
+ {
+ parent::applyDetailSettings($locale);
+
+ $translator = $this->translate->getAdapter();
+
+ $this->setIfExists('grs_surname_prefix',
+ 'label', $translator->_('Surname prefix'),
+ 'description', $translator->_('de, van der, \'t, etc...'),
+ 'order', $this->getOrder('grs_first_name') + 1
+ );
+
+ return $this;
+ }
+
+ /**
+ * Set those values needed for editing
+ *
+ * @param mixed $locale The locale for the settings
+ * @return \Gems_Model_RespondentModel
+ */
+ public function applyEditSettings($locale = null)
+ {
+ parent::applyEditSettings($locale);
+ $translator = $this->translate->getAdapter();
+
+ if ($this->hashSsn !== Gems_Model_RespondentModel::SSN_HIDE) {
+ self::setDutchSsn($this, $translator);
+ }
+
+ $this->setIfExists('grs_iso_lang', 'default', 'nl');
+ $this->setIfExists('gr2o_treatment', 'description', $translator->_('DBC\'s, etc...'));
+
+ self::setDutchZipcode($this, $translator);
+
+ return $this;
+ }
+
+ /**
+ * Set the field values for a dutch social security number
+ *
+ * @param MUtil_Model_ModelAbstract $model
+ * @param Zend_Translate_Adapter $translator
+ * @param string $fieldName
+ */
+ public static function setDutchSsn(MUtil_Model_ModelAbstract $model, Zend_Translate_Adapter $translator, $fieldName = 'grs_ssn')
+ {
+ $bsn = new MUtil_Validate_Dutch_Burgerservicenummer();
+
+ $model->set($fieldName,
+ 'size', 10,
+ 'maxlength', 12,
+ 'filter', 'Digits',
+ 'validator[]', $bsn);
+
+ if (APPLICATION_ENV !== 'production') {
+ $num = mt_rand(100000000, 999999999);
+
+ while (! $bsn->isValid($num)) {
+ $num++;
+ }
+
+ $model->set($fieldName, 'description', sprintf($translator->_('Random Example BSN: %s'), $num));
+ } else {
+ $model->set($fieldName, 'description', $translator->_('Enter a 9-digit SSN number.'));
+ }
+ }
+
+ /**
+ * Set the field values for a dutch zipcode
+ *
+ * @param MUtil_Model_ModelAbstract $model
+ * @param Zend_Translate_Adapter $translator
+ * @param string $fieldName
+ */
+ public static function setDutchZipcode(MUtil_Model_ModelAbstract $model, Zend_Translate_Adapter $translator, $fieldName = 'grs_zipcode')
+ {
+ $model->set($fieldName,
+ 'size', 7,
+ 'description', $translator->_('E.g.: 0000 AA'),
+ 'filter', new Gems_Filter_DutchZipcode()
+ );
+ }
+}
Modified: trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php 2013-03-07 17:06:55 UTC (rev 1172)
+++ trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php 2013-03-12 19:59:39 UTC (rev 1173)
@@ -74,25 +74,29 @@
}
$bridge->setAllowedOptions(MUtil_Model_FormBridge::DISPLAY_OPTIONS, $displayOptions);
- $tab = 0;
- $group = 0;
+ $tab = 0;
+ $group = 0;
+ $oldTab = null;
+ // MUtil_Echo::track($model->getItemsOrdered());
foreach ($model->getItemsOrdered() as $name) {
// Get all options at once
$modelOptions = $model->get($name);
- if ($tabName = $model->get($name, 'tab')) {
+ $tabName = $model->get($name, 'tab');
+ if ($tabName && ($tabName !== $oldTab)) {
$bridge->addTab('tab' . $tab, 'value', $tabName);
+ $oldTab = $tabName;
$tab++;
}
if ($model->has($name, 'label')) {
$bridge->add($name);
-
- if ($theName = $model->get('startGroup')) {
+
+ if ($theName = $model->get($name, 'startGroup')) {
//We start a new group here!
$groupElements = array();
$groupElements[] = $name;
$groupName = $theName;
- } elseif ($theName = $model->get('endGroup')) {
+ } elseif ($theName = $model->get($name, 'endGroup')) {
//Ok, last element define the group
$groupElements[] = $name;
$bridge->addDisplayGroup('grp_' . $groupElements[0], $groupElements,
@@ -111,6 +115,7 @@
} else {
$bridge->addHidden($name);
}
+ unset($this->_items[$name]);
}
}
@@ -146,7 +151,10 @@
$form->resetContext();
}
$form->addElement($element);
+ $element->removeDecorator('HtmlTag');
+ $element->removeDecorator('Label');
$form->addDisplayGroup(array('formLinks'), 'form_buttons');
+ $form->getDisplayGroup(Gems_TabForm::GROUP_OTHER)->removeElement($element->getName());
}
}
Modified: trunk/library/classes/Gems/TabForm.php
===================================================================
--- trunk/library/classes/Gems/TabForm.php 2013-03-07 17:06:55 UTC (rev 1172)
+++ trunk/library/classes/Gems/TabForm.php 2013-03-12 19:59:39 UTC (rev 1173)
@@ -43,6 +43,11 @@
class Gems_TabForm extends Gems_Form
{
/**
+ * Group ID for elements below form
+ */
+ const GROUP_OTHER = 'not_in_tab';
+
+ /**
* Holds the last tab we added information to
*
* @var Gems_Form_TabSubForm
@@ -97,18 +102,40 @@
*/
public function addElement($element, $name = null, $options = null)
{
+ if ($element instanceof Zend_Form_Element_Hidden) {
+ parent::addElement($element, $name, $options);
+
+ //Remove decorators
+ $element->removeDecorator('HtmlTag');
+ $element->removeDecorator('Label');
+
+ $this->addToOtherGroup($element);
+
+ $element->removeDecorator('DtDdWrapper');
+
+ return $this;
+ }
+
if ($this->currentTab) {
return $this->currentTab->addElement($element, $name, $options);
} else {
parent::addElement($element, $name, $options);
+
if (is_string($element)) {
$element = $this->getElement($element);
}
+
+ $this->addToOtherGroup($element);
+
+ $element->removeDecorator('DtDdWrapper');
+
if ($element instanceof Zend_Form_Element_Hidden) {
//Remove decorators
- $element->removeDecorator('htmlTag');
+ $element->removeDecorator('HtmlTag');
$element->removeDecorator('Label');
+
} elseif ($element instanceof Zend_Form_Element) {
+
$error = $element->getDecorator('Errors');
if ($error instanceof Zend_Form_Decorator_Errors) {
$element->removeDecorator('Errors');
@@ -138,6 +165,24 @@
}
/**
+ * Add to the group all non-tab elements are in
+ *
+ * @param mixed $element
+ * @return \Gems_TabForm
+ */
+ public function addToOtherGroup($element)
+ {
+ if ($element instanceof Zend_Form_Element) {
+ if ($group = $this->getDisplayGroup(self::GROUP_OTHER)) {
+ $group->addElement($element);
+ } else {
+ $this->addDisplayGroup(array($element), self::GROUP_OTHER);
+ }
+ }
+ return $this;
+ }
+
+ /**
* Add an element to the form, when a tab (subform) had been added, it will return
* the subform instead of the form, keep this in mind when chaining methods
*
Added: trunk/library/classes/Gems/Validate/OneOf.php
===================================================================
--- trunk/library/classes/Gems/Validate/OneOf.php (rev 0)
+++ trunk/library/classes/Gems/Validate/OneOf.php 2013-03-12 19:59:39 UTC (rev 1173)
@@ -0,0 +1,123 @@
+<?php
+
+/**
+ * Copyright (c) 2012, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Validate
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @version $id: EmailCheck.php 203 2012-01-01t 12:51:32Z matijs $
+ */
+
+/**
+ * Check for one of the two values being filled
+ *
+ * @package Gems
+ * @subpackage Validate
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.6
+ */
+class Gems_Validate_OneOf extends Zend_Validate_Abstract
+{
+ /**
+ * Error codes
+ * @const string
+ */
+ const NEITHER = 'neither';
+
+ protected $_messageTemplates = array(
+ self::NEITHER => "Either '%description%' or '%fieldDescription%' must be entered.",
+ );
+
+ /**
+ * @var array
+ */
+ protected $_messageVariables = array(
+ 'description' => '_description',
+ 'fieldDescription' => '_fieldDescription'
+ );
+
+
+ protected $_description;
+
+ /**
+ * The field name against which to validate
+ * @var string
+ */
+ protected $_fieldName;
+
+ /**
+ * Description of field name against which to validate
+ * @var string
+ */
+ protected $_fieldDescription;
+
+ /**
+ * Sets validator options
+ *
+ * @param string $fieldName Field name against which to validate
+ * $param string $fieldDescription Description of field name against which to validate
+ * @return void
+ */
+ public function __construct($description, $fieldName, $fieldDescription)
+ {
+ $this->_description = $description;
+ $this->_fieldName = $fieldName;
+ $this->_fieldDescription = $fieldDescription;
+ }
+
+ /**
+ * Defined by Zend_Validate_Interface
+ *
+ * Returns true if and only if a token has been set and the provided value
+ * matches that token.
+ *
+ * @param mixed $value
+ * @return boolean
+ */
+ public function isValid($value, $context = array())
+ {
+ $this->_setValue((string) $value);
+
+ $fieldSet = (boolean) isset($context[$this->_fieldName]) && $context[$this->_fieldName];
+ $valueSet = (boolean) $value;
+
+ if ($valueSet && (! $fieldSet)) {
+ return true;
+ }
+
+ if ((! $valueSet) && $fieldSet) {
+ return true;
+ }
+
+ $this->_error(self::NEITHER);
+ return false;
+ }
+}
Modified: trunk/library/classes/MUtil/Model/ModelAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Model/ModelAbstract.php 2013-03-07 17:06:55 UTC (rev 1172)
+++ trunk/library/classes/MUtil/Model/ModelAbstract.php 2013-03-12 19:59:39 UTC (rev 1173)
@@ -712,15 +712,9 @@
*/
public function getItemsOrdered()
{
- $order = (array) $this->_model_order;
- asort($order);
- $result = array_keys($order);
- foreach($this->_model as $field => $element) {
- if (! array_key_exists($field, $order)) {
- $result[] = $field;
- }
- }
- return $result;
+ asort($this->_model_order);
+ $order = array_keys($this->_model_order);
+ return $order + array_diff(array_keys($this->_model), $order);
}
public function getItemsUsed()
Modified: trunk/library/classes/MUtil/Validate/Db/UniqueValue.php
===================================================================
--- trunk/library/classes/MUtil/Validate/Db/UniqueValue.php 2013-03-07 17:06:55 UTC (rev 1172)
+++ trunk/library/classes/MUtil/Validate/Db/UniqueValue.php 2013-03-12 19:59:39 UTC (rev 1173)
@@ -108,6 +108,9 @@
public function isValid($value, $context = array())
{
+ // Quick fix for context not being complete in subform
+ $context = $context + $_POST;
+
/**
* Check for an adapter being defined. if not, fetch the default adapter.
*/
@@ -180,7 +183,8 @@
} else {
$this->_exclude = null;
}
-
+ // MUtil_Echo::track($this->_exclude, $this->_checkFields, $this->_keyFields, $context, $_POST);
+
return parent::isValid($value, $context);
}
}
Modified: trunk/library/classes/MUtil/Validate/SimpleEmail.php
===================================================================
--- trunk/library/classes/MUtil/Validate/SimpleEmail.php 2013-03-07 17:06:55 UTC (rev 1172)
+++ trunk/library/classes/MUtil/Validate/SimpleEmail.php 2013-03-12 19:59:39 UTC (rev 1173)
@@ -1,47 +1,47 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
/**
- *
- * @author Matijs de Jong
- * @since 1.0
- * @version 1.1
- * @package MUtil
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
* @subpackage Validate
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @version $id: SimpleEmail.php 203 2012-01-01t 12:51:32Z matijs $
*/
/**
- *
- * @author Matijs de Jong
- * @package MUtil
+ *
+ * @package MUtil
* @subpackage Validate
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
*/
class MUtil_Validate_SimpleEmail extends Zend_Validate_Regex
{
Modified: trunk/library/configs/db/tables/gems__respondent2org.50.sql
===================================================================
--- trunk/library/configs/db/tables/gems__respondent2org.50.sql 2013-03-07 17:06:55 UTC (rev 1172)
+++ trunk/library/configs/db/tables/gems__respondent2org.50.sql 2013-03-12 19:59:39 UTC (rev 1173)
@@ -10,8 +10,8 @@
-- gr2o_id_physician bigint unsigned null
-- references gems_staff (gsf_id_user),
- -- gr2o_treatment varchar(200) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
- -- gr2o_comments text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gr2o_treatment varchar(200) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gr2o_comments text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
gr2o_consent varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'Unknown'
references gems__consents (gco_description),
Modified: trunk/library/snippets/Organization/OrganizationEditSnippet.php
===================================================================
--- trunk/library/snippets/Organization/OrganizationEditSnippet.php 2013-03-07 17:06:55 UTC (rev 1172)
+++ trunk/library/snippets/Organization/OrganizationEditSnippet.php 2013-03-12 19:59:39 UTC (rev 1173)
@@ -130,7 +130,7 @@
if (count($this->_items)>0 && !($bridge->getTab('other'))) {
$bridge->addTab('other', 'value', $this->_('Other'));
}
- parent::addFormElements($bridge, $model);
+ parent::addItems($bridge, $this->_items);
}
public function afterSave($changed)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|