From 3ef58b681fe1db3b4f99e2619a5a1a1acdaa4694 Mon Sep 17 00:00:00 2001 From: Xenomporio <> Date: Mon, 11 Jul 2022 21:57:48 +0200 Subject: [PATCH] Bugfix auto increment of document IDs --- www/lib/class.erpapi.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index f6fc71c0..c5d014c9 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -33040,20 +33040,23 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p if($field === 'mysql55') { return '1'; } - if(strpos($field,'next') !== false) + + if(strpos($field,'next') != false) { $firmendatenid = (int)$this->app->DB->Select('SELECT MAX(id) FROM firmendaten LIMIT 1'); - if ($this->app->DB->Select("SHOW COLUMNS FROM firmendaten LIKE '$field'")) { - $firmendaten_value = $this->app->DB->Select( - sprintf( - 'SELECT `%s` FROM firmendaten WHERE id = %d LIMIT 1', - $field, $firmendatenid) - ); - } + if ($this->app->DB->Select("SHOW COLUMNS FROM firmendaten LIKE '$field'")) { + $firmendaten_value = $this->app->DB->Select( + sprintf( + 'SELECT `%s` FROM firmendaten WHERE id = %d LIMIT 1', + $field, $firmendatenid) + ); + } + if(!$this->app->DB->error()) { return $firmendaten_value; } + $firmendaten_value = $this->app->DB->SelectRow( sprintf('SELECT id, wert FROM firmendaten_werte WHERE `name` = \'%s\' LIMIT 1', $field) );