From 9de53ef46f9f4b3fe678d1f0ac695fd8d44954bc Mon Sep 17 00:00:00 2001 From: Sesostris Vieira Date: Wed, 6 Aug 2014 17:17:56 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20de=20bugs=20na=20valida?= =?UTF-8?q?=C3=A7=C3=A3o=20do=20CPF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- field.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/field.class.php b/field.class.php index 7932001..d1e4056 100644 --- a/field.class.php +++ b/field.class.php @@ -21,11 +21,16 @@ class profile_field_cpf extends profile_field_base { } function edit_validate_field($usernew) { + // Get default validation errors + $errors = parent::edit_validate_field($usernew); + if ($errors) { + return $errors; + } + // Based on script by Moacir, in http://codigofonte.uol.com.br/codigos/validacao-de-cpf-com-php - $errors = array(); if (isset($usernew->{$this->inputname})) { $cpf = $usernew->{$this->inputname}; - if (ctype_digit($cpf)) { + if (!ctype_digit($cpf)) { return array($this->inputname => get_string('cpf_digits', 'profilefield_cpf')); } if (strlen($cpf) != 11) {