Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Suporte para validacao

  • Loading branch information...
commit 4123d9966c7b63ed8e74e51859f034c7c1c3cbbb 1 parent bc4b25f
DanielPk authored committed
Showing with 20 additions and 0 deletions.
  1. 0  .gitignore
  2. 0  README.textile
  3. 0  config/bootstrap.php
  4. 0  config/inflections.php
  5. 0  config/traducao_core.php
  6. 0  locale/pt_br/LC_MESSAGES/core.po
  7. 0  locale/pt_br/LC_TIME
  8. 0  models/behaviors/ajuste_data.php
  9. +20 −0 models/behaviors/ajuste_float.php
  10. 0  models/behaviors/correios.php
  11. 0  models/estado_brasileiro.php
  12. 0  tests/cases/config/i18n.test.php
  13. 0  tests/cases/config/inflections.test.php
  14. 0  tests/cases/models/behaviors/ajuste_data.test.php
  15. 0  tests/cases/models/behaviors/ajuste_float.test.php
  16. 0  tests/cases/models/behaviors/correios.test.php
  17. 0  tests/cases/models/estado_brasileiro.test.php
  18. 0  tests/cases/vendors/shells/templates/default/inflexao.test.php
  19. 0  tests/cases/views/helpers/estados.test.php
  20. 0  tests/cases/views/helpers/formatacao.test.php
  21. 0  tests/fixtures/produto_fixture.php
  22. 0  vendors/estados.php
  23. 0  vendors/shells/cake_ptbr_installer.php
  24. 0  vendors/shells/templates/default/actions/controller_actions.ctp
  25. 0  vendors/shells/templates/default/classes/controller.ctp
  26. 0  vendors/shells/templates/default/classes/fixture.ctp
  27. 0  vendors/shells/templates/default/classes/model.ctp
  28. 0  vendors/shells/templates/default/classes/test.ctp
  29. 0  vendors/shells/templates/default/inflexao.php
  30. 0  vendors/shells/templates/default/views/form.ctp
  31. 0  vendors/shells/templates/default/views/home.ctp
  32. 0  vendors/shells/templates/default/views/index.ctp
  33. 0  vendors/shells/templates/default/views/view.ctp
  34. 0  views/helpers/estados.php
  35. 0  views/helpers/formatacao.php
View
0  .gitignore 100644 → 100755
File mode changed
View
0  README.textile 100644 → 100755
File mode changed
View
0  config/bootstrap.php 100644 → 100755
File mode changed
View
0  config/inflections.php 100644 → 100755
File mode changed
View
0  config/traducao_core.php 100644 → 100755
File mode changed
View
0  locale/pt_br/LC_MESSAGES/core.po 100644 → 100755
File mode changed
View
0  locale/pt_br/LC_TIME 100644 → 100755
File mode changed
View
0  models/behaviors/ajuste_data.php 100644 → 100755
File mode changed
View
20 models/behaviors/ajuste_float.php
@@ -52,6 +52,24 @@ function setup(&$model, $config = array()) {
* @param array $query
* @return array
* @access public
+ */
+ function beforeValidate(&$model){
+ foreach($model->data[$model->alias] as $field => $value){
+ if ($model->hasField($field) && $model->_schema[$field]['type'] == 'float'){
+ $model->data[$model->alias][$field] = str_replace(array('.', ','), array('', '.'), $value);
+ }
+ }
+ return true;
+ }
+
+/**
+ * Before Find
+ * Transforma o valor de BRL para o formato SQL antes de executar uma query
+ * com conditions.
+ *
+ * @param object $model
+ * @return array
+ * @access public
*/
function beforeFind(&$model, $query) {
if (is_array($query['conditions'])) {
@@ -95,6 +113,8 @@ function beforeSave(&$model) {
return true;
}
+
+
/**
* After Find
View
0  models/behaviors/correios.php 100644 → 100755
File mode changed
View
0  models/estado_brasileiro.php 100644 → 100755
File mode changed
View
0  tests/cases/config/i18n.test.php 100644 → 100755
File mode changed
View
0  tests/cases/config/inflections.test.php 100644 → 100755
File mode changed
View
0  tests/cases/models/behaviors/ajuste_data.test.php 100644 → 100755
File mode changed
View
0  tests/cases/models/behaviors/ajuste_float.test.php 100644 → 100755
File mode changed
View
0  tests/cases/models/behaviors/correios.test.php 100644 → 100755
File mode changed
View
0  tests/cases/models/estado_brasileiro.test.php 100644 → 100755
File mode changed
View
0  tests/cases/vendors/shells/templates/default/inflexao.test.php 100644 → 100755
File mode changed
View
0  tests/cases/views/helpers/estados.test.php 100644 → 100755
File mode changed
View
0  tests/cases/views/helpers/formatacao.test.php 100644 → 100755
File mode changed
View
0  tests/fixtures/produto_fixture.php 100644 → 100755
File mode changed
View
0  vendors/estados.php 100644 → 100755
File mode changed
View
0  vendors/shells/cake_ptbr_installer.php 100644 → 100755
File mode changed
View
0  vendors/shells/templates/default/actions/controller_actions.ctp 100644 → 100755
File mode changed
View
0  vendors/shells/templates/default/classes/controller.ctp 100644 → 100755
File mode changed
View
0  vendors/shells/templates/default/classes/fixture.ctp 100644 → 100755
File mode changed
View
0  vendors/shells/templates/default/classes/model.ctp 100644 → 100755
File mode changed
View
0  vendors/shells/templates/default/classes/test.ctp 100644 → 100755
File mode changed
View
0  vendors/shells/templates/default/inflexao.php 100644 → 100755
File mode changed
View
0  vendors/shells/templates/default/views/form.ctp 100644 → 100755
File mode changed
View
0  vendors/shells/templates/default/views/home.ctp 100644 → 100755
File mode changed
View
0  vendors/shells/templates/default/views/index.ctp 100644 → 100755
File mode changed
View
0  vendors/shells/templates/default/views/view.ctp 100644 → 100755
File mode changed
View
0  views/helpers/estados.php 100644 → 100755
File mode changed
View
0  views/helpers/formatacao.php 100644 → 100755
File mode changed
Please sign in to comment.
Something went wrong with that request. Please try again.