Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
cooperatic-mlc
kohinos
Commits
210f531c
Commit
210f531c
authored
Aug 17, 2020
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix batch import adherents/presta
parent
956fb4ad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
ImportController.php
src/Controller/ImportController.php
+13
-3
header.html.twig
templates/common/header.html.twig
+1
-2
menu.html.twig
templates/common/menu.html.twig
+0
-1
No files found.
src/Controller/ImportController.php
View file @
210f531c
...
...
@@ -17,6 +17,7 @@ use App\Entity\Rubrique;
use
App\Entity\Siege
;
use
App\Entity\User
;
use
App\Entity\Usergroup
;
use
App\Entity\Flux
;
use
App\Enum\ImportEnum
;
use
App\Enum\MoyenEnum
;
use
App\Events\MLCEvents
;
...
...
@@ -333,6 +334,8 @@ class ImportController extends CRUDController
private
function
importPrestataire
(
$csvRows
)
{
$operateur
=
$this
->
getUser
();
$operateur_id
=
$operateur
->
getId
();
// Iterate over the reader and write each row to the database
// groupe;adresse;cpostal;ville;raison;ecompte;metier;statut;responsable;iban;siret;web;horaires;description;rubriques;tags;tauxreconversion;cotisations;gestionnaire_email1;gestionnaire_nom1;gestionnaire_prenom1;gestionnaire_phone1;gestionnaire_mobile1;contact1;phone1;email1;contact2;phone2;email2
$line
=
1
;
...
...
@@ -495,7 +498,7 @@ class ImportController extends CRUDController
$cotisation
=
new
CotisationPrestataire
();
$now
=
new
DateTime
();
$cotisation
->
setReference
(
'Import du '
.
$now
->
format
(
'd/m/Y H:i'
));
$cotisation
->
setOperateur
(
$
this
->
getUser
()
);
$cotisation
->
setOperateur
(
$
operateur
);
$cotisation
->
setRole
(
'ROLE_SUPER_ADMIN'
);
$cotisation
->
setExpediteur
(
$prestataire
);
$cotisation
->
setMoyen
(
MoyenEnum
::
MOYEN_AUTRE
);
...
...
@@ -569,6 +572,8 @@ class ImportController extends CRUDController
$this
->
em
->
persist
(
$prestataire
);
$this
->
em
->
flush
();
$this
->
em
->
clear
();
// em is fully cleared: we need to refetch entities we get from em during process
$operateur
=
$this
->
em
->
getRepository
(
User
::
class
)
->
findOneBy
(
array
(
'id'
=>
$operateur_id
));
}
$line
++
;
...
...
@@ -579,6 +584,9 @@ class ImportController extends CRUDController
private
function
importAdherent
(
$csvRows
)
{
// Batch operations with doctrine require some workaround
$operateur
=
$this
->
getUser
();
$operateur_id
=
$operateur
->
getId
();
// Iterate over the reader and write each row to the database
// groupe;firstname;lastname;email;phone;mobile;adresse;cpostal;ville;ecompte
$line
=
1
;
...
...
@@ -678,7 +686,7 @@ class ImportController extends CRUDController
$cotisation
=
new
CotisationAdherent
();
$now
=
new
DateTime
();
$cotisation
->
setReference
(
'Import du '
.
$now
->
format
(
'd/m/Y H:i'
));
$cotisation
->
setOperateur
(
$
this
->
getUser
()
);
$cotisation
->
setOperateur
(
$
operateur
);
$cotisation
->
setRole
(
'ROLE_ADHERENT'
);
$cotisation
->
setExpediteur
(
$adherent
);
$cotisation
->
setMoyen
(
MoyenEnum
::
MOYEN_AUTRE
);
...
...
@@ -694,7 +702,7 @@ class ImportController extends CRUDController
$cotisation
->
getCotisationInfos
()
->
setFin
(
DateTime
::
createFromFormat
(
'Ymd'
,
intval
(
$cotisationDetailsArray
[
1
])
.
'1231'
));
}
$this
->
em
->
persist
(
$cotisation
);
$this
->
addSuccess
(
$row
,
$line
,
'cotisations'
,
$this
->
translator
->
trans
(
'Cotisation ajouté : '
)
.
$groupe
);
$this
->
addSuccess
(
$row
,
$line
,
'cotisations'
,
$this
->
translator
->
trans
(
'Cotisation ajouté
e
: '
)
.
$groupe
);
}
}
}
else
{
...
...
@@ -717,6 +725,8 @@ class ImportController extends CRUDController
}
$this
->
em
->
flush
();
$this
->
em
->
clear
();
// em is fully cleared: we need to refetch entities we get from em during process
$operateur
=
$this
->
em
->
getRepository
(
User
::
class
)
->
findOneBy
(
array
(
'id'
=>
$operateur_id
));
}
$line
++
;
...
...
templates/common/header.html.twig
View file @
210f531c
...
...
@@ -8,4 +8,4 @@
{%
include
'common/menu.html.twig'
%}
{%
endblock
menu
%}
</nav>
</header>
\ No newline at end of file
</header>
templates/common/menu.html.twig
View file @
210f531c
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
<span
class=
"navbar-toggler-icon"
></span>
</button>
;
{%
if
menuItems
is
not
defined
%}
{%
set
menuItems
=
getMenuItemsFromAlias
(
'main'
)
%}
{%
endif
%}
...
...
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