Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
agplv3
kohinos-tav
Commits
8e7ca4e1
Commit
8e7ca4e1
authored
3 years ago
by
Julien Jorry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix importController
parent
fa7ce658
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
ImportController.php
src/Controller/ImportController.php
+28
-2
No files found.
src/Controller/ImportController.php
View file @
8e7ca4e1
...
...
@@ -30,6 +30,7 @@ use App\Utils\OperationUtils;
use
Behat\Transliterator\Transliterator
;
use
DateTime
;
use
Doctrine\Common\Collections\ArrayCollection
;
use
Doctrine\DBAL\Exception\UniqueConstraintViolationException
;
use
FOS\UserBundle\Event\UserEvent
;
use
FOS\UserBundle\Model\UserManagerInterface
;
use
FOS\UserBundle\Util\TokenGeneratorInterface
;
...
...
@@ -313,7 +314,11 @@ class ImportController extends CRUDController
$contact
=
array_key_exists
(
'contact'
.
$cptContact
,
$row
)
?
$row
[
'contact'
.
$cptContact
]
:
''
;
$phone
=
array_key_exists
(
'phone'
.
$cptContact
,
$row
)
?
$row
[
'phone'
.
$cptContact
]
:
''
;
$email
=
array_key_exists
(
'email'
.
$cptContact
,
$row
)
?
$row
[
'email'
.
$cptContact
]
:
''
;
if
(
!
empty
(
trim
(
$contact
)))
{
$contactC
=
$this
->
em
->
getRepository
(
ContactComptoir
::
class
)
->
findOneBy
([
'comptoir'
=>
$comptoir
,
'name'
=>
$contact
]);
if
(
empty
(
$contactComptoir
))
{
$contactC
=
new
ContactComptoir
();
}
$contactC
->
setComptoir
(
$comptoir
);
$contactC
->
setEnabled
(
true
);
$contactC
->
setName
(
$contact
);
...
...
@@ -323,6 +328,9 @@ class ImportController extends CRUDController
$this
->
em
->
persist
(
$contactC
);
}
$this
->
addSuccess
(
$row
,
$line
,
'contact'
,
$this
->
translator
->
trans
(
'Contact ajouté : '
)
.
$contactC
);
}
else
{
break
;
}
++
$cptContact
;
}
...
...
@@ -554,7 +562,11 @@ class ImportController extends CRUDController
$contact
=
array_key_exists
(
'contact'
.
$cptContact
,
$row
)
?
$row
[
'contact'
.
$cptContact
]
:
''
;
$phone
=
array_key_exists
(
'phone'
.
$cptContact
,
$row
)
?
$row
[
'phone'
.
$cptContact
]
:
''
;
$email
=
array_key_exists
(
'email'
.
$cptContact
,
$row
)
?
$row
[
'email'
.
$cptContact
]
:
''
;
if
(
!
empty
(
trim
(
$contact
)))
{
$contactC
=
$this
->
em
->
getRepository
(
ContactPrestataire
::
class
)
->
findOneBy
([
'prestataire'
=>
$prestataire
,
'name'
=>
$contact
]);
if
(
empty
(
$contactC
))
{
$contactC
=
new
ContactPrestataire
();
}
$contactC
->
setPrestataire
(
$prestataire
);
$contactC
->
setEnabled
(
true
);
$contactC
->
setName
(
$contact
);
...
...
@@ -564,12 +576,17 @@ class ImportController extends CRUDController
$this
->
em
->
persist
(
$contactC
);
}
$this
->
addSuccess
(
$row
,
$line
,
'contact'
,
$this
->
translator
->
trans
(
'Contact ajouté : '
)
.
$contact
);
}
else
{
break
;
}
++
$cptContact
;
}
// Importer les gestionnaires du prestataire s'ils existent
$groupeGestionnaire
=
$this
->
em
->
getRepository
(
Usergroup
::
class
)
->
findOneByName
(
'Prestataire'
);
$gestionnaires
=
$this
->
importGestionnaires
(
$row
,
$line
,
$groupeGestionnaire
);
if
(
!
$this
->
test
)
{
$prestataire
->
setUsers
(
$gestionnaires
);
}
if
(
!
empty
(
$groupe
))
{
$groupeFound
=
$this
->
em
->
getRepository
(
Groupe
::
class
)
->
findOneBy
([
'slug'
=>
$this
->
slugify
(
$groupe
)]);
...
...
@@ -808,6 +825,9 @@ class ImportController extends CRUDController
}
else
{
$this
->
addWarning
(
$row
,
$line
,
'groupe'
,
'empty'
);
}
if
(
!
$this
->
test
)
{
$this
->
em
->
persist
(
$adherent
);
}
if
(
!
empty
(
$cotisations
))
{
$cotisationArray
=
explode
(
','
,
$cotisations
);
...
...
@@ -848,8 +868,10 @@ class ImportController extends CRUDController
$cotisation
->
getCotisationInfos
()
->
setDebut
(
DateTime
::
createFromFormat
(
'Ymd'
,
intval
(
$cotisationDetailsArray
[
1
])
.
'0101'
));
$cotisation
->
getCotisationInfos
()
->
setFin
(
DateTime
::
createFromFormat
(
'Ymd'
,
intval
(
$cotisationDetailsArray
[
1
])
.
'1231'
));
}
if
(
!
$this
->
test
)
{
$this
->
em
->
persist
(
$cotisation
);
}
}
// if (!$this->test) {
// try {
// $this->operationUtils->executeOperations($cotisation);
...
...
@@ -876,7 +898,9 @@ class ImportController extends CRUDController
$geolocFound
->
setCpostal
(
$cpostal
);
$geolocFound
->
setVille
(
$ville
);
$adherent
->
setGeoloc
(
$geolocFound
);
if
(
!
$this
->
test
)
{
$this
->
em
->
persist
(
$geolocFound
);
}
$this
->
addSuccess
(
$row
,
$line
,
'adresse'
,
$this
->
translator
->
trans
(
'Adhérent : nouvelle adresse : '
)
.
$geolocFound
->
__toString
());
}
}
...
...
@@ -1136,9 +1160,11 @@ class ImportController extends CRUDController
$userFound
=
$this
->
em
->
getRepository
(
User
::
class
)
->
findOneBy
([
'email'
=>
$email
]);
if
(
!
empty
(
$userFound
))
{
$userFound
->
addPossiblegroup
(
$groupe
);
$users
[]
=
$userFound
;
if
(
!
$this
->
test
)
{
$users
[]
=
$userFound
;
$this
->
em
->
persist
(
$userFound
);
}
else
{
$this
->
em
->
detach
(
$userFound
);
}
$this
->
addSuccess
(
$row
,
$line
,
'gestionnaire'
,
$this
->
translator
->
trans
(
'Rôle '
.
$groupe
.
' ajouté à l\'utilisateur '
)
.
$userFound
);
}
else
{
...
...
@@ -1148,7 +1174,7 @@ class ImportController extends CRUDController
$mobile
=
array_key_exists
(
'gestionnaire_mobile'
.
$cptGestionnaire
,
$row
)
?
$row
[
'gestionnaire_mobile'
.
$cptGestionnaire
]
:
''
;
$adherent
=
new
Adherent
();
$user
=
$this
->
userManager
->
createUser
();
$user
=
new
User
();
//
$this->userManager->createUser();
$user
->
setConfirmationToken
(
$this
->
tokenGenerator
->
generateToken
());
$user
->
setEnabled
(
true
);
$user
->
setPassword
(
md5
(
random_bytes
(
10
)));
...
...
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