From 3aff822a2765991f43f085ed873a8a2063e9bc33 Mon Sep 17 00:00:00 2001 From: Pascal Corpet Date: Sat, 5 Jun 2010 14:52:15 +0200 Subject: [PATCH] Fixes message when adding a new entry with tableeditor. Closes #1022. Signed-off-by: Pascal Corpet --- ChangeLog | 3 +++ classes/pltableeditor.php | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3ea104..c69eaad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ VERSION 1.0.3 XX XX XXXX New: +Bug: + * #1022: Fixes message when adding a new entry with tableeditor -Car + ================================================================================ VERSION 1.0.2 13 11 2009 diff --git a/classes/pltableeditor.php b/classes/pltableeditor.php index efab475..43fc7b2 100644 --- a/classes/pltableeditor.php +++ b/classes/pltableeditor.php @@ -233,8 +233,6 @@ class PLTableEditor } if ($action == 'new') { if (!$this->idfield_editable) { - $r = XDB::query("SELECT MAX({$this->idfield})+1 FROM {$this->table}"); - $page->assign('id', $r->fetchOneCell()); $page->assign('entry', $this->prepare_new()); } $list = false; @@ -279,9 +277,9 @@ class PLTableEditor if ($this->idfield_editable && ($id != Post::v($this->idfield)) && $action != 'new') XDB::execute("UPDATE {$this->table} SET {$this->idfield} = {?} WHERE {$this->idfield} = {?} AND {$this->whereclause}", Post::v($this->idfield), $id); XDB::execute("REPLACE INTO {$this->table} VALUES ($values)"); - if ($id !== false) + if ($id !== false && $id !== null) { $page->trigSuccess("L'entrée ".$id." a été mise à jour."); - else { + } else { $page->trigSuccess("Une nouvelle entrée a été créée."); $id = XDB::insertId(); } -- 2.1.4