Commit 5a5f3824faf028f37ff8836582d86826edd678cd
Committed by
Rafael Santos
1 parent
3483e0c4
Exists in
master
Nao permite que dois tombos iguais sejam registrados no cadastrado de exemplar
Showing
1 changed file
with
11 additions
and
2 deletions
Show diff stats
ieducar/intranet/include/pmieducar/clsPmieducarExemplar.inc.php
@@ -395,13 +395,22 @@ class clsPmieducarExemplar | @@ -395,13 +395,22 @@ class clsPmieducarExemplar | ||
395 | $campos .= "{$gruda}ativo"; | 395 | $campos .= "{$gruda}ativo"; |
396 | $valores .= "{$gruda}'1'"; | 396 | $valores .= "{$gruda}'1'"; |
397 | $gruda = ", "; | 397 | $gruda = ", "; |
398 | - if( is_string( $this->data_aquisicao ) ) | 398 | + |
399 | + if( is_string( $this->data_aquisicao ) ) | ||
399 | { | 400 | { |
400 | $campos .= "{$gruda}data_aquisicao"; | 401 | $campos .= "{$gruda}data_aquisicao"; |
401 | $valores .= "{$gruda}'{$this->data_aquisicao}'"; | 402 | $valores .= "{$gruda}'{$this->data_aquisicao}'"; |
402 | $gruda = ", "; | 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 | $db->Consulta( "INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )" ); | 415 | $db->Consulta( "INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )" ); |
407 | return $db->InsertId( "{$this->_tabela}_cod_exemplar_seq"); | 416 | return $db->InsertId( "{$this->_tabela}_cod_exemplar_seq"); |