diff --git a/etc/sql/pgsql-basesystem.sql b/etc/sql/pgsql-basesystem.sql index 86818fa6..69b85187 100644 --- a/etc/sql/pgsql-basesystem.sql +++ b/etc/sql/pgsql-basesystem.sql @@ -15,6 +15,9 @@ CREATE TABLE suser ( status BOOL ) WITH OIDS; +CREATE UNIQUE INDEX suser_title_uniq_idx ON suser(title); +CREATE UNIQUE INDEX suser_email_uniq_idx ON suser(lower(email)) WHERE email IS NOT NULL; + CREATE TABLE sgroup ( id SERIAL PRIMARY KEY, sys_owner INT4 DEFAULT NULL REFERENCES suser ON DELETE SET NULL ON UPDATE CASCADE, diff --git a/lib/Database/database.class.inc b/lib/Database/database.class.inc index 387eb5f1..6064aa43 100644 --- a/lib/Database/database.class.inc +++ b/lib/Database/database.class.inc @@ -781,8 +781,8 @@ class PXDatabase extends DatabaseAdapter implements DatabaseInterface $newId = $this->InsertObject($format->id, $dbFields, $dbValues, false); if ($newId < 0) { $errString = $this->GetError(); - $audit->error($errString, $format->id . '/' . getFromArray($object, 'parent')); $this->transactionRollback(); + $audit->error($errString, $format->id . '/' . getFromArray($object, 'parent')); $this->FatalError($errString); } @@ -1095,9 +1095,10 @@ class PXDatabase extends DatabaseAdapter implements DatabaseInterface $result = $this->UpdateObjectById($format->id, $object['id'], $dbFields, $dbValues, false); if ($result < 0) { - $audit->error($this->GetError(), $format->id . '/' . $object['id']); + $errString = $this->GetError(); $this->transactionRollback(); - $this->FatalError($this->GetError()); + $audit->error($errString, $format->id . '/' . $object['id']); + $this->FatalError($errString); } if ($format->struct == 'tree' && isset($objectInDB['parent']) && $objectInDB['parent'] != $object['parent']) { $childs = $this->getObjectsByParent($format, NULL, $objectInDB['parent'], DB_SELECT_TREE); diff --git a/lib/Logger/nllogger.class.inc b/lib/Logger/nllogger.class.inc index 9f093e4f..0225878b 100644 --- a/lib/Logger/nllogger.class.inc +++ b/lib/Logger/nllogger.class.inc @@ -285,6 +285,7 @@ class FileAppender extends Appender */ class SQLAppender extends Appender { + /** @var PXDatabase */ public $db; public function __construct($name)