User tests: Successful: Unsuccessful:
Pull Request for Issue #45603
Fixes #45603
-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.
-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.
-Clicking Save as Copy creates a client with the same name as the original, allowing duplicates.
-Clicking Save as Copy automatically generates a unique client name, preventing duplicates while preserving the copy functionality.
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
| Status | New | ⇒ | Pending |
| Category | ⇒ | Administration com_banners Language & Strings |
| 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
|
||
| Status | Closed | ⇒ | New |
| Closed_Date | 2025-10-06 16:26:19 | ⇒ | |
| Closed_By | harshkhatri8 | ⇒ |
| Status | New | ⇒ | Pending |
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.
@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.
This pull request has been automatically rebased to 5.4-dev.
| Labels |
Added:
bug
PR-5.4-dev
Removed: PR-5.3-dev |
||
@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.
| Category | Administration com_banners Language & Strings | ⇒ | Administration com_banners |
@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.
| Labels |
Removed:
Language Change
|
||
@richard67 is this testable now?
@richard67 is this testable now?
@exlemor Yes.
I have tested this item ✅ successfully on 435f3ff
I have tested this successfully! Thanks @harshkhatri8
I think attempting to save a duplicate should return an error and not a duplicate - otherwise items are created by accident.
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.
It is perfectly valid to have multiple client with the same name
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?
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?
@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.
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)'.
@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.
@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.
| Title |
|
||||||
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!