bug PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar harshkhatri8
harshkhatri8
6 Oct 2025

Pull Request for Issue #45603
Fixes #45603

Screenshot 2025-10-06 221905

Summary of Changes

-Updated ClientModel.php to prevent duplicate client names when using Save as Copy.
-Implemented automatic unique name generation: if a client with the same name exists, the system appends (2), (3), etc.
-Preserves the original Save as Copy functionality without breaking existing save operations.

Testing Instructions

-Go to Components → Banners → Clients in Joomla Administrator.
-Select an existing client,.
-Click Save as Copy multiple times.
-Verify that each new client is created with a unique name:
-Confirm that no duplicates are created in the database and all other save functionality works as expected.

Actual result BEFORE applying this Pull Request

-Clicking Save as Copy creates a client with the same name as the original, allowing duplicates.

Expected result AFTER applying this Pull Request

-Clicking Save as Copy automatically generates a unique client name, preventing duplicates while preserving the copy functionality.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar harshkhatri8 harshkhatri8 - open - 6 Oct 2025
avatar harshkhatri8 harshkhatri8 - change - 6 Oct 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 6 Oct 2025
Category Administration com_banners Language & Strings
avatar brianteeman
brianteeman - comment - 6 Oct 2025

This is obviously not correct. With this pr you can never Save as copy so why keep the button. Please look at how Save as copy works elsewhere!

avatar harshkhatri8 harshkhatri8 - close - 6 Oct 2025
avatar harshkhatri8 harshkhatri8 - change - 6 Oct 2025
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2025-10-06 16:26:19
Closed_By harshkhatri8
Labels Added: Language Change PR-5.3-dev
avatar harshkhatri8 harshkhatri8 - change - 6 Oct 2025
Status Closed New
Closed_Date 2025-10-06 16:26:19
Closed_By harshkhatri8
avatar harshkhatri8 harshkhatri8 - change - 6 Oct 2025
Status New Pending
avatar harshkhatri8 harshkhatri8 - reopen - 6 Oct 2025
avatar harshkhatri8
harshkhatri8 - comment - 6 Oct 2025

This is obviously not correct. With this pr you can never Save as copy so why keep the button. Please look at how Save as copy works elsewhere!

Thanks for the feedback, @brianteeman. I see your point now — my current PR prevents Save as Copy from working as intended. I’ll update the PR so that:

Save / Save & Close still prevent duplicates.

Save as Copy will create a copy automatically, appending a suffix like it works if a client with the same name exists.

This should fix the original issue while keeping Joomla’s copy functionality intact. I’ll push an updated version soon.

avatar harshkhatri8 harshkhatri8 - change - 6 Oct 2025
The description was changed
avatar harshkhatri8 harshkhatri8 - edited - 6 Oct 2025
avatar harshkhatri8
harshkhatri8 - comment - 6 Oct 2025

This is obviously not correct. With this pr you can never Save as copy so why keep the button. Please look at how Save as copy works elsewhere!

i have made all the necessary changes can you please now review it.
Screenshot 2025-10-06 221905

avatar richard67
richard67 - comment - 6 Oct 2025

@harshkhatri8 When you create a PR you should check how your changes look on GitHub: https://github.com/joomla/joomla-cms/pull/46239/files . Then you would see it has a bunch of code style issues.

avatar HLeithner
HLeithner - comment - 15 Oct 2025

This pull request has been automatically rebased to 5.4-dev.

avatar richard67 richard67 - change - 2 Nov 2025
Labels Added: bug PR-5.4-dev
Removed: PR-5.3-dev
avatar richard67
richard67 - comment - 2 Nov 2025

@harshkhatri8 I've allowed myself to apply the last 2 necessary code style fixes. You can see the details when expanding the last 2 resolved conversations at the bottom.

avatar joomla-cms-bot joomla-cms-bot - change - 2 Nov 2025
Category Administration com_banners Language & Strings Administration com_banners
avatar richard67
richard67 - comment - 2 Nov 2025

@harshkhatri8 In addition to the previous 2 code style fixes, I have applied another 2 to remove the obsolete new language string and use statement. As before you can check the details when expanding the resolved conversations on GitHub.

avatar richard67 richard67 - change - 2 Nov 2025
Labels Removed: Language Change
avatar exlemor
exlemor - comment - 3 Nov 2025

@richard67 is this testable now?

avatar richard67
richard67 - comment - 3 Nov 2025

@richard67 is this testable now?

@exlemor Yes.

avatar exlemor exlemor - test_item - 3 Nov 2025 - Tested successfully
avatar exlemor
exlemor - comment - 3 Nov 2025

I have tested this item ✅ successfully on 435f3ff

I have tested this successfully! Thanks @harshkhatri8


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

avatar ceford
ceford - comment - 3 Nov 2025

I think attempting to save a duplicate should return an error and not a duplicate - otherwise items are created by accident.


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

avatar chmst
chmst - comment - 3 Nov 2025

in the issue ##45603 I wrote that I expect an error message.

@harshkhatri8 thank you so much for your contribution. But in this case a simple error-message is better.
When items are saved as copy, Joomla generates automatically a new title.
But this is another use case and if there is a duplicate, it is probably a typo or someone did not see that a client is altready saved.

avatar brianteeman
brianteeman - comment - 3 Nov 2025

It is perfectly valid to have multiple client with the same name

avatar ceford
ceford - comment - 4 Nov 2025

It is perfectly valid to have multiple client with the same name

In the Banners: Edit form, Banner Details tab you can select a Client from a list of Clients. Would it not be confusing to have clients with the same name?

avatar harshkhatri8
harshkhatri8 - comment - 6 Nov 2025

Thanks for the suggestions and all the doubts but i have made the changes that are suggested to me in the starting when i start working on the issue. Anything else that I can help with?

avatar muhme
muhme - comment - 6 Nov 2025

@ceford wrote:

I think attempting to save a duplicate should return an error and not a duplicate - otherwise items are created by accident.

@chmst wrote:

in the issue ##45603 I wrote that I expect an error message.

For me, the use case for ‘Copy and Save’ is as follows: I configure one entry with some details, then use ‘Copy and Save’ to duplicate all configurations, and afterwards I modify the new entry. This is a universal UX pattern, and for that, the PR is working as expected for me.

avatar muhme
muhme - comment - 6 Nov 2025

What feels a bit strange to me is that the banner client name is silently changed if I try to have two clients with the same name. For example: I have 'Unicorn Client'. When editing a second entry and changing its name to ‘Unicorn Client’, then pressing Save, it shows the message 'Client saved.' – but it is actually saved as 'Unicorn Client (2)'.

avatar muhme
muhme - comment - 6 Nov 2025

@harshkhatri8 A minor imperfection is that saving a third time adds another ' (2)', resulting in 'Unicorn Client (2) (2)'. In other places, and as I would expect, it would be 'Unicorn Client (3)'. Perhaps it’s best to wait until we’ve decided how to handle the original issue before adjusting this detail.

avatar harshkhatri8
harshkhatri8 - comment - 6 Nov 2025

@harshkhatri8 A minor imperfection is that saving a third time adds another ' (2)', resulting in 'Unicorn Client (2) (2)'. In other places, and as I would expect, it would be 'Unicorn Client (3)'. Perhaps it’s best to wait until we’ve decided how to handle the original issue before adjusting this detail.

thanks for understanding the problem and explaining in detail it'll help to solve the problem with precision and without creating any misunderstanding.

avatar HLeithner HLeithner - change - 24 Nov 2025
Title
Fix: Banner clients accept duplicates
[5.4] Fix: Banner clients accept duplicates
avatar HLeithner HLeithner - edited - 24 Nov 2025

Add a Comment

Login with GitHub to post a comment