From 53a523ba9dcbe36a2e2e7d595c597256df254628 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Nov 2017 20:45:06 +0100 Subject: [PATCH] Module builder --- htdocs/core/class/commonobject.class.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fc624f726a7..1553c9f3e53 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6173,15 +6173,23 @@ abstract class CommonObject } } - if (! $error && ! $notrigger) { + if (! $error) + { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); + } - if (!$notrigger) { - // Call triggers - $result=$this->call_trigger(strtoupper(get_class($this)).'_CREATE',$user); - if ($result < 0) { $error++; } - // End call triggers - } + if (! $error) + { + $result=$this->insertExtraFields(); + if ($result < 0) $error++; + } + + if (! $error && ! $notrigger) + { + // Call triggers + $result=$this->call_trigger(strtoupper(get_class($this)).'_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers } // Commit or rollback