Commit aabd8964 authored by tenma's avatar tenma Committed by Bastien Le Querrec

controller/admin: add logs and fix logic exceptions

parent 70f5f157
......@@ -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,
......
......@@ -2,6 +2,6 @@
namespace LQDN\Exception;
class AddressAlreadyExistsException extends \RuntimeException
class AddressAlreadyExistsException extends \LogicException
{
}
......@@ -2,6 +2,6 @@
namespace LQDN\Exception;
class AddressUsedException extends \RuntimeException
class AddressUsedException extends \LogicException
{
}
......@@ -2,6 +2,6 @@
namespace LQDN\Exception;
class InvalidEmailException extends \RuntimeException
class InvalidEmailException extends \LogicException
{
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment