Commit 33d5cf5d authored by Henning Leutz's avatar Henning Leutz 🥋

feat: #60 - You can create 2 bricks with the same name

parent 6d02c582
......@@ -266,6 +266,12 @@ define('package/quiqqer/bricks/bin/BrickEdit', [
});
self.fireEvent('save', [self]);
self.Loader.hide();
}).catch(function (e) {
QUI.getMessageHandler().then(function (MH) {
MH.addError(e.getMessage());
});
self.Loader.hide();
});
},
......
......@@ -1216,6 +1216,18 @@ M&ouml;chten Sie die Bausteine aus der Bausteinzone entfernen?</p>]]></de>
<de><![CDATA[Fügen Sie einen Titel hinzu!]]></de>
<en><![CDATA[Add a title!]]></en>
</locale>
<locale name="exception.brick.title.already.exists">
<de><![CDATA[
Ein Baustein mit dem Titel existiert bereits.
Bausteine mit gleichem Titel erschweren die Übersichtlichkeit.
Bitte wähle einen anderen Titel für diesen Baustein.
]]></de>
<en><![CDATA[
A Brick with the title already exists.
Bricks with the same title make it difficult to keep track of them.
Please choose a different title for this Brick.
]]></en>
</locale>
<locale name="brick.control.googlemaps.title">
<de><![CDATA[Bausteine: Maps-Karte]]></de>
......
......@@ -935,6 +935,26 @@ class Manager
$checkType($type);
// check duplicated titles
$result = QUI::getDataBase()->fetch([
'from' => $this->getTable(),
'where' => [
'title' => $Brick->getAttribute('title'),
'id' => [
'type' => 'NOT',
'value' => (int)$brickId
]
],
'limit' => 1
]);
if (isset($result[0])) {
throw new QUI\Exception([
'quiqqer/bricks',
'exception.brick.title.already.exists'
]);
}
// update
QUI::getDataBase()->update($this->getTable(), [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment