Skip to content
GitLab
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
44849044
Commit
44849044
authored
Dec 13, 2018
by
Okhin
Browse files
AUTO_INCREMENT returns the ID of the Next attribute, not the Last one
parent
fc3dabe7
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/controller/admin.php
View file @
44849044
...
...
@@ -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'
]
->
get
Las
tInsertedId
()
+
1
;
$parent
=
$f3
->
get
(
'container'
)[
'counterpart_finder'
]
->
get
Nex
tInsertedId
();
$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
));
...
...
app/controller/perso.php
View file @
44849044
...
...
@@ -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'
]
->
get
Las
tInsertedId
()
+
1
;
$parent
=
$f3
->
get
(
'container'
)[
'counterpart_finder'
]
->
get
Nex
tInsertedId
();
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
));
...
...
app/view/backend/contreparties.html
View file @
44849044
...
...
@@ -43,6 +43,7 @@
<table
cellspacing=
"0"
cellpadding=
"0"
>
<theader>
<th>
Id
</th>
<th>
Id du parent
</th>
<th>
Email
</th>
<th>
Date
</th>
<th>
Quoi
</th>
...
...
@@ -56,7 +57,8 @@
<repeat
group=
"{{ @data }}"
value=
"{{ @row }}"
>
<tr>
<td>
{{ @row.id }}
</td>
<td><a
href=
"{{'user_info', 'id='.@row.user_id | alias }}"
>
{{ @row.email }}
</a></td>
<td>
{{ @row.parent }}
</td>
<td><a
href=
"{{'user_info', 'id='.@row.user_id | alias }}"
>
{{ @row.email }}
</a></td>
<td>
{{ @row.datec }}
</td>
<td>
{{ @row.quoi }}
</td>
<td>
...
...
app/view/backend/user.html
View file @
44849044
...
...
@@ -95,6 +95,7 @@
<table
cellspacing=
"0"
cellpadding=
"0"
>
<theader>
<th>
Id
</th>
<th>
Id du parent
</th>
<th>
Date
</th>
<th>
Quoi
</th>
<th>
Taille/Piplome
</th>
...
...
@@ -106,6 +107,7 @@
<repeat
group=
"{{ @user.contreparties }}"
value=
"{{ @row }}"
>
<tr>
<td>
{{ @row.id }}
</td>
<td>
{{ @row.parent }}
</td>
<td>
{{ @row.datec }}
</td>
<td>
{{ @row.quoi }}
</td>
<td>
...
...
src/LQDN/Finder/CounterpartFinder.php
View file @
44849044
...
...
@@ -58,11 +58,11 @@ EOQ;
}
/**
* return the
last
inserted
id
* return the
id of the next item to be
inserted
*
* @return int
*/
public
function
get
Las
tInsertedId
()
public
function
get
Nex
tInsertedId
()
{
return
(
int
)
$this
->
connection
->
fetchColumn
(
"SELECT AUTO_INCREMENT FROM information_schema.tables WHERE table_name = 'contreparties' AND table_schema = DATABASE()"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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