Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LQDN Adminsys
don
Commits
608bf5a0
Commit
608bf5a0
authored
Jan 28, 2019
by
Okhin
Browse files
Ne pas exécuter les ordres en mode Test
parent
d316a401
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/controller/admin.php
View file @
608bf5a0
...
...
@@ -1341,7 +1341,7 @@ class Admin extends Controller
if
(
$identifier
&&
$transaction
&&
$effect
&&
$amount
&&
$statut
==
false
)
{
continue
;
}
if
(
$statut
==
'Refusé'
)
{
if
(
$statut
==
'Refusé'
and
!
$testing
)
{
$db
->
query
(
"UPDATE dons SET status = 103 WHERE id='"
.
$transaction
.
"'"
);
continue
;
}
...
...
@@ -1378,7 +1378,7 @@ class Admin extends Controller
$user
=
$f3
->
get
(
'container'
)[
'user_finder'
]
->
findByPseudo
(
$user_field
);
}
if
(
$user
)
{
if
(
$user
and
!
$testing
)
{
$db
->
query
(
"INSERT INTO identifiers(user_id, identifier) VALUES ('"
.
$user
[
'id'
]
.
"', '"
.
$identifier
.
"')"
);
$email
=
$user
[
'email'
];
}
else
{
...
...
@@ -1393,7 +1393,9 @@ class Admin extends Controller
$pseudo
=
$user_field
;
}
$hash
=
hash
(
'sha256'
,
date
(
"%Y-%m-%d %H:%i:%d"
)
.
$email
);
$f3
->
get
(
'container'
)[
'command_handler'
]
->
handle
(
new
UserCreateCommand
(
$email
,
$hash
,
$pseudo
,
0
,
0
));
if
(
!
$testing
)
{
$f3
->
get
(
'container'
)[
'command_handler'
]
->
handle
(
new
UserCreateCommand
(
$email
,
$hash
,
$pseudo
,
0
,
0
));
};
}
}
else
{
$email
=
$result
->
fetch
(
\
PDO
::
FETCH_ASSOC
);
...
...
@@ -1416,20 +1418,24 @@ class Admin extends Controller
AND d.id='"
.
$transaction
.
"'"
);
$result
=
$stmt
->
fetch
(
\
PDO
::
FETCH_ASSOC
);
if
(
!
$result
)
{
// don non trouvé en statut 101. On le crée (la banque à raison)
// statut = cumul
$f3
->
get
(
'container'
)[
'command_handler'
]
->
handle
(
new
DonationCreateCommand
(
$user
[
'id'
],
101
,
$new_effect
,
$amount
,
0
,
0
));
// Et on le récupère
$cumul
=
$db
->
lastInsertId
();
$don
=
$f3
->
get
(
'container'
)[
'donation_finder'
]
->
findById
(
$cumul
);
if
(
$testing
){
$cumul
=
rand
(
50000
,
70000
);
}
else
{
// don non trouvé en statut 101. On le crée (la banque à raison)
// statut = cumul
$f3
->
get
(
'container'
)[
'command_handler'
]
->
handle
(
new
DonationCreateCommand
(
$user
[
'id'
],
101
,
$new_effect
,
$amount
,
0
,
0
));
// Et on le récupère
$cumul
=
$db
->
lastInsertId
();
$don
=
$f3
->
get
(
'container'
)[
'donation_finder'
]
->
findById
(
$cumul
);
};
}
else
{
$cumul
=
$result
[
'id'
];
}
...
...
@@ -1447,19 +1453,21 @@ class Admin extends Controller
if
(
$combien
[
0
]
==
0
)
{
$update
++
;
// Don récurrent non comptabilisé, on l'ajoute
$query
=
"INSERT INTO dons (status,
datec,
somme,
user_id,
cumul,
identifier)
VALUES (
102,
'"
.
$new_effect
.
"',
"
.
$amount
.
",
'"
.
$user
[
'id'
]
.
"',
'"
.
$cumul
.
"',
'"
.
$identifier
.
"')"
;
if
(
!
$testing
)
{
$query
=
"INSERT INTO dons (status,
datec,
somme,
user_id,
cumul,
identifier)
VALUES (
102,
'"
.
$new_effect
.
"',
"
.
$amount
.
",
'"
.
$user
[
'id'
]
.
"',
'"
.
$cumul
.
"',
'"
.
$identifier
.
"')"
;
}
if
(
!
$testing
)
{
$db
->
query
(
$query
);
// On met alors à jour le cumul et le total de l'utilisateur concerné
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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