diff --git a/app/controller/admin.php b/app/controller/admin.php index 7b00620909c4408c1a022379012d70e49630cdeb..7135557a3b2893beac5b131870ddcc07e9380229 100644 --- a/app/controller/admin.php +++ b/app/controller/admin.php @@ -440,7 +440,7 @@ class Admin extends Controller if ($user['cumul'] >= $needed) { // Assez de point, on crée // On récupère le dernier ID inséré - $parent = $f3->get('container')['counterpart_finder']->getLastInsertedId() + 1; + $parent = $f3->get('container')['counterpart_finder']->getNextInsertedId(); $f3->get('container')['command_handler']->handle(new CounterpartCreateCommand($adresse['id'], $user['id'], $quoi, 1, 2, date("Y-m-d H:i:s"), 'Imported from a file', $parent)); // On mets à jour le cumul de l'utilisateur $f3->get('container')['command_handler']->handle(new UserUpdateCumulCommand($user['id'], $user['cumul'] - $needed)); diff --git a/app/controller/perso.php b/app/controller/perso.php index fd6b901a086b9f1c807abcd55780a1401a9a3d82..ada08ea16574ee564f1334fd3462faada874e6c4 100644 --- a/app/controller/perso.php +++ b/app/controller/perso.php @@ -337,7 +337,7 @@ class Perso extends Controller // Ajout d'une demande de contrepartie pour chaque contrepartie if ((int) $user['cumul'] >= $valeur) { - $parent = $f3->get('container')['counterpart_finder']->getLastInsertedId() + 1; + $parent = $f3->get('container')['counterpart_finder']->getNextInsertedId(); switch ($quoi) { case 'hoodie': $f3->get('container')['command_handler']->handle(new CounterpartCreateCommand(\Utils::asl($adresse_id), $f3->get('SESSION.id'), 'hoodie', \Utils::asl($taille_h), 1, date("Y-m-d H:i:s"), \Utils::asl($commentaire), $parent)); diff --git a/app/view/backend/contreparties.html b/app/view/backend/contreparties.html index 8f71fd0a135c033e4c6298644861d0b31befe959..b77647ddcbbce4991dc849e4facb3168e52f66f7 100644 --- a/app/view/backend/contreparties.html +++ b/app/view/backend/contreparties.html @@ -43,6 +43,7 @@ + @@ -56,7 +57,8 @@ - + +
IdId du parent Email Date Quoi
{{ @row.id }}{{ @row.email }}{{ @row.parent }}{{ @row.email }} {{ @row.datec }} {{ @row.quoi }} diff --git a/app/view/backend/user.html b/app/view/backend/user.html index c0ca52a8b1cd82afbc7d895d9dd1ae877c5d60a8..77aeb5fd429fb72aeedd00429176e1136a731fe7 100644 --- a/app/view/backend/user.html +++ b/app/view/backend/user.html @@ -95,6 +95,7 @@ + @@ -106,6 +107,7 @@ +
IdId du parent Date Quoi Taille/Piplome
{{ @row.id }}{{ @row.parent }} {{ @row.datec }} {{ @row.quoi }} diff --git a/src/LQDN/Finder/CounterpartFinder.php b/src/LQDN/Finder/CounterpartFinder.php index ac0dca00778d35ed59eeaaa3b5e93abf45d39afb..16c4bbefa51da6e4014d9851e1409475bbb30856 100644 --- a/src/LQDN/Finder/CounterpartFinder.php +++ b/src/LQDN/Finder/CounterpartFinder.php @@ -58,11 +58,11 @@ EOQ; } /** - * return the last inserted id + * return the id of the next item to be inserted * * @return int */ - public function getLastInsertedId() + public function getNextInsertedId() { return (int) $this->connection->fetchColumn( "SELECT AUTO_INCREMENT FROM information_schema.tables WHERE table_name = 'contreparties' AND table_schema = DATABASE()"