teodoro 0.51.0 → 0.51.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/teodoro/arquivo_de_evento_nao_periodico.rb +9 -3
- data/lib/teodoro/arquivo_xml.rb +7 -3
- data/lib/teodoro/empresa/contratos_de_emprego.rb +0 -4
- data/lib/teodoro/empresa/contratos_de_trabalho_sem_vinculo.rb +0 -4
- data/lib/teodoro/empresa.rb +19 -8
- data/lib/teodoro/leiaute/arquivo_s2230.rb +0 -5
- data/lib/teodoro/version.rb +1 -1
- metadata +2 -3
- data/lib/teodoro/leiaute/arquivo_s3000.rb +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b56a0b10de8ab5ef5d882108e4a2a9242142e1ecb66c0ae73347746b8ebdd8f
|
4
|
+
data.tar.gz: 0de207a68296af5d14b7e6eb4973ee09f52b265606d61335dd1c7dae29bd4ad6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13de1c51e869027efd596cab712fd97683bccd8c6cea8afc624e86d9c475abe52b81ef69bba4c042610047bb6098623f852a4270a33b28105408142112b84a75
|
7
|
+
data.tar.gz: 6de6a031a3d78e24a553d07e3e06664ad6ae71482aced0ed6d51a0682fa7beb58952f5b1c40f4365918f8da78aaae3c6a3d98200491d511ae9824fc50b14f53f
|
@@ -3,6 +3,8 @@ module Teodoro
|
|
3
3
|
include ArquivoDeEvento
|
4
4
|
|
5
5
|
def processar
|
6
|
+
return if exclusao?
|
7
|
+
|
6
8
|
if retificado?
|
7
9
|
processar_retificacao
|
8
10
|
else
|
@@ -13,16 +15,20 @@ module Teodoro
|
|
13
15
|
|
14
16
|
private
|
15
17
|
|
18
|
+
def exclusao?
|
19
|
+
empresa.recibos_dos_eventos_excluidos.include?(numero_do_recibo)
|
20
|
+
end
|
21
|
+
|
16
22
|
def retificado?
|
17
23
|
arquivo_xml_de_retificacao
|
18
24
|
end
|
19
25
|
|
20
26
|
def arquivo_xml_de_retificacao
|
21
|
-
@arquivo_xml_de_retificacao ||=
|
27
|
+
@arquivo_xml_de_retificacao ||= arquivo_xml_por_recibo_de_evento_retificado.delete(numero_do_recibo)
|
22
28
|
end
|
23
29
|
|
24
|
-
def
|
25
|
-
empresa.
|
30
|
+
def arquivo_xml_por_recibo_de_evento_retificado
|
31
|
+
empresa.arquivo_xml_por_recibo_de_evento_retificado
|
26
32
|
end
|
27
33
|
|
28
34
|
def processar_retificacao
|
data/lib/teodoro/arquivo_xml.rb
CHANGED
@@ -28,7 +28,6 @@ require_relative 'leiaute/arquivo_s2306'
|
|
28
28
|
require_relative 'leiaute/arquivo_s2399'
|
29
29
|
require_relative 'leiaute/arquivo_s2500'
|
30
30
|
require_relative 'leiaute/arquivo_s2501'
|
31
|
-
require_relative 'leiaute/arquivo_s3000'
|
32
31
|
require_relative 'leiaute/arquivo_s3500'
|
33
32
|
require_relative 'leiaute_simplificado'
|
34
33
|
require_relative 'xml'
|
@@ -94,15 +93,16 @@ module Teodoro
|
|
94
93
|
|
95
94
|
public
|
96
95
|
|
97
|
-
attr_reader :
|
96
|
+
attr_reader :recibo_do_evento_a_excluir, :recibo_do_evento_a_retificar, :momento_de_processamento_pelo_e_social
|
98
97
|
|
99
98
|
# otimizacao do gerenciamento de memoria
|
100
99
|
def carregar
|
101
100
|
Console.print "carregando #{nome}.xml..." do
|
102
101
|
evento, recibo = carregar_evento_e_recibo
|
103
102
|
|
103
|
+
@recibo_do_evento_a_excluir = evento['infoExclusao/nrRecEvt'] if exclusao_por_recibo?
|
104
104
|
@retificacao = evento_retificavel? && evento['ideEvento/indRetif'] == '2'
|
105
|
-
@
|
105
|
+
@recibo_do_evento_a_retificar = evento['ideEvento/nrRecibo'] if retificacao?
|
106
106
|
@momento_de_processamento_pelo_e_social = recibo['processamento/dhProcessamento']
|
107
107
|
|
108
108
|
validar_carregamento
|
@@ -111,6 +111,10 @@ module Teodoro
|
|
111
111
|
tratar_excecao(e)
|
112
112
|
end
|
113
113
|
|
114
|
+
def exclusao_por_recibo?
|
115
|
+
tipo_de_evento == 'S3000'
|
116
|
+
end
|
117
|
+
|
114
118
|
def retificacao?
|
115
119
|
@retificacao
|
116
120
|
end
|
data/lib/teodoro/empresa.rb
CHANGED
@@ -41,8 +41,6 @@ module Teodoro
|
|
41
41
|
|
42
42
|
attr_accessor :inicio_da_validade
|
43
43
|
|
44
|
-
attr_reader :arquivos_xml_por_recibo_a_retificar
|
45
|
-
|
46
44
|
def processar # rubocop:disable Metrics/MethodLength
|
47
45
|
dar_feedback_para_o_usuario
|
48
46
|
criar_diretorios_destino
|
@@ -95,6 +93,14 @@ module Teodoro
|
|
95
93
|
@inicios_de_afastamento_por_numero_do_recibo ||= {}
|
96
94
|
end
|
97
95
|
|
96
|
+
def recibos_dos_eventos_excluidos
|
97
|
+
@recibos_dos_eventos_excluidos ||= Set.new
|
98
|
+
end
|
99
|
+
|
100
|
+
def arquivo_xml_por_recibo_de_evento_retificado
|
101
|
+
@arquivo_xml_por_recibo_de_evento_retificado ||= {}
|
102
|
+
end
|
103
|
+
|
98
104
|
private
|
99
105
|
|
100
106
|
def dar_feedback_para_o_usuario
|
@@ -148,15 +154,20 @@ module Teodoro
|
|
148
154
|
.map { |caminho| ArquivoXML.new(empresa: self, caminho: caminho) }
|
149
155
|
end
|
150
156
|
|
151
|
-
def classificar_arquivos_xml
|
157
|
+
def classificar_arquivos_xml # rubocop:disable Metrics/MethodLength
|
152
158
|
Console.print 'classificando os arquivos XML...' do
|
153
159
|
arquivos_xml
|
160
|
+
.tap { @arquivos_xml = [] }
|
154
161
|
.select(&:processavel?)
|
155
|
-
.
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
162
|
+
.each do |arquivo_xml|
|
163
|
+
if arquivo_xml.exclusao_por_recibo?
|
164
|
+
recibos_dos_eventos_excluidos << arquivo_xml.recibo_do_evento_a_excluir
|
165
|
+
elsif arquivo_xml.retificacao?
|
166
|
+
arquivo_xml_por_recibo_de_evento_retificado[arquivo_xml.recibo_do_evento_a_retificar] = arquivo_xml
|
167
|
+
else
|
168
|
+
arquivos_xml << arquivo_xml
|
169
|
+
end
|
170
|
+
end
|
160
171
|
end
|
161
172
|
end
|
162
173
|
|
@@ -208,11 +208,6 @@ module Teodoro
|
|
208
208
|
inicios_de_afastamento_por_numero_do_recibo[numero_do_recibo] = self
|
209
209
|
inicios_de_afastamento << self
|
210
210
|
end
|
211
|
-
|
212
|
-
def excluir
|
213
|
-
inicios_de_afastamento_por_numero_do_recibo.delete(numero_do_recibo)
|
214
|
-
inicios_de_afastamento.pop.then { raise unless _1 == self }
|
215
|
-
end
|
216
211
|
end
|
217
212
|
end
|
218
213
|
end
|
data/lib/teodoro/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teodoro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.51.
|
4
|
+
version: 0.51.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fortes Tecnologia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -236,7 +236,6 @@ files:
|
|
236
236
|
- lib/teodoro/leiaute/arquivo_s2399.rb
|
237
237
|
- lib/teodoro/leiaute/arquivo_s2500.rb
|
238
238
|
- lib/teodoro/leiaute/arquivo_s2501.rb
|
239
|
-
- lib/teodoro/leiaute/arquivo_s3000.rb
|
240
239
|
- lib/teodoro/leiaute/arquivo_s3500.rb
|
241
240
|
- lib/teodoro/leiaute_simplificado.rb
|
242
241
|
- lib/teodoro/obj.rb
|
@@ -1,80 +0,0 @@
|
|
1
|
-
module Teodoro
|
2
|
-
module Leiaute
|
3
|
-
class ArquivoS3000
|
4
|
-
include ArquivoDeEvento
|
5
|
-
|
6
|
-
def processar
|
7
|
-
excluir_arquivo_data if tipo_de_evento_processavel?
|
8
|
-
excluir_admissao if exclusao_de_admissao?
|
9
|
-
excluir_inicio_de_tsv if exclusao_de_inicio_de_tsv?
|
10
|
-
excluir_inicio_de_afastamento if exclusao_de_inicio_de_afastamento?
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def tipo_de_evento_processavel?
|
16
|
-
ArquivoXML::TIPOS_DE_EVENTO_PROCESSAVEIS.include?(tipo_de_evento)
|
17
|
-
end
|
18
|
-
|
19
|
-
def tipo_de_evento
|
20
|
-
@tipo_de_evento ||= evento['infoExclusao/tpEvento'].delete('-')
|
21
|
-
end
|
22
|
-
|
23
|
-
def excluir_arquivo_data
|
24
|
-
empresa.arquivos_data.excluir(numero_de_recibo_do_evento_a_excluir)
|
25
|
-
end
|
26
|
-
|
27
|
-
def numero_de_recibo_do_evento_a_excluir
|
28
|
-
@numero_de_recibo_do_evento_a_excluir ||= evento['infoExclusao/nrRecEvt']
|
29
|
-
end
|
30
|
-
|
31
|
-
def exclusao_de_admissao?
|
32
|
-
tipo_de_evento == 'S2200'
|
33
|
-
end
|
34
|
-
|
35
|
-
def excluir_admissao
|
36
|
-
contratos_de_emprego.remover(numero_de_recibo_do_evento_a_excluir)
|
37
|
-
end
|
38
|
-
|
39
|
-
def contratos_de_emprego
|
40
|
-
empresa.contratos_de_emprego
|
41
|
-
end
|
42
|
-
|
43
|
-
def exclusao_de_inicio_de_tsv?
|
44
|
-
tipo_de_evento == 'S2300'
|
45
|
-
end
|
46
|
-
|
47
|
-
def excluir_inicio_de_tsv
|
48
|
-
contratos_de_trabalho_sem_vinculo.remover(numero_de_recibo_do_evento_a_excluir)
|
49
|
-
end
|
50
|
-
|
51
|
-
def contratos_de_trabalho_sem_vinculo
|
52
|
-
empresa.contratos_de_trabalho_sem_vinculo
|
53
|
-
end
|
54
|
-
|
55
|
-
def exclusao_de_inicio_de_afastamento?
|
56
|
-
exclusao_de_afastamento? && inicio_de_afastamento?
|
57
|
-
end
|
58
|
-
|
59
|
-
def exclusao_de_afastamento?
|
60
|
-
tipo_de_evento == 'S2230'
|
61
|
-
end
|
62
|
-
|
63
|
-
def inicio_de_afastamento?
|
64
|
-
inicio_de_afastamento
|
65
|
-
end
|
66
|
-
|
67
|
-
def inicio_de_afastamento
|
68
|
-
@inicio_de_afastamento ||= inicios_de_afastamento_por_numero_do_recibo[numero_de_recibo_do_evento_a_excluir]
|
69
|
-
end
|
70
|
-
|
71
|
-
def inicios_de_afastamento_por_numero_do_recibo
|
72
|
-
empresa.inicios_de_afastamento_por_numero_do_recibo
|
73
|
-
end
|
74
|
-
|
75
|
-
def excluir_inicio_de_afastamento
|
76
|
-
inicio_de_afastamento.excluir
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|