Commit cd62e10527fa43eb8b3dde5b82da13754f4946ce
1 parent
8ba06eba
Exists in
master
Corrigido exclusão de deficiências
Criado confirmação para exclusão alertando que vínculos serão removidos; Removido vínculos ao confirmar uma exclusão de deficiência; portabilis/ieducar#129
Showing
2 changed files
with
23 additions
and
1 deletions
Show diff stats
ieducar/intranet/educar_deficiencia_cad.php
@@ -177,4 +177,17 @@ $miolo = new indice(); | @@ -177,4 +177,17 @@ $miolo = new indice(); | ||
177 | $pagina->addForm( $miolo ); | 177 | $pagina->addForm( $miolo ); |
178 | // gera o html | 178 | // gera o html |
179 | $pagina->MakeAll(); | 179 | $pagina->MakeAll(); |
180 | -?> | ||
181 | \ No newline at end of file | 180 | \ No newline at end of file |
181 | +?> | ||
182 | +<script type="text/javascript"> | ||
183 | + // Reescrita da função para exibir mensagem interativa | ||
184 | + function excluir() | ||
185 | + { | ||
186 | + document.formcadastro.reset(); | ||
187 | + | ||
188 | + if (confirm('Deseja mesmo excluir essa deficiência? \nVinculos com os alunos serão deletados.')) { | ||
189 | + document.formcadastro.tipoacao.value = 'Excluir'; | ||
190 | + document.formcadastro.submit(); | ||
191 | + } | ||
192 | + } | ||
193 | + | ||
194 | +</script> |
ieducar/intranet/include/pessoa/clsCadastroDeficiencia.inc.php
@@ -242,6 +242,7 @@ class clsCadastroDeficiencia | @@ -242,6 +242,7 @@ class clsCadastroDeficiencia | ||
242 | function excluir() | 242 | function excluir() |
243 | { | 243 | { |
244 | if (is_numeric($this->cod_deficiencia)) { | 244 | if (is_numeric($this->cod_deficiencia)) { |
245 | + $this->excluiVinculosDeficiencia($this->cod_deficiencia); | ||
245 | $db = new clsBanco(); | 246 | $db = new clsBanco(); |
246 | $db->Consulta("DELETE FROM {$this->_tabela} WHERE cod_deficiencia = '{$this->cod_deficiencia}'"); | 247 | $db->Consulta("DELETE FROM {$this->_tabela} WHERE cod_deficiencia = '{$this->cod_deficiencia}'"); |
247 | return TRUE; | 248 | return TRUE; |
@@ -250,6 +251,14 @@ class clsCadastroDeficiencia | @@ -250,6 +251,14 @@ class clsCadastroDeficiencia | ||
250 | return FALSE; | 251 | return FALSE; |
251 | } | 252 | } |
252 | 253 | ||
254 | + function excluiVinculosDeficiencia($deficienciaId){ | ||
255 | + $db = new clsBanco(); | ||
256 | + $db->Consulta(" UPDATE pmieducar.servidor SET ref_cod_deficiencia = NULL where ref_cod_deficiencia = {$deficienciaId};"); | ||
257 | + $db->Consulta(" DELETE FROM cadastro.fisica_deficiencia WHERE ref_cod_deficiencia = {$deficienciaId};"); | ||
258 | + return TRUE; | ||
259 | + } | ||
260 | + | ||
261 | + | ||
253 | /** | 262 | /** |
254 | * Define quais campos da tabela serão selecionados no método Lista(). | 263 | * Define quais campos da tabela serão selecionados no método Lista(). |
255 | */ | 264 | */ |