Skip to content

Commit

Permalink
release/3.77.134 (#684)
Browse files Browse the repository at this point in the history
* feat: feature flag

* upgrade Yii version

* fix: sonar cloud issues

* fix: code smells

* fix: remove todos

* alterando componentes de menu

* add migration

* refactor/ refactoring foodMenuController functions

* atualizando componente de cardápio

* fix: form validation

* fix: cache clean js

* update js cache files

* alterando componentes de menu

* fix sonar lint bugs bugs

* fix security issues

* fix: security issues

* atualizando componente de cardápio

* fix: change permission

* revert folder permissions

* atualizando componente de cardápio

* Alterado componentes de menu para a funcionalidade de update

* fix: revert to old docker image

* removendo variável estática da rota de update

* atualizado método de update

* consertado tela de criar cardápio

* sonarlint issues

* add recovery form

* Feat/required scenario student sedsp (#556)

* feat/ delete edcenso_city_fk and and edcenso_uf_fk of model

* feat/correction model with validation required scenario sedsp and default

* feat/ delete edcenso_city_fk and and edcenso_uf_fk of model (#553)

* feat/ delete edcenso_city_fk and and edcenso_uf_fk of model

* feat/correction model with validation required scenario sedsp and default

* feat: add recovery

* build(deps): bump yiisoft/yii from 1.1.27 to 1.1.29 in /app (#529)

Bumps [yiisoft/yii](https://github.com/yiisoft/yii) from 1.1.27 to 1.1.29.
- [Release notes](https://github.com/yiisoft/yii/releases)
- [Changelog](https://github.com/yiisoft/yii/blob/master/CHANGELOG)
- [Commits](yiisoft/yii@1.1.27...1.1.29)

---
updated-dependencies:
- dependency-name: yiisoft/yii
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Relatório de "Relação por Escolas de Estudantes com Deficiências" atualizado (#559)

* report updated, classroom and turn columns added

* minor changes

* feat/add field of checkbox term consent (#561)

* Feat/tag alimentos action lunch (#562)

* first commit

* feat/viewMeals action completed

* feat/viewLunch added first commit

* temporally changes

* removing unnecessary changes

* feat/actionViewLunch updated, publicTarget added to return object

* feat: recuperacao final finalizada

* feat/add position stick propriety date table (#563)

* Fix/students with disabilities per school report (#564)

* report updated, classroom and turn columns added

* minor changes

* fix/adjust table to show only students enrollment of current year

* adding unity recovery

* Feat/stock lunch module (#554)

* Criação do esqueleto da tela

* Criação do esquelo do modal de adicionar estoque

* Finalizando o modal de adicionar comida no estoque

* Criação da migration que adiciona informações em alias_id

* Realizada a action de pegar o food alias

* Criada a tabela de estoque

* Criado o modal de modificações na tela de controle de estoque

* Crida a tabela de movimentações no modal de movimentações

* Funcionalidade de movimentação funcionando

* Criação da view de solicitações

* Adicionados alertas na tela de estoque

* Finalizada tela de estoque e solicitações

* Criando migrations relacionadas as tabelas de food_inventory

* feat(foods): Criada a tela de gestão de estoque e de solicitações no modulo de merenda e modificando a versão do changelog

* Adicionando a caixa de seleção de status na tabela de estoque

* Adicionando verificações na tela de solicitações

* Adicionando verificações nas telas de estoque e solicitações

* fix: change routes

* ci: fix trigger

* fix

---------

Co-authored-by: TI GUSTAVO <ti.gustavo@ipti.org.br>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Feat/create grades release (#565)

* feat(enrollment): Criação da tela de lançamento de notas

* Fazendo o merge com a dev e atualizando o changelog

* fix: sonar lints

---------

Co-authored-by: TI GUSTAVO <ti.gustavo@ipti.org.br>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Feat/tag alimentos (#558)

* atualizado método de update

* consertando bug em atualizar datas

* criando página de refeições por semana

* criando página de refeições por semana

* fix github security issues

---------

Co-authored-by: gabriel-IPTI <ti.gabriel@ipti.org.br>

* enable firebug

* add taghomolog

* fix rules

* fix: remove rules

* change controller

* rename files

* fix: change routes for foods module

* fix: change folder names for foodrequest

* Feat/individual record frequency correction (#567)

* feat/ round the frequency of value int

* feat/add field text (textarea)

* feat/add validation final_media and correction result

* fix(foods): Corrigindo resposividade de estoque e solicitações no modulo de merenda (#570)

Co-authored-by: TI GUSTAVO <ti.gustavo@ipti.org.br>

* feito correção de cor de notificação (#566)

* consertado a responsividade na tela de listagem de refeições e adicionado migrations (#568)

Co-authored-by: gabriel-IPTI <ti.gabriel@ipti.org.br>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* feito correção de fonte no textarea de Diário de Aula (#569)

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* ci: adding sass container build

* Fix/teacher screen option code appears in city (#487)

* feito correção de retirar o <option> em cidade. Falta tirar aspas

* organizado arquivo para adentrar no novo padrão de código. A procura do erro no select de cidade, ver nos controlers

* feito alteação pra o select funcionar

* continuando mudança no form de instructor

* revertendo alterações

* revertendo informações

* Revert "feito correção de retirar o <option> em cidade. Falta tirar aspas"

This reverts commit dc62637.

* depois de reverter commit, feito correção. ainda há erro. selects de cidade e estado estão interligados

* feito correção em selects de cidade, onde estes apresentavam comportamento de apagar e buscar cidade de forma que impedia que a seleção funcionasse corretamente

* feito alterações de formatação

* feito correção para agradar o sonar cloud

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Revert "Fix/teacher screen option code appears in city (#487)" (#571)

This reverts commit ada2490.

* Fix/teacher screen option code appears in city (#572)

* feito correção de retirar o <option> em cidade. Falta tirar aspas

* organizado arquivo para adentrar no novo padrão de código. A procura do erro no select de cidade, ver nos controlers

* feito alteação pra o select funcionar

* continuando mudança no form de instructor

* revertendo alterações

* revertendo informações

* Revert "feito correção de retirar o <option> em cidade. Falta tirar aspas"

This reverts commit dc62637.

* depois de reverter commit, feito correção. ainda há erro. selects de cidade e estado estão interligados

* feito correção em selects de cidade, onde estes apresentavam comportamento de apagar e buscar cidade de forma que impedia que a seleção funcionasse corretamente

* feito alterações de formatação

* feito correção para agradar o sonar cloud

* removind duplicate code

---------

Co-authored-by: Tori Calasans <tori.ti@ipti.org.br>

* Fix/missing fields warning (#475)

* iniciado correção

* feito correção das mensagens de erro em escola

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* fix calculaton

* adding migrations

* fix: sagres inconsistences

* feat: adding by concept grades

* fix delete action and form layout

* fix: remove sonar cloud error

* fix: clean code smells

* fix code smells

* reduce complexity

* fix: code smells'

* fix code smells on usecases

* fix: code smells

* fix loading error

* feat/refactor grades (#574)

* fix: refactor grades

* fix: save one grade struct

* adding ids for grades

* calculo de media finalizado

* check grades em action to calculate final media

* fix: calculate final media

* add recovery form

* feat: add recovery

* feat: recuperacao final finalizada

* adding unity recovery

* fix calculaton

* adding migrations

* feat: adding by concept grades

* fix delete action and form layout

* fix: remove sonar cloud error

* fix: clean code smells

* fix code smells

* reduce complexity

* fix: code smells'

* fix code smells on usecases

* fix: code smells

* fix loading error

* fix: adding cpf to search and graderelease

* update css

* change labels

* fix design issues

* fix: grade release

* fix status

* fix: recovery

* fix grades release

* consertado tela de update

* salvando vários ingredientes para cada prato

* mudanças no formulário

* consertado a rolagem no acordeão

* fix: initial import doesent require address, only on sedsp scenario

* mudado componente de menu

* fix(foods): Adicionando filtros nas unidades de medida a depender da comida selecionada na tela de estoque

* Corrigindo a classe helper utilizada nas telas de estoque e solicitações no modulo de merenda

* criando relatório

* change helper class

* Corrigindo erro nas unidades de medida

* adicionando usuário de nutricionista

* escondendo o botão de imprimir cardápio

* Feat/rename term consent image (#581)

* feat/add marked bf_participator, previous_stage_situation, deficiency

* feat/implementing marked in current_stage_situation and starting logic restrictions

* feat/ add restriction food

* feat/formated

* feat/delete food restriction

* feat/ correction response public transport

* feat/migration view sql

* feat/ correction consent form image

* Fix: sagres-generation (#577)

* Fix: sagres-generation

* Fix: file name path donwload

* Feat/new merge individual record frequency (#575)

* feat/ round the frequency of value int

* feat/add field text (textarea)

* feat/add validation final_media and correction result

* Feat/marked form registration (#579)

* feat/add marked bf_participator, previous_stage_situation, deficiency

* feat/implementing marked in current_stage_situation and starting logic restrictions

* feat/ add restriction food

* feat/formated

* feat/delete food restriction

* feat/ correction response public transport

* feat/migration view sql

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Corrigindo o controller de merenda no módulo de foods

* Corrigido responsividade e colocado link de merenda no mobile

* mostrando dias da semana no mobile na tela de cadastro de cardapio

* Feat/sagres 2024 (#585)

* Feat: file Educacao.xsd 2024

* refactor: update strlen  and maxLength name disciplina to 2024

* Feat: added new value for modality

* Feat: add limit (1000 caracteres) for description for merenda

* Ref: O tamanho máximo foi ajustado para 1000 caracteres devido à restrição (descrição).

* Feat: add opção: Atendimento Educacional Especializado

* Ref: added to comply with sagres 2024 rules

* Feat: student cpf required for sagres 2024

* feat/modify_message_error_to_register_user (#584)

* feat/add min character in rules referents action create user and delete in javascript

* feat/message correction of error

* ungermed file

* Feat/unity periods (#425)

* Aidção do modal para alterar unidades das etapas

* Adição de validação no backend da consulta de unidades

* Regras do Javascript para verificar as datas

* Ajax para enviar as datas, sem a parte do PHP

* Aidção do modal para alterar unidades das etapas

* Ajuste na comparação de datas

* Finalizado crud unityperiods

* Finalizado vigencia das unidades no calendar

* minor fixes

* inserido tooltip nos eventos highlighted das vigências das unidades

* travamento do container flutuante de visualizar etapas e vigências no accordion;

replicação de datas agora só depende da quantidade de unidades

* Não mostrar RS e RF nas unidades do calendario

* Nova tela de parametros do município

* Alteração do visual da tela e pequenos erros

* Gif de loading e melhoria na tabela

* inserido etapas da escola e adequado tela de classroom para exibir apenas as etapas da escola;

* refactor: reverse controller merge

* Removido de vez o school_stages_concept_grades - substituído por school_stages;

rollback na funcionalidade de turma que exibe apenas as turmas da escola

* Ajustado notas e estrutura do relatório ata de notas

* Inserido situação 'RECUPERAÇÃO'

* Ajustes das notas na Ficha de Notas

* Unidades por conceito nas Fichas de notas

* Dias letivos e carga horária na Ficha de Notas

* Faltas na Ficha de Notas

* corrigido alguns bugs em aulas ministradas

* Finalizado ficha de notas

* Ficha de notas concluida

* fix sonar lint issues

---------

Co-authored-by: paulones <Ppcc8986>
Co-authored-by: Carlos Henrique Santos Silveira <109424074+ByteCarlos@users.noreply.github.com>
Co-authored-by: Carlos Henrique Santos Silveira <carlos.henrique@dcomp.ufs.br>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* fix required indicator

* fix/action update classroom fixed

* Revert "Feat/sagres 2024" (#595)

* Feat/no transfered students (#591)

* feat/add find all school in controler and modification pag transfer

* feat/ correction identation

* feat/ rename title

* feat/ correction field deficiency (#597)

* Fix: year of generation of the file changed to the one selected in the system (#600)

* Feat/add grades release concept grades (#603)

* fix(grades): corrigindo a tela de lançamento de notas de buzios

* feat(grades): Corrigindo o cálculo de média final na tela de lançamento de notas de buzios e adicionando notas por conceito em lançamento de notas

* Modificando versão do changelog e fazendo o merge com a dev

---------

Co-authored-by: TI GUSTAVO <ti.gustavo@ipti.org.br>

* feat/add year to all reports (#596)

* feat/add year to all reports

* feat/corretion sonar lint

* feat/add year report

* docs: Criando a documentação da adr que descreve a atribuição de nome de pull request

* Fix/correction date attendance (#607)

* Fix: added validations and limitations for selecting the date of attendance

* Feat: add CDateTimeParser to match the database data type (yyyy-MM-dd)

* Fix: when entering a attendance, the page is no longer redirected to the index.

* Feat: added action to clear the entered date

* feat/create head instance not is buzios (#598)

* feat/create head instance not is buzios

* feat/correction sonar lint

* docs: Criando a documentação da adr que descreve a atribuição de nome de pull request

* chagen pullrequest template

* Feat/Add Delete Function To Attendances in Update Professional View (#604)

* first commit

* Method deleteAttendance updated to use a POST request instead a GET / ajax added to event on click

* task completed

* CHANGELOG updated

* layout and functionality approved, ready to request a pull

* fix a issue in default controller

* layout fixed

* feat/add value 5 in array scholarity (#606)

* feat/add value 5 in array scholarity

* feat/fields replicated (corrected)

* feat/ add changelog

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Feat/add report card concept grades (#609)

* fix(grades): corrigindo a tela de lançamento de notas de buzios

* feat(grades): Corrigindo o cálculo de média final na tela de lançamento de notas de buzios e adicionando notas por conceito em lançamento de notas

* Modificando versão do changelog e fazendo o merge com a dev

* feat(reportCard): Adicionando notas por conceito no lançamento de notas de búzios

---------

Co-authored-by: TI GUSTAVO <ti.gustavo@ipti.org.br>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Feat/foodmenu report (#608)

* criada tabela de crdápio no relatorio de foodmenu

* criado folder reports no module foods

* criado FoodMenuServices e os usesCases

* mudando relatorio

* alterado _form em foodMenu

* adicionado a descrição das refeições no relatório de cardápio

* colocado ingredientes no relatório de cardápio

* buscando valores nutricionais das refeições

* adicionando calculos no relatório de cardápio

* finalizado formulário

* alterando formato da hora da refeição, cor de celulas na impressão e consertado sigla de carboidratos

* remove head.php

* mudado sigla de carboidrato

* sonarlint issues

* sonarlint issues

* sonarlint issues

---------

Co-authored-by: gabriel-IPTI <ti.gabriel@ipti.org.br>

* Feat/sagres 2024 (#602)

* Feat: file Educacao.xsd 2024

* refactor: update strlen  and maxLength name disciplina to 2024

* Feat: added new value for modality

* Feat: add limit (1000 caracteres) for description for merenda

* Ref: O tamanho máximo foi ajustado para 1000 caracteres devido à restrição (descrição).

* Feat: add opção: Atendimento Educacional Especializado

* Ref: added to comply with sagres 2024 rules

* Feat: student cpf required for sagres 2024

* Feat: add break-word for restrictions

* Feat: migration 2024-02-01_adjust_sagres_2024

* feat/ removed in field input (*) (#605)

* feat/ removed in field input (*)

* feat/remove * disciplines

* feat/add changelog

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Criando a documentação da adr que descreve a atribuição de nome de pull request

* pull dev

* Modificando a inconsistência em main.php

* Fix/import student data from sedsp (#613)

* Ref: code improvement

* Fix: Updating the student's documents and address is based on id.

* fix/individual-report (#582)

* fix/individual-report

* feat/sonarcloud issues fixed

* fix/adjustment in final grade view

* fix user year in report

* CHANGELOG updates

---------

Co-authored-by: AnotherOne07 <natsujunior07@gmail.com>

* Feat/course_plan_abilities (#615)

* feat/correction abilities couse plan

* feat/remove *

* feat/add changelog

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Feat/md5 to bcrypt (#616)

* Feat: md5 modified for bcript in user creation function

* Feat: Update password length validation, extending maximum allowed characters to 60.

* Feat: added bcriptHash in AdminController

* Feat: added bcriptHash

* Feat: added class PasswordHasher

* Feat: added bcriptHash in instructor create

* Feat: added bcrypt authenticate user

* Feat: added file migration

* Feat: added modification in changelog

* Feat: no sonar

* Fix: md5 Make sure this weak hash algorithm is not used in a sensitive context here.

* Fix: md5 Use of Password Hash With Insufficient Computational Effort

* Fix/meals (#621)

* consertando a listagem de refeições

* alterado changelog e config.php

* escondendo botão de lista de compras

* create migration

---------

Co-authored-by: gabriel-IPTI <ti.gabriel@ipti.org.br>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Icon font version update

* Fix/synchronize sedsp student data (#623)

* Feat: added validation to ensure a value for classroom_fk

* Feat: Added return for error when importing classes

* Feat: added changelog

* Feat/foods report (#622)

* created shoppingListReport

* aumentado tamanho das celulas no relatório de lista de compras

* alterado relatório

* alterado relatório de lista de compras

* shoppingListReport finalized

* shoppingListReport finalized

* adicionada migration

* mudando changelog

* sonarcloud issues

* Corrigindo o botão de lista de compras

---------

Co-authored-by: gabriel-IPTI <ti.gabriel@ipti.org.br>
Co-authored-by: TI GUSTAVO <ti.gustavo@ipti.org.br>

* [3.69.107]Fix/report_head_poco_dantas (#617)

* feat/rename head

* fix/ add changelog

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fix/food inventory style (#618)

* fix(foods): Modificando o estilo do botão dos botões de movimentações na tabela de estoque e escondendo o botão de solicitacoes na tela de estoque

* Modificando versão do changelog

* Corrigindo a duplicidade do código

* fix(foods): Corrigindo o estilo da tela de estoque, as colunas status e entrada/saida atualizadas para facilitar a usabilidade

* Modificando versão do changelog e realizando o merge com a dev

* Resolvendo issues

---------

Co-authored-by: TI GUSTAVO <ti.gustavo@ipti.org.br>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fix/report card unities (#614)

* Fixing reportCard grades

* fix(grades): Corrigindo a disposição de unidades de lançamento de notas de búzios, permitindo que sejam adicionadas notas maiores de 10 em lançamento de notas e adicionada a verificação de recuperação final

* Fazendo o merge com a dev e alterando o changelog

* Fixing code smells

* Corrigindo o valor da média final quando nem todas as unidades estavam preenchidas na tela de lançamento de notas

* feat/modify head

* feat/add changelog

* fixing code security failure

* Corrigindo erro de segurança

---------

Co-authored-by: TI GUSTAVO <ti.gustavo@ipti.org.br>
Co-authored-by: Evellyn Jade <97754536+evellynreis@users.noreply.github.com>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Realizando o merge com a dev e criando as tabelas de farmer

* Criando tela de cadastro de agricultor

* Fix/cod municipio dne (#620)

* Feat: added city code

* Feat: added memory limit to 2048M for importMaster

* Fix: remoção de validação sem uso

* Feat: added Código Ubatuba

* Feat: added migration

* Feat: adicionado alterações no changelog

* Fix: Correção na obtenção do CPF do estudante para o arquivo SAGRES: (#625)

* Fix: get student cpf

* Feat: added changelog

* Feat: adicionado nova versão

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* criado módulo de dashboard (#632)

* criado módulo de dashboard

* sonarlint issues

* change version

---------

Co-authored-by: gabriel-IPTI <ti.gabriel@ipti.org.br>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Criando esqueleto da tela de cadastro de agricultor

* Criando verificações

* Criando verificação de relação de produtos

* Feat/button alphabetic order (#631)

* feat(classroom): Adicionando o botão de ordem alfabética na aba de ordem de diário no formulário de turmas

* Modificando a versão do changelog e fazendo o merge com a dev

* Corrigindo issues

* Corrigindo issues

* Corrigindo issues

* Corrigindo irregularidade

* Corrigindo irregularidade

---------

Co-authored-by: TI GUSTAVO <ti.gustavo@ipti.org.br>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* fix/add input no (#633)

* fix/add input no

* fix/config

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* [Versão 3.71.112] Fix/class plan abilities view (#628)

* first commit

* modal created

* events added to buttons

* js changes

* manipulating form and events related to it

* form and route is already working but still missing update select and actionCreate

* modal finished and select already is been updated

* minor changes

* almost there, still missing to fill type field in form

* form is already working but still need to fix the style

* funcionality is already working, but still needs to fix the layout yet

* removing unnecessary comments

* remove comment

* fix remove resource from list

* 💄feat/badge style updated

* 💄feat/fix icon style and padding in button

* 🗃️raw/upload sql changes and CHANGELOG update

* 🗃️raw/upload sql changes and remove comments

* small change on placeholder in modal

* 🏷️fix/removing var declared variables

* 🏷️fix/removing sonarlint issues

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* main.css

* Feat calendar surpassing year (#619)

* primeiro commit da branch

* feito parcialmente calendário

* retirado função de disponibilizar calendário

* update do calendar_fk das turmas

* adequado vigencia das unidades

* calendario supostamente finalizado

* quadro de horário com add/change/remove schedule pendentes

* refatorado quadro de horário com ano passando

* reinserido schedule

* corrigido bug no carregamento dos hardunavailabledays e na geração do quadro de horário

* o alerta de alteração de data do calendario nunca aparecia

* Adequado selects em aulas ministradas e frequencia

* Adição dos calendarios no cadastro das turmas

* alterado sql

* Merge

* fix sonarcloud

---------

Co-authored-by: paulones <Ppcc8986>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Criando a action de save no controller de farmer register

* fix merge

* Criando a tabela de visualização de agricultores

* Criado as telas de relacionadas a agricultor

* fix/variable declared incorrectly in function scope

* Adicionando a school_fk e o status em food_request

* conectando com o firebase

* Realizando integração com o firebase

* Corrigindo erros do sonarlint

* Corrigindo errors sonarlint

* Corrigindo erros do sonarlint

* Corrigindo issues alertados pelo sonarlint

* Corrigindo issues

* Feat/change food measurement (#635)

* create migration

* adicionando input de quantidade

* mudando componente de cardápio

* alterado food_measurement

* change reports

* mudado componente de cardápio

* alterado food_measurement

* alterado food_measurement

* alterado food_measurement

* alterado food_measurement

* sonarlint issues

* resolve conflicts

* sonarlint issues

* main.css

* mudado componente de cardápio

---------

Co-authored-by: gabriel-IPTI <ti.gabriel@ipti.org.br>

* [TCDA-240] Fix/load schedules by discipline (#637)

* 🐛fix/minor fundamental conditional fixed

* :docs:docs/CHANGELOG updated

* fix/function parameter fixed

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Feat: case added for class 22 and multi alias (#638)

* Feat: case added for class 22 and multi alias

* Feat: added changelog

* Feat: added version in config

* Feat: added case 2 for class

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fix: gestor not edit calendar (#640)

* Fix: gestor not edit calendar

* Feat: added version in changelog e config

* Feat: added menu for calendário para professor

* Feat: added acess for admin

---------

Co-authored-by: AnotherOne07 <93009549+AnotherOne07@users.noreply.github.com>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* fix/poco_dantas (#643)

* fix/ add cep formated

* fix/ add changelog

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* rename food folders

* fix: rename foodrequest folder

* fix file rename

* consertado redirecionamento em Foodmenu

* fix: rename folder

* fix: delete file

* Feat/warning missing content (#639)

* Apresentação de duas listas na pagina inicial

* Apresentação dos primeiros warns e estrutura contada

* Mais warnings avaliados

* Alertando todos os problemas pedidos

* Limite de quantidade de warns e ajustes

* inserido painel de cadastros pendentes 100%

* inserindo validação pra gestor escolar

* updating name branch

* ajeitado painel de cadastros pendentes

* bug phps

* bug phps

* renomeado pra maiusculos novamente

* renomeado pra maiusculos novamente

* renomeado pra maiusculos novamente

* corrigido incongruências de case sensitive

* corrigido incongruências de case sensitive

* retirado conflito de foodmenu.php

* config e changelog

---------

Co-authored-by: paulones <Ppcc8986>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fix/frequency_75 (#644)

* fix/ add property frequency in use case

* fix/add function get and set

* fix/modify controller

* fix/add changelog

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fix/scholarity sql column removed (#645)

* Fix/scholarity sql column removed

* Feat: added new version in changelog and config

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fix/merenda escolar (#648)

* first commit

* first commit

* Ajustes visuais na tela de cadastro de cardápio

* Ajustes visuais na tela de cadastro de cardápio

* change foodmenu

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fixing tag version number

* Fixing changelog

* Feat/food notice (#650)

* finalizado crud de edital

* adicionado botão para editais na tela de listagem de merenda

* update migration

* github issues

* sonnar issues

* atualizado versão do sistema

* ignore case

* corrigindo viewlunch

* rename file

* rename file

* fix: creating notice button and fixing delete notice redirection

* consertado o redirecionamento na actionDelete

* fix folders

* fix some sonarcloud issues

* sonarlint issues

* sonarlint issues

* sonarlint issues

---------

Co-authored-by: gabriel-IPTI <ti.gabriel@ipti.org.br>
Co-authored-by: TI GUSTAVO <ti.gustavo@ipti.org.br>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fix/no_notes (#651)

* fix/sets status to one

* fix/ add changelog

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fix/corrections and improvements (#655)

* Feat: added limit for not accessing future month

* Fix: correction in attribute id_school

* Fix: added inepId for inconsistencys

* Fix: removed integer $inep_id

* Fix: added filter for auth assignment

* Feat: added new version in changelog and config

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fix: added food Enabled (#654)

* Fix: added food Enabled

* Feat: added migration

* Feat/boquim integration (#652)

* sqls para rodar nos bancos velhos de boquim

* testado import de vanda 100%

* ORGANIZADO SQLS

* minor fix

* Adaptado educacenso para importar dados quando não há professor;
Melhorado tela de turma para não remover o teaching data quando não tem teaching_matrix;
organizado melhor os arquivos SQL

* aprimorado o readme

* Integração dos bancos de boquim do TAG. Como foi reformulado o arquivo de importação. essa branch precisa ser merjada

* update logs

* fix: alterando condição de isStudent para importação do arquivo original do censo

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Feat/instructor frequency (#657)

* sqls para rodar nos bancos velhos de boquim

* testado import de vanda 100%

* ORGANIZADO SQLS

* minor fix

* Adaptado educacenso para importar dados quando não há professor;
Melhorado tela de turma para não remover o teaching data quando não tem teaching_matrix;
organizado melhor os arquivos SQL

* aprimorado o readme

* Integração dos bancos de boquim do TAG. Como foi reformulado o arquivo de importação. essa branch precisa ser merjada

* update logs

* Frequência do professor

* fix update log

---------

Co-authored-by: gabriel-IPTI <ti.gabriel@ipti.org.br>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Feat/added professional for different schools (#659)

* Feat: added professional for different schools

* Fix: remove unique for cpf_professional

* Feat: added new version in changelog and config

* Feat: added new version in changelog and config

* ci: add release sql

* fix: added msg for inconsistency sagres (#626)

* Feat: added msg for inconsistency sagres

* Fix:  modified code with only the first letter of "description" and "action" capitalized

* Fix: corretion in uninitialized value

* Fix/manager not authorized for school pdf (#661)

* Fix: manager authorized for school pdf

* Fix: set id student inconsistency sagres

* Feat: added new version in changelog and config

* Fix de teste da falta de curricular matrix e notas

* logs

* Icon font version update

* Feat: added new version in changelog and config

* Feat/added professional for different schools (#665)

* Feat: added professional for different schools

* Fix: remove unique for cpf_professional

* Feat: added new version in changelog and config

* Feat: added new version in changelog and config

* Fix: correction in find professional

* Fix: correction in inep_id (#664)

* Fix: correction in inep_id

* Feat: added new version in changelog and config

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fix: correction in description class (#668)

* Fix: correction in description class

* Feat: added new version for changelog and config

* Fix: Define a constant instead of duplicating this literal "<strong>SÉRIE<strong>" 4 times.

* Feat/food notice (#647)

* finalizado crud de edital

* adicionado botão para editais na tela de listagem de merenda

* update migration

* github issues

* sonnar issues

* atualizado versão do sistema

* ignore case

* corrigindo viewlunch

* rename file

* rename file

* fix: creating notice button and fixing delete notice redirection

* consertado o redirecionamento na actionDelete

* fix folders

* fix some sonarcloud issues

* sonarlint issues

* sonarlint issues

* sonarlint issues

---------

Co-authored-by: gabriel-IPTI <ti.gabriel@ipti.org.br>
Co-authored-by: TI GUSTAVO <ti.gustavo@ipti.org.br>
Co-authored-by: Gustavo Santos <gustavo.santos23703@gmail.com>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Feat/create farmer register (#653)

* Pegando as informações do firebase

* realizando o merge com a dev e modificando o changelog

* Corrigindo o controller farmerregister

* Pegando o cadastro do agricultor de acordo com o seu cpf

* Conectando o update do agricultor com o firebase

* Finalizada conexão para alteração do agricultor no firebase

* Permitindo a atualização e a exclusão no firebase e adicionando verificações de cpf

* Corrigindo issues

* corrigindo code smells

---------

Co-authored-by: TI GUSTAVO <ti.gustavo@ipti.org.br>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* corrigido bug produzido em 15/03/2024

* Fix/add lunch unities [Versão 3.77.132] (#677)

* add lunch unities

* mudado versão do sistema

* Feat/school management signature (#675)

* Feat: added school management signature

* Feat: added new version for changelog and config

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fix/date corrections (#673)

* Fix: correction in the student date field

* Fix: correction in the school initial_date field

* Fix: correction in the Instructor birthday_date field

* Feat: added validation for duplicate cpfs

* Feat: added function for validate cpf

* Feat: added new version form changelog e config

* Feat: only takes active schools

* Fix: corrections for dates

* Fix: correction in js validation for initial_date

* Feat: added limit for date initial_date

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fix/instructor frequency [Versão 3.77.131] (#676)

* alterado _initialization_instructor

* fix instructor frequency

* fix instructor frequency

* mudado versão do sistema

* refatorado _initialization_instructor.js

---------

Co-authored-by: gabriel-IPTI <ti.gabriel@ipti.org.br>
Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* Fix: Reordered parameters in getSchedulesFromMajorStage method (#667)

* Fix: Reordered parameters in getSchedulesFromMajorStage method

* Feat: added new version in changelog and config

---------

Co-authored-by: Igor Gonçalves <igor_goncalves@live.com>

* add sql release file

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: GabrielChagas14 <gmelo123455@gmail.com>
Co-authored-by: Paulo Roberto da Costa Cardoso <paulones89@gmail.com>
Co-authored-by: AnotherOne07 <natsujunior7@gmail.com>
Co-authored-by: gabriel-IPTI <ti.gabriel@ipti.org.br>
Co-authored-by: GabrielChagas14 <84946326+GabrielChagas14@users.noreply.github.com>
Co-authored-by: Evellyn Jade <97754536+evellynreis@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Francisco Junior <93009549+AnotherOne07@users.noreply.github.com>
Co-authored-by: Gustavo Santos <gustavo.santos23703@gmail.com>
Co-authored-by: TI GUSTAVO <ti.gustavo@ipti.org.br>
Co-authored-by: Tori Calasans <107931809+Tori-IPTI@users.noreply.github.com>
Co-authored-by: Tori Calasans <tori.ti@ipti.org.br>
Co-authored-by: Nathan Santos <117388330+nathanipti@users.noreply.github.com>
Co-authored-by: Carlos Henrique Santos Silveira <109424074+ByteCarlos@users.noreply.github.com>
Co-authored-by: Carlos Henrique Santos Silveira <carlos.henrique@dcomp.ufs.br>
Co-authored-by: Tori Calasans <tori.ti@ipti.og.br>
Co-authored-by: AnotherOne07 <natsujunior07@gmail.com>
Co-authored-by: Lívia Martins <131170355+LiviaMartinsIPTI@users.noreply.github.com>
Co-authored-by: paulones <Ppcc8986>
Co-authored-by: Nathan Santos <ti.natan@ipti.org.br>
  • Loading branch information
20 people authored Apr 16, 2024
1 parent e75f994 commit 169b35a
Show file tree
Hide file tree
Showing 29 changed files with 950 additions and 676 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
## [Versão 3.77.134]
- Consertado tela de frequencia para os professores
-
## [Versão 3.77.133]
- Realizado correções nas validações das datas para Professor, Estudante e Escola

## [Versão 3.78.132]
- Adicionado campo para a assinatura do diretor

## [Versão 3.77.132]
- Criando as telas relacionadas a agricultor no novo módulo de merenda escolar

## [Versão 3.76.131]
- Adicionado gerência de editais anuais de aquisição de gêneros alimentícios da agricultura familiar e empreendedor familiar rural

## [Versão 3.76.130]
- Correção no conteúdo ministrado em sala de aula
- Escolas inativas excluídas do arquivo sagres
- Correção na descrição da séries para as inconsistências sagres

## [Versão 3.76.129]
- Correção na descrição da séries para as inconsistências sagres

## [Versão 3.76.128]
- Corrigido erro que não mostrava o nome da escola e das turmas nas inconsistências sagres
- Corrigido na busca por profissional na mesma escola
Expand Down
71 changes: 53 additions & 18 deletions app/controllers/ClassesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ public function accessRules()
'index',
'frequency',
'saveFrequency',
'SaveFrequencies',
'classContents',
'getClassContents',
'saveClassContents',
'getmonthsanddisciplines',
'getdisciplines',
'getfrequency',
'saveJustification'
'saveJustification',
'saveJustifications'
),
'users' => array('@'),
),
Expand Down Expand Up @@ -82,7 +84,6 @@ public function actionClassContents()
);

$classrooms = Classroom::model()->findAll($criteria);

} else {
$classrooms = Classroom::model()->findAll(
'school_year = :school_year and school_inep_fk = :school_inep_fk order by name',
Expand Down Expand Up @@ -183,7 +184,7 @@ public function actionGetClassContents()
"courseClasses" => $courseClasses,
]);
} else {
echo json_encode(["valid" => false, "error" => "Mês/Ano " . ($_POST["fundamentalMaior"] == "1" ? "e Disciplina": "") . " sem aula no Quadro de Horário."]);
echo json_encode(["valid" => false, "error" => "Mês/Ano " . ($_POST["fundamentalMaior"] == "1" ? "e Disciplina" : "") . " sem aula no Quadro de Horário."]);
}
}

Expand All @@ -195,7 +196,7 @@ public function actionGetClassContents()
* @param integer $disciplineId
* @return Schedule[]
*/
private function getSchedulesFromMajorStage($classroomId, $month, $year, $disciplineId)
private function getSchedulesFromMajorStage($classroomId, $month, $disciplineId, $year)
{
return Schedule::model()->findAll(
"classroom_fk = :classroom_fk and month = :month and year = :year and discipline_fk = :discipline_fk and unavailable = 0 order by day, schedule",
Expand Down Expand Up @@ -244,7 +245,6 @@ private function getStudentsByClassroom($classroomId)
)
->bindParam(":classroom_fk", $classroomId)
->queryAll();

}

/**
Expand Down Expand Up @@ -274,7 +274,6 @@ private function buildClassContents($schedules, $students)
}

return $classContents;

}

private function updateStudentAnottations($schedule, $students)
Expand Down Expand Up @@ -340,7 +339,6 @@ private function loadSchedulesByStage($isMajorStage, $classroom, $month, $year,
"year" => $year,
]
);

}

/**
Expand All @@ -364,7 +362,6 @@ private function saveSchedule($schedule, $classContent)
foreach ($classContent["contents"] as $content) {
$this->saveClassContents($content, $schedule);
}

}

private function saveClassContents($content, $schedule)
Expand Down Expand Up @@ -464,6 +461,7 @@ public function actionGetFrequency()
$criteria->order = 'name';
$enrollments = StudentEnrollment::model()->findAllByAttributes(array('classroom_fk' => $_POST["classroom"]), $criteria);
if ($schedules != null) {
$scheduleDays = $this->getScheduleDays($schedules);
if ($enrollments != null) {
$students = [];
$dayName = ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"];
Expand All @@ -474,23 +472,56 @@ public function actionGetFrequency()
foreach ($schedules as $schedule) {
$classFault = ClassFaults::model()->find("schedule_fk = :schedule_fk and student_fk = :student_fk", ["schedule_fk" => $schedule->id, "student_fk" => $enrollment->student_fk]);
$available = date("Y-m-d") >= $schedule->year . "-" . str_pad($schedule->month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($schedule->day, 2, "0", STR_PAD_LEFT);
$date = $this->gerateDate($schedule->day, $schedule->month, $schedule->year);
array_push($array["schedules"], [
"available" => $available,
"day" => $schedule->day,
"week_day" => $dayName[$schedule->week_day],
"schedule" => $schedule->schedule,
"fault" => $classFault != null,
"justification" => $classFault->justification
"justification" => $classFault->justification,
"date" => $date
]);
}
array_push($students, $array);
}
echo json_encode(["valid" => true, "students" => $students]);
echo json_encode(["valid" => true, "students" => $students, "scheduleDays" => $scheduleDays]);
} else {
echo json_encode(["valid" => false, "error" => "Matricule alunos nesta turma para trazer o Quadro de Frequência."]);
}
} else {
echo json_encode(["valid" => false, "error" => "Mês/Ano " . ($_POST["fundamentalMaior"] == "1" ? "e Disciplina": "") . " sem aula no Quadro de Horário."]);
echo json_encode(["valid" => false, "error" => "Mês/Ano " . ($_POST["fundamentalMaior"] == "1" ? "e Disciplina" : "") . " sem aula no Quadro de Horário."]);
}
}
private function gerateDate($day, $month, $year)
{
$day = ($day < 10) ? '0' . $day : $day;
$month = ($month < 10) ? '0' . $month : $month;
return $day . "/" . $month . "/" . $year;
}
private function getScheduleDays($schedules)
{
$result = [];
foreach ($schedules as $schedule) {
$day = ($schedule->day < 10) ? '0' . $schedule->day : $schedule->day;
$month = ($schedule->month < 10) ? '0' . $schedule->month : $schedule->month;
$date = $day . "/" . $month . "/" . $schedule->year;
$index = array_search($date, array_column($result, 'date'));
if ($index === false) {
array_push($result, [
"day" => $schedule->day,
"date" => $date
]);
}
}
return $result;
}

public function actionSaveFrequencies()
{
$schedules = Schedule::model()->findAll("classroom_fk = :classroom_fk and day = :day and year = :year and month = :month", ["classroom_fk" => $_POST["classroomId"], "day" => $_POST["day"], "month" => $_POST["month"], "year" => $_POST["year"]]);
foreach ($schedules as $schedule) {
$this->saveFrequency($schedule);
}
}

Expand Down Expand Up @@ -522,7 +553,6 @@ private function saveFrequency($schedule)
} else {
ClassFaults::model()->deleteAll("schedule_fk = :schedule_fk and student_fk = :student_fk", ["schedule_fk" => $schedule->id, "student_fk" => $_POST["studentId"]]);
}

} else {
if ($_POST["fault"] == "1") {
$enrollments = StudentEnrollment::model()->findAll("classroom_fk = :classroom_fk", ["classroom_fk" => $_POST["classroomId"]]);
Expand All @@ -542,6 +572,15 @@ private function saveFrequency($schedule)
}
}

public function actionSaveJustifications()
{
$schedules = Schedule::model()->findAll("classroom_fk = :classroom_fk and day = :day and month = :month and year = :year ", ["classroom_fk" => $_POST["classroomId"], "day" => $_POST["day"], "month" => $_POST["month"], "year" => $_POST["year"]]);
foreach ($schedules as $schedule) {
$classFault = ClassFaults::model()->find("schedule_fk = :schedule_fk and student_fk = :student_fk", ["schedule_fk" => $schedule->id, "student_fk" => $_POST["studentId"]]);
$classFault->justification = $_POST["justification"] == "" ? null : $_POST["justification"];
$classFault->save();
}
}
public function actionSaveJustification()
{

Expand All @@ -550,15 +589,12 @@ public function actionSaveJustification()
$classFault = ClassFaults::model()->find("schedule_fk = :schedule_fk and student_fk = :student_fk", ["schedule_fk" => $schedule->id, "student_fk" => $_POST["studentId"]]);
$classFault->justification = $_POST["justification"] == "" ? null : $_POST["justification"];
$classFault->save();


} else {
$schedules = Schedule::model()->findAll("classroom_fk = :classroom_fk and day = :day and month = :month and year = :year ", ["classroom_fk" => $_POST["classroomId"], "day" => $_POST["day"], "month" => $_POST["month"], "year" => $_POST["year"]]);
foreach ($schedules as $schedule) {
$classFault = ClassFaults::model()->find("schedule_fk = :schedule_fk and student_fk = :student_fk", ["schedule_fk" => $schedule->id, "student_fk" => $_POST["studentId"]]);
$classFault->justification = $_POST["justification"] == "" ? null : $_POST["justification"];
$classFault->save();

}
}
}
Expand Down Expand Up @@ -594,7 +630,8 @@ public function actionGetMonthsAndDisciplines()
join instructor_identification ii on ii.id = itd.instructor_fk
join curricular_matrix cm on cm.id = tm.curricular_matrix_fk
join edcenso_discipline ed on ed.id = cm.discipline_fk
where ii.users_fk = :userid and itd.classroom_id_fk = :crid order by ed.name")->bindParam(":userid", Yii::app()->user->loginInfos->id)->bindParam(":crid", $classroom->id)->queryAll();
where ii.users_fk = :userid and itd.classroom_id_fk = :crid order by ed.name"
)->bindParam(":userid", Yii::app()->user->loginInfos->id)->bindParam(":crid", $classroom->id)->queryAll();
} else {
$disciplines = Yii::app()->db->createCommand("select ed.id, ed.name from curricular_matrix join edcenso_discipline ed on ed.id = curricular_matrix.discipline_fk where stage_fk = :stage_fk and school_year = :year order by ed.name")->bindParam(":stage_fk", $classroom->edcenso_stage_vs_modality_fk)->bindParam(":year", Yii::app()->user->year)->queryAll();
}
Expand All @@ -608,8 +645,6 @@ public function actionGetMonthsAndDisciplines()
$result = ["valid" => false, "error" => "A Turma está sem Calendário Escolar vinculado."];
}
echo json_encode($result);


}

/**
Expand Down
17 changes: 16 additions & 1 deletion app/controllers/StudentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,8 @@ public function actionUpdate($id)
$modelStudentDocumentsAndAddress = $this->loadModel($id, $this->STUDENT_DOCUMENTS_AND_ADDRESS);
$modelStudentRestrictions = $this->loadModel($id, $this->STUDENT_RESTRICTIONS);

$oldCpf = $modelStudentDocumentsAndAddress->cpf;

$vaccines = Vaccine::model()->findAll(array('order' => 'name'));
$studentVaccinesSaves = StudentVaccine::model()->findAll(['select' => 'vaccine_id', 'condition' => 'student_id=:student_id', 'params' => [':student_id' => $id]]);
if ($studentVaccinesSaves) {
Expand All @@ -478,6 +480,19 @@ public function actionUpdate($id)
date_default_timezone_set("America/Recife");
$modelStudentIdentification->last_change = date('Y-m-d G:i:s');

$newCpf = $_POST[$this->STUDENT_DOCUMENTS_AND_ADDRESS]['cpf'];

if($oldCpf !== $newCpf && $newCpf !== "") {
$existCpf = StudentDocumentsAndAddress::model()->findByAttributes(array('cpf' => $modelStudentDocumentsAndAddress->cpf));

if($existCpf !== null) {
Yii::app()->user->setFlash(
'error', Yii::t('default', 'Já existe um registro associado a este CPF de um aluno cadastrado!')
);
$this->redirect(array('/student/update', 'id' => $modelStudentDocumentsAndAddress->id));
}
}

if ($modelStudentIdentification->validate() && $modelStudentDocumentsAndAddress->validate()) {
if ($modelStudentIdentification->save()) {
$modelStudentRestrictions->student_fk = $modelStudentIdentification->id;
Expand Down Expand Up @@ -525,7 +540,7 @@ public function actionUpdate($id)
}
}
}

if ($saved) {
$flash = "success";
$msg = 'O Cadastro de ' . $modelStudentIdentification->name . ' foi alterado com sucesso!';
Expand Down
14 changes: 14 additions & 0 deletions app/migrations/2024-06-04_add_lunch_unities/sql.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
insert into lunch_unity (name, acronym) values
("Grama", "G"),
("Mililitro", "ML"),
("Unidade", "U"),
("Duzia", "DZ"),
("Pacote", "PCT");

UPDATE lunch_unity
SET acronym = 'L'
WHERE acronym = 'ML' AND name = 'litro';

UPDATE lunch_unity
SET acronym = 'ML'
WHERE acronym = 'mL' AND name = 'Mililitro';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE farmer_register ADD COLUMN reference_id varchar(36);
35 changes: 35 additions & 0 deletions app/models/StudentDocumentsAndAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,44 @@ public function rules()
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
array('register_type, school_inep_id_fk, student_fk, id, rg_number, rg_number_edcenso_organ_id_emitter_fk, rg_number_edcenso_uf_fk, rg_number_expediction_date, civil_certification, civil_certification_type, civil_certification_term_number, civil_certification_sheet, civil_certification_book, civil_certification_date, notary_office_uf_fk, notary_office_city_fk, edcenso_notary_office_fk, civil_register_enrollment_number, cpf, foreign_document_or_passport, nis, residence_zone, cep, address, number, complement, neighborhood, edcenso_uf_fk, edcenso_city_fk, received_cc, received_address, received_photo, received_nis, received_history, received_responsable_rg, received_responsable_cpf, cns, fkid, justice_restriction, diff_location', 'safe', 'on'=>'search'),
array('cpf', 'validateCPF')
);
}

public function validateCPF($cpfStudent)
{
$cpfStu = $this->$cpfStudent;

if($cpfStu === "") {
return true;
}

$cpf = preg_replace('/[^0-9]/', '', $cpfStu);

if (strlen($cpf) !== 11) {
$this->addError($cpfStudent, 'O CPF deve conter exatamente 11 números.');
return;
}

if (preg_match('/(\d)\1{10}/', $cpf)) {
$this->addError($cpfStudent, 'O CPF não pode ter todos os dígitos iguais.');
return;
}

for ($t = 9; $t < 11; $t++) {
for ($d = 0, $c = 0; $c < $t; $c++) {
$d += $cpf[$c] * (($t + 1) - $c);
}
$d = ((10 * $d) % 11) % 10;
if ($cpf[$c] != $d) {
$this->addError($cpfStudent, 'O CPF é inválido.');
return;
}
}
return true;
}


/**
* @return array relational rules.
*/
Expand Down
Loading

0 comments on commit 169b35a

Please sign in to comment.