Skip to content

Commit 62a22cc

Browse files
authored
[5.3] Banners - Enforce Unique Alias on Both Create and Update (joomla#45599)
1 parent ad14580 commit 62a22cc

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

administrator/components/com_banners/src/Table/BannerTable.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,15 @@ public function store($updateNulls = true)
216216
{
217217
$db = $this->getDbo();
218218

219+
// Verify that the alias is unique
220+
$table = new self($db, $this->getDispatcher());
221+
222+
if ($table->load(['alias' => $this->alias, 'catid' => $this->catid]) && ($table->id != $this->id || $this->id == 0)) {
223+
$this->setError(Text::_('COM_BANNERS_ERROR_UNIQUE_ALIAS'));
224+
225+
return false;
226+
}
227+
219228
if (empty($this->id)) {
220229
$purchaseType = $this->purchase_type;
221230

@@ -261,15 +270,6 @@ public function store($updateNulls = true)
261270
$this->setError($oldrow->getError());
262271
}
263272

264-
// Verify that the alias is unique
265-
$table = new self($db, $this->getDispatcher());
266-
267-
if ($table->load(['alias' => $this->alias, 'catid' => $this->catid]) && ($table->id != $this->id || $this->id == 0)) {
268-
$this->setError(Text::_('COM_BANNERS_ERROR_UNIQUE_ALIAS'));
269-
270-
return false;
271-
}
272-
273273
// Store the new row
274274
parent::store($updateNulls);
275275

0 commit comments

Comments
 (0)