Commit 338e8ec608baf0be8c34dc56fcea284ceb17bcd9

Authored by Eriksen Costa
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"
ieducar/intranet/include/pmieducar/clsPmieducarServidor.inc.php
@@ -525,30 +525,24 @@ class clsPmieducarServidor @@ -525,30 +525,24 @@ class clsPmieducarServidor
525 525
526 // Seleciona apenas servidores que tenham a carga atual maior ou igual ao 526 // Seleciona apenas servidores que tenham a carga atual maior ou igual ao
527 // do servidor atual 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 {$whereAnd} NOT EXISTS 535 {$whereAnd} NOT EXISTS
538 (SELECT 1 536 (SELECT 1
539 FROM pmieducar.servidor_alocacao sa 537 FROM pmieducar.servidor_alocacao sa
540 WHERE sa.ref_cod_servidor = s.cod_servidor $where2)"; 538 WHERE sa.ref_cod_servidor = s.cod_servidor $where2)";
541 539
542 - $filtros .= " 540 + $filtros .= "
543 {$whereAnd} (s.carga_horaria::text || ':00:00') >= COALESCE( 541 {$whereAnd} (s.carga_horaria::text || ':00:00') >= COALESCE(
544 (SELECT SUM(carga_horaria)::text 542 (SELECT SUM(carga_horaria)::text
545 FROM pmieducar.servidor_alocacao saa 543 FROM pmieducar.servidor_alocacao saa
546 WHERE saa.ref_cod_servidor = {$str_not_in_servidor}),'00:00') $where"; 544 WHERE saa.ref_cod_servidor = {$str_not_in_servidor}),'00:00') $where";
547 545
548 - $whereAnd = " AND ";  
549 - break;  
550 - }  
551 -  
552 $whereAnd = " AND "; 546 $whereAnd = " AND ";
553 } 547 }
554 else { 548 else {