Exemple #1
0
 /**
  *
  */
 public function isValid()
 {
     return parent::isValid();
 }
Exemple #2
0
 public function isValid()
 {
     $lbValid = parent::isValid();
     if ($this->getActionType() == 'add') {
         $laFindBy = $this->getObjectManager()->getRepository($this->getEntity())->findBy(array('stName' => String::escapeString($this->data['stName'])));
         if (isset($laFindBy[0]) && is_object($laFindBy[0])) {
             $lbValid = false;
             $this->get('stName')->setMessages(array(Translator::i18n('Este nome de grupo já está sendo utilizado!')));
         }
     } else {
         $this->data['stName'] = $this->getEntityData()->get('stName');
     }
     return $lbValid;
 }
Exemple #3
0
 public function isValid()
 {
     $lbValid = parent::isValid();
     if (!empty($this->data['stOldPassword'])) {
         $lsPasswordGiven = String::encriptPassword($this->data['stOldPassword'], $this->getEntityData()->get('stPasswordSalt'));
         if ($lsPasswordGiven == $this->getEntityData()->get('stPassword')) {
             if ($this->data['stOldPassword'] != $this->data['stPassword']) {
                 if ($this->data['stPassword'] != $this->data['stConfirmation']) {
                     $lbValid = false;
                     $this->get('stConfirmation')->setMessages(array(Translator::i18n('A confirmação não confere com a senha!')));
                 }
             } else {
                 $lbValid = false;
                 $this->get('stPassword')->setMessages(array(Translator::i18n('A nova senha deve ser diferente da senha atual!')));
             }
         } else {
             $lbValid = false;
             $this->get('stOldPassword')->setMessages(array(Translator::i18n('A senha atual não confere com a registrada!')));
         }
     } else {
         $this->data['stPassword'] = $this->getEntityData()->get('stPassword');
     }
     return $lbValid;
 }
Exemple #4
0
 public function isValidx()
 {
     $lbValid = parent::isValid();
     if ($this->getActionType() == 'add') {
         $loFound = $this->getObjectManager()->getRepository($this->_sEntity)->findOneBy(array('stUsername' => String::escapeString($this->data['stUsername'])));
         if (is_object($loFound)) {
             $lbValid = false;
             $this->get('stUsername')->setMessages(array(Translator::i18n('Este nome de usuário já está sendo utilizado!')));
         }
         $loFound = $this->getObjectManager()->getRepository($this->_sEntity)->findOneBy(array('stEmail' => String::escapeString($this->data['stEmail'])));
         if (is_object($loFound)) {
             $lbValid = false;
             $this->get('stEmail')->setMessages(array(Translator::i18n('Este email de contato já está sendo utilizado!')));
         }
         if ($this->data['stPassword'] != $this->data['stConfirmation']) {
             $lbValid = false;
             $this->get('stConfirmation')->setMessages(array(Translator::i18n('A confirmação da senha não confere!')));
         }
     } else {
         $this->data['stUsername'] = $this->getEntityData()->get('stUsername');
         $loFound = $this->getObjectManager()->getRepository($this->_sEntity)->findOneBy(array('stEmail' => String::escapeString($this->data['stEmail'])));
         if (is_object($loFound) && $loFound->get('id') != $this->data['id']) {
             $lbValid = false;
             $this->get('stEmail')->setMessages(array(Translator::i18n('Este email de contato já está sendo utilizado!')));
         }
         if (!empty($this->data['stOldPassword'])) {
             $lsPasswordGiven = String::encriptPassword($this->data['stOldPassword'], $this->getEntityData()->get('stPasswordSalt'));
             if ($lsPasswordGiven == $this->getEntityData()->get('stPassword')) {
                 if ($this->data['stOldPassword'] != $this->data['stPassword']) {
                     if ($this->data['stPassword'] != $this->data['stConfirmation']) {
                         $lbValid = false;
                         $this->get('stConfirmation')->setMessages(array(Translator::i18n('A confirmação não confere com a senha!')));
                     }
                 } else {
                     $lbValid = false;
                     $this->get('stPassword')->setMessages(array(Translator::i18n('A nova senha deve ser diferente da senha atual!')));
                 }
             } else {
                 $lbValid = false;
                 $this->get('stOldPassword')->setMessages(array(Translator::i18n('A senha atual não confere com a registrada!')));
             }
         } else {
             $this->data['stPassword'] = $this->getEntityData()->get('stPassword');
         }
     }
     return $lbValid;
 }