joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[5.3] Banners - Enforce Unique Alias on Both Create and Update

Open travisrisner opened this issue 6 months ago • 2 comments

Pull Request for Issue #45570

Summary of Changes

This PR fixes an issue where Joomla allows the creation of multiple banners with the same alias within the same category, despite the code intending to enforce alias uniqueness.

Previously, the alias uniqueness check existed only within the update functionality of the store function in the BannerTable class, meaning it was bypassed during insert operations. This PR moves the uniqueness validation outside of the update logic so that it runs consistently during both insert and update operations.

I agree with Brian's comment on the initial issue though, I'm not fully sure what the alias is actually used for.

Testing Instructions

  1. In the Joomla administrator, go to Components → Banners.
  2. Create a new banner and name it "test".
  3. Try to create a second banner also named "test" in the same category.

Actual result BEFORE applying this Pull Request

  • Both banners are saved, resulting in two entries with the same alias in the same category.

Expected result AFTER applying this Pull Request

  • Saving the second banner fails with an error.
  • Only one banner with a specific alias per category is allowed.

Link to documentations

Please select:

  • [ ] Documentation link for docs.joomla.org:

  • [x] No documentation changes for docs.joomla.org needed

  • [ ] Pull Request link for manual.joomla.org:

  • [x] No documentation changes for manual.joomla.org needed

travisrisner avatar Jun 12 '25 02:06 travisrisner

I am wondering if it makes sense to have the same banner (name and alias) for different clients?

chmst avatar Jun 12 '25 14:06 chmst

I am wondering if it makes sense to have the same banner (name and alias) for different clients?

That's a good question, and I'm really not sure. It doesn't appear there's anything from stopping 2 banners from having the same name.

As far as the alias, I'm really not sure that the alias is actually used for anything. I can't find anything it's used for on the component or the banner module, but it could be something someone added as a plan for the future? I tested out the links it generates for tracking clicks and none of that uses an alias it seems at the moment, it's all pretty much ID based.

travisrisner avatar Jun 12 '25 15:06 travisrisner

I have tested this item :white_check_mark: successfully on f6a6f8d6fd28a7d58cf3a97b3a73aada091e0c7a

I was able to test this successfully! Thanks @travisrisner.

(I admit never having used banners in over a 100 sites 😱 lol but I hear quite a few people do, so I think they'll appreciate the fix :) )


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45599.

exlemor avatar Aug 01 '25 21:08 exlemor

I have tested this item :white_check_mark: successfully on f6a6f8d6fd28a7d58cf3a97b3a73aada091e0c7a

works for me!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45599.

SumCompanyInc avatar Aug 23 '25 17:08 SumCompanyInc

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45599.

richard67 avatar Aug 23 '25 18:08 richard67

Thanks

rdeutz avatar Aug 25 '25 11:08 rdeutz