diff --git a/app/controller/admin.php b/app/controller/admin.php index c62c3becf6133ed92a43f4c3233eed75b10dc586..b74fabc13951b42330ab44ec07c22ae8123ce0e0 100644 --- a/app/controller/admin.php +++ b/app/controller/admin.php @@ -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, diff --git a/src/LQDN/Exception/AddressAlreadyExistsException.php b/src/LQDN/Exception/AddressAlreadyExistsException.php index cccf05cf7c23dd3fbb336248f555bb653996bf8b..337919cffefadff19b18893df3bc2e16254273eb 100644 --- a/src/LQDN/Exception/AddressAlreadyExistsException.php +++ b/src/LQDN/Exception/AddressAlreadyExistsException.php @@ -2,6 +2,6 @@ namespace LQDN\Exception; -class AddressAlreadyExistsException extends \RuntimeException +class AddressAlreadyExistsException extends \LogicException { } diff --git a/src/LQDN/Exception/AddressUsedException.php b/src/LQDN/Exception/AddressUsedException.php index f1f87fe1609862e54d12ca7d061f52b0f3d8fbdc..81c0075b1090a2666513988d85ff0f522f36bfb4 100644 --- a/src/LQDN/Exception/AddressUsedException.php +++ b/src/LQDN/Exception/AddressUsedException.php @@ -2,6 +2,6 @@ namespace LQDN\Exception; -class AddressUsedException extends \RuntimeException +class AddressUsedException extends \LogicException { } diff --git a/src/LQDN/Exception/InvalidEmailException.php b/src/LQDN/Exception/InvalidEmailException.php index d24191ac929591dadf35051d4d206d55eae41120..64a38ae81f7b6e983aaa8a9ee874b651e31a01ea 100644 --- a/src/LQDN/Exception/InvalidEmailException.php +++ b/src/LQDN/Exception/InvalidEmailException.php @@ -2,6 +2,6 @@ namespace LQDN\Exception; -class InvalidEmailException extends \RuntimeException +class InvalidEmailException extends \LogicException { }