Skip to content
GitLab
Menu
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
aabd8964
Commit
aabd8964
authored
Oct 28, 2020
by
tenma
Committed by
Bastien Le Querrec
Nov 09, 2020
Browse files
controller/admin: add logs and fix logic exceptions
parent
70f5f157
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/controller/admin.php
View file @
aabd8964
...
...
@@ -14,6 +14,7 @@ use LQDN\Command\UserCreateCommand;
use
LQDN\Command\UserUpdateCumulCommand
;
use
LQDN\Command\AdminUpdateParentCommand
;
use
LQDN\Command\AdminUpdateTotalUsersCommand
;
use
LQDN\Exception\InvalidEmailException
;
class
Admin
extends
Controller
{
...
...
@@ -50,7 +51,7 @@ class Admin extends Controller
99
=>
"résilié"
,
100
=>
"non applicable"
,
));
$f3
->
set
(
'TAILLES'
,
array
(
0
=>
_
(
'PlaceHolder -- ne pas utiliser'
)
.
' S'
,
1
=>
_
(
'Coupe Homme, Taille'
)
.
' S'
,
...
...
@@ -351,7 +352,7 @@ class Admin extends Controller
SET somme='"
.
\
Utils
::
asl
(
$somme
)
.
"',
lang='"
.
\
Utils
::
asl
(
$lang
)
.
"',
abo='"
.
\
Utils
::
asl
(
$abo
)
.
"',
public='"
.
\
Utils
::
asl
(
$public
)
.
"',
public='"
.
\
Utils
::
asl
(
$public
)
.
"',
adresse_id='"
.
$result
[
'adresse_id'
]
.
"'
WHERE id='"
.
\
Utils
::
asl
(
$_POST
[
'id'
])
.
"'"
);
}
...
...
@@ -828,9 +829,9 @@ class Admin extends Controller
$result
=
$db
->
query
(
"SELECT d.id AS id,
d.pdf AS pdf,
a.nom AS nom
FROM dons d
FROM dons d
INNER JOIN adresses a ON d.adresse_id = a.id
WHERE pdf<>''
WHERE pdf<>''
AND d.status IN (1,4,101)
AND d.user_id='"
.
$contrepartie
[
'user_id'
]
.
"'"
);
if
(
$result
)
{
...
...
@@ -1376,6 +1377,8 @@ class Admin extends Controller
public
function
banque_update
(
$f3
,
$filename
,
$testing
=
true
)
{
$log
=
new
\
Log
(
'/banque_update.log'
);
$separator
=
";"
;
$datas
=
array
();
$update
=
0
;
...
...
@@ -1478,7 +1481,13 @@ class Admin extends Controller
}
$hash
=
hash
(
'sha256'
,
date
(
"%Y-%m-%d %H:%i:%d"
)
.
$email
);
if
(
!
$testing
)
{
$f3
->
get
(
'container'
)[
'command_handler'
]
->
handle
(
new
UserCreateCommand
(
$email
,
$hash
,
$pseudo
,
0
,
0
));
$log
->
write
(
'Insert user: email "'
.
$email
.
'" pseudo "'
.
$pseudo
.
'" identifier "'
.
$identifier
.
'"'
);
try
{
$f3
->
get
(
'container'
)[
'command_handler'
]
->
handle
(
new
UserCreateCommand
(
$email
,
$hash
,
$pseudo
,
0
,
0
));
}
catch
(
InvalidEmailException
$e
)
{
// \Exception
$log
->
write
(
"exception: "
.
$e
);
throw
$e
;
}
};
}
}
else
{
...
...
@@ -1536,6 +1545,7 @@ class Admin extends Controller
$combien
=
$result
->
fetch
();
if
(
$combien
[
0
]
==
0
)
{
$update
++
;
$log
->
write
(
'Insert don: user_id "'
.
$user
[
'id'
]
.
'" identifier "'
.
$identifier
.
'" new effect "'
.
$new_effect
.
'" parent "'
.
$cumul
.
'"'
);
// Don récurrent non comptabilisé, on l'ajoute
if
(
!
$testing
)
{
$query
=
"INSERT INTO dons (status,
...
...
src/LQDN/Exception/AddressAlreadyExistsException.php
View file @
aabd8964
...
...
@@ -2,6 +2,6 @@
namespace
LQDN\Exception
;
class
AddressAlreadyExistsException
extends
\
Runtime
Exception
class
AddressAlreadyExistsException
extends
\
Logic
Exception
{
}
src/LQDN/Exception/AddressUsedException.php
View file @
aabd8964
...
...
@@ -2,6 +2,6 @@
namespace
LQDN\Exception
;
class
AddressUsedException
extends
\
Runtime
Exception
class
AddressUsedException
extends
\
Logic
Exception
{
}
src/LQDN/Exception/InvalidEmailException.php
View file @
aabd8964
...
...
@@ -2,6 +2,6 @@
namespace
LQDN\Exception
;
class
InvalidEmailException
extends
\
Runtime
Exception
class
InvalidEmailException
extends
\
Logic
Exception
{
}
Write
Preview
Supports
Markdown
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