Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
mapas
theme-RCV
Commits
8b4596a0
Commit
8b4596a0
authored
3 weeks ago
by
Everaldo Matias
Browse files
Options
Download
Email Patches
Plain Diff
WIP - Inicia desenvolvimento do cenario 5 da importacao.
parent
fe30c185
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
Importer.php
Importer.php
+30
-0
No files found.
Importer.php
View file @
8b4596a0
...
...
@@ -300,6 +300,34 @@ class Importer {
return
$agent
;
}
/**
* Encontra a organização do ponto na plataforma pelo nome ou cnpj (quando for o caso)
* @param object $row
* @return Agent|null
*/
static
function
findOrganizationByOtherOwnerByRow
(
object
$row
):
?Agent
{
$app
=
App
::
i
();
if
(
$row
->
ponto_tipo
==
$app
->
config
[
'rcv.categoriesMap'
][
'ponto-coletivo'
])
{
$query
=
new
ApiQuery
(
Agent
::
class
,
[
'name'
=>
API
::
ILIKE
(
$row
->
organizacao_nome
),
'type'
=>
API
::
EQ
(
2
)
]);
}
else
{
$query
=
new
ApiQuery
(
Agent
::
class
,
[
'cnpj'
=>
API
::
EQ
(
$row
->
organizacao_cnpj
),
'type'
=>
API
::
EQ
(
2
)
]);
}
$ids
=
$query
->
findIds
();
/** @var Agent */
$agent
=
$app
->
repo
(
'Agent'
)
->
findOneBy
([
'id'
=>
$ids
],
[
'updateTimestamp'
=>
'DESC'
]);
return
$agent
;
}
/**
* Encontra o responsável do ponto na plataforma
* @param object $row
...
...
@@ -442,6 +470,8 @@ class Importer {
$result
[
'organization'
]
=
$organization
;
$result
[
'owner'
]
=
$owner
;
$scenario
=
3.1
;
}
else
if
(
$owner
=
self
::
findOrganizationByOtherOwnerByRow
(
$row
))
{
// $app->log->debug("Cenário 5 - encontrou a organização e compara o CPF do parent com o CPF da planilha");
}
else
{
$app
->
log
->
debug
(
"Cenário 3.2 - não encontrou nada, cria o proprietário, a organização e a inscrição"
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment