Grab the next status id when inserting
This commit is contained in:
parent
d22c1db84d
commit
f2b8fb8f74
@ -644,8 +644,13 @@ function createStatus() {
|
|||||||
$row = hesk_dbFetchRow($res);
|
$row = hesk_dbFetchRow($res);
|
||||||
$my_order = $row[0]+10;
|
$my_order = $row[0]+10;
|
||||||
|
|
||||||
$insert = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` (`Key`, `TextColor`, `IsClosed`, `Closable`, `sort`)
|
// Get the next status id
|
||||||
VALUES ('STORED IN XREF TABLE', '".hesk_dbEscape($textColor)."', ".intval($isClosed).", '".hesk_dbEscape($closable)."', ".intval($my_order).")";
|
$res = hesk_dbQuery("SELECT `Id` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ORDER BY `Id` DESC LIMIT 1");
|
||||||
|
$row = hesk_dbFetchAssoc($res);
|
||||||
|
$nextId = $row['Id'] + 1;
|
||||||
|
|
||||||
|
$insert = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` (`Id`, `Key`, `TextColor`, `IsClosed`, `Closable`, `sort`)
|
||||||
|
VALUES (".intval($nextId).", 'STORED IN XREF TABLE', '".hesk_dbEscape($textColor)."', ".intval($isClosed).", '".hesk_dbEscape($closable)."', ".intval($my_order).")";
|
||||||
hesk_dbQuery($insert);
|
hesk_dbQuery($insert);
|
||||||
|
|
||||||
$newStatusId = hesk_dbInsertID();
|
$newStatusId = hesk_dbInsertID();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user