Commit 2696f5ea authored by okhin's avatar okhin 🚴

Merge branch 'preprod' into 'master'

Preprod

See merge request !96
parents bec07fcd 55459c47
Pipeline #2355 passed with stages
in 1 minute and 18 seconds
...@@ -177,7 +177,7 @@ class Admin extends Controller ...@@ -177,7 +177,7 @@ class Admin extends Controller
$status = 1; $status = 1;
} }
$total = $user_amount['total'] + $result['somme']; $total = $user_amount['total'] + $result['somme'];
$cumul = $user_amount['total'] + $result['somme']; $cumul = $user_amount['cumul'] + $result['somme'];
} }
if ($error != '') { if ($error != '') {
$f3->push('SESSION.error', $error); $f3->push('SESSION.error', $error);
...@@ -225,7 +225,7 @@ class Admin extends Controller ...@@ -225,7 +225,7 @@ class Admin extends Controller
$status = 0; $status = 0;
} }
$total = $user_amount['total'] - $result['somme']; $total = $user_amount['total'] - $result['somme'];
$cumul = $user_amount['total'] - $result['somme']; $cumul = $user_amount['cumul'] - $result['somme'];
if ($cumul < 0) { if ($cumul < 0) {
$error = "Impossible d'invalider, une contrepartie a été demandée"; $error = "Impossible d'invalider, une contrepartie a été demandée";
} }
......
...@@ -159,7 +159,7 @@ class Bank extends Controller ...@@ -159,7 +159,7 @@ class Bank extends Controller
if ($status!=101) { if ($status!=101) {
$cb_log->write("Ajout de ".$don['somme']); $cb_log->write("Ajout de ".$don['somme']);
$f3->get('container')['command_handler']->handle(new UserUpdateTotalCommand($user['id'], (int) $user['total'] + $don['somme'])); $f3->get('container')['command_handler']->handle(new UserUpdateTotalCommand($user['id'], (int) $user['total'] + $don['somme']));
$f3->get('container')['command_handler']->handle(new UserUpdateCumulCommand($user['id'], (int) $user['cumul'] + $don['cumul'])); $f3->get('container')['command_handler']->handle(new UserUpdateCumulCommand($user['id'], (int) $user['cumul'] + $don['somme']));
} }
$result = $db->query("SELECT cumul FROM users WHERE id='".$don['user_id']."'"); $result = $db->query("SELECT cumul FROM users WHERE id='".$don['user_id']."'");
$cumul = $result->fetch(\PDO::FETCH_ASSOC); $cumul = $result->fetch(\PDO::FETCH_ASSOC);
......
...@@ -67,8 +67,8 @@ class Perso extends Controller ...@@ -67,8 +67,8 @@ class Perso extends Controller
// Chargement des dons de l'utilisateur // Chargement des dons de l'utilisateur
$db = $f3->get('DB'); $db = $f3->get('DB');
$dons = $f3->get('container')['donation_finder']->findByUserId((int) $f3->get('SESSION.id')); $dons = $f3->get('container')['donation_finder']->findByUserId((int) $f3->get('SESSION.id'));
$dons = array_filter($dons, function ($id) { $dons = array_filter($dons, function ($don) {
return in_array((int) $id, [1, 4, 102]); return in_array((int) $don['status'], [1, 4]);
}); });
$f3->set('dons', $dons); $f3->set('dons', $dons);
} }
...@@ -77,12 +77,11 @@ class Perso extends Controller ...@@ -77,12 +77,11 @@ class Perso extends Controller
{ {
// Chargement des abonnements de l'utilisateur // Chargement des abonnements de l'utilisateur
$db = $f3->get('DB'); $db = $f3->get('DB');
$result = $db->query("SELECT datec, somme, status, id, pdf, identifier FROM dons WHERE user_id='".$f3->get('infos.id')."' AND status IN (101) ORDER BY datec ASC"); $dons = $f3->get('container')['donation_finder']->findByUserId((int) $f3->get('SESSION.id'));
$data = array(); $dons = array_filter($dons, function ($don) {
foreach ($result->fetchAll(\PDO::FETCH_ASSOC) as $row) { return in_array((int) $don['status'], [101, 102]);
$data[] = $row; });
} $f3->set('dons_recurrents', $dons);
$f3->set('dons_recurrents', $data);
} }
public function login($f3, $args) public function login($f3, $args)
......
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