Commit 338e8ec608baf0be8c34dc56fcea284ceb17bcd9
1 parent
b8464ff7
Exists in
master
Corrigida condicional que evitava a seleção de servidores alocados em uma escola…
…, já que sempre o primeiro {{{if (is_string($str_tipo))}}} retornava "TRUE"
Showing
1 changed file
with
7 additions
and
13 deletions
Show diff stats
ieducar/intranet/include/pmieducar/clsPmieducarServidor.inc.php
| ... | ... | @@ -525,30 +525,24 @@ class clsPmieducarServidor |
| 525 | 525 | |
| 526 | 526 | // Seleciona apenas servidores que tenham a carga atual maior ou igual ao |
| 527 | 527 | // do servidor atual |
| 528 | - if (is_string($str_tipo)) { | |
| 529 | - switch ($str_tipo) { | |
| 530 | - case "livre": | |
| 531 | - if (is_numeric($int_ref_cod_instituicao)) { | |
| 532 | - $where = " AND s.ref_cod_instituicao = '{$int_ref_cod_instituicao}' "; | |
| 533 | - $where2 = " AND sa.ref_ref_cod_instituicao = '{$int_ref_cod_instituicao}' "; | |
| 534 | - } | |
| 528 | + if (is_string($str_tipo) && $str_tipo == 'livre') { | |
| 529 | + if (is_numeric($int_ref_cod_instituicao)) { | |
| 530 | + $where = " AND s.ref_cod_instituicao = '{$int_ref_cod_instituicao}' "; | |
| 531 | + $where2 = " AND sa.ref_ref_cod_instituicao = '{$int_ref_cod_instituicao}' "; | |
| 532 | + } | |
| 535 | 533 | |
| 536 | - $filtros .= " | |
| 534 | + $filtros .= " | |
| 537 | 535 | {$whereAnd} NOT EXISTS |
| 538 | 536 | (SELECT 1 |
| 539 | 537 | FROM pmieducar.servidor_alocacao sa |
| 540 | 538 | WHERE sa.ref_cod_servidor = s.cod_servidor $where2)"; |
| 541 | 539 | |
| 542 | - $filtros .= " | |
| 540 | + $filtros .= " | |
| 543 | 541 | {$whereAnd} (s.carga_horaria::text || ':00:00') >= COALESCE( |
| 544 | 542 | (SELECT SUM(carga_horaria)::text |
| 545 | 543 | FROM pmieducar.servidor_alocacao saa |
| 546 | 544 | WHERE saa.ref_cod_servidor = {$str_not_in_servidor}),'00:00') $where"; |
| 547 | 545 | |
| 548 | - $whereAnd = " AND "; | |
| 549 | - break; | |
| 550 | - } | |
| 551 | - | |
| 552 | 546 | $whereAnd = " AND "; |
| 553 | 547 | } |
| 554 | 548 | else { | ... | ... |