Commit 5a5f3824faf028f37ff8836582d86826edd678cd

Authored by Greg Ouyama + Vanessa Barbosa
Committed by Rafael Santos
1 parent 3483e0c4
Exists in master

Nao permite que dois tombos iguais sejam registrados no cadastrado de exemplar

ieducar/intranet/include/pmieducar/clsPmieducarExemplar.inc.php
... ... @@ -395,13 +395,22 @@ class clsPmieducarExemplar
395 395 $campos .= "{$gruda}ativo";
396 396 $valores .= "{$gruda}'1'";
397 397 $gruda = ", ";
398   - if( is_string( $this->data_aquisicao ) )
  398 +
  399 + if( is_string( $this->data_aquisicao ) )
399 400 {
400 401 $campos .= "{$gruda}data_aquisicao";
401 402 $valores .= "{$gruda}'{$this->data_aquisicao}'";
402 403 $gruda = ", ";
403 404 }
404   -
  405 +
  406 + if($this->tombo != NULL){
  407 + $sql = "SELECT * FROM pmieducar.exemplar WHERE tombo = {$this->tombo}";
  408 + $consulta = new clsBanco();
  409 + $tombo = $consulta->CampoUnico($sql);
  410 + if($tombo != NULL){
  411 + return false;
  412 + }
  413 + }
405 414  
406 415 $db->Consulta( "INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )" );
407 416 return $db->InsertId( "{$this->_tabela}_cod_exemplar_seq");
... ...