Support

Akeeba Ticket System

#23322 Set Redirect Not Working for New Ticket in SEF Mode

Posted in ‘Akeeba Ticket System for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Akeeba Ticket System version
n/a

Latest post by user85330 on Tuesday, 27 October 2015 17:08 CDT

user85330
Hello, there.

Good evening!

When a new (private) ticket is successfully created in the SEF mode (Search Engine Friendly URLs set to "Yes" in Joomla! Global Configuration), the screen stays in the same spot.

It appears that the following code in /com_ats/Controller/NewTicket.php at the end of the save function does not redirect.
$this->setRedirect($url, JText::_('COM_ATS_LBL_NEWTICKET_SAVED'),'info');

When a new ticket is successfully created in the non-SEF mode, the screen is redirected (e.g. to index.php?option=com_ats&view=Tickets&category=11&Itemid=185&lang=en)

Please could you let me know how to make the screen redirect when in SEF mode?

Thanks.

Take care!

nicholas
Akeeba Staff
Manager
I'm not sure what you are doing. Creating private tickets with SEF enabled does work just fine. In fact, you verified that the redirection does work. It's the same line of code always, the one you said it works with non-SEF URLs. It's Joomla! –or your SEF extension, if you're using any– translating the non-SEF URL in setRedirect to a SEF URL. So, what you are describing isn't happening but I have a suspicion on what is going on.

When you submit the ticket does the ticket actually submit? That is, do you see the new ticket in the tickets page even though "the screen stays in the same spot"?

- If you do see the new ticket the problem is either in how Joomla! handles SEF routing or your browser. Try with a different browser. If the problem persists most likely you've created a new item for submitting new tickets. In this case it is normal to return to the new ticket page BUT you should have a success message at the top and the ticket submission form should be blank (not "stay[ing] in the same spot").

- If you do not see the ticket then you have a Javascript issue caused by a third party extension. Most likely they've done something funky trying to load the Javascript or ended up creating invalid inline Javascript code. Using your browser's Javascript debug console should give you more hints on the nature of the issue.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user85330
Thanks for the prompt reply, Nicholas.

Sorry wasn't that precise in the description. Yes, creating private tickets with SEF enabled works. After clicking on the "Send" button, the ticket is created and there is a success message and ticket the submission form is blank. However, the view is still the "NewTicket" view rather than the "Tickets" (which is the case when private tickets are created with non-SEF).

I have tried another browser (Firefox) but it is still the case (the redirection does not work).

By the way, does this site does redirect to the "Tickets" view after successfully creating new tickets? Seem to remember (perhaps incorrectly) that it stays in the "NewTicket" view.

Will try to debug using the Javascript debug console as you have suggested.

Thanks.

Take care!

nicholas
Akeeba Staff
Manager
Our own site does redirect to the tickets view. This is done in lines 323:325 of Controller\NewTicket.php. The only reason to be redirected back to the NewTickets page is hitting lines 205:206 (Ticket validation failed) or 220:221 (Ticket creation failed) or 296:303 (Post creation failed). In these cases the NewTicket view would be populated with your ticket data, not blank.

That said, you'll notice that the regular redirection (lines 323:325) do call getItemidURLSuffix which appends the Itemid (menu item ID) to the URL. As I said in my previous reply if you have a menu item pointing to the NewTicket page and you are using it to file new tickets then the redirection will most likely lead you back to the NewTicket page. That's because the Itemid in the URL points to a NewTicket view, therefore the SEF router will create a SEF URL valid for the NewTicket view. Unfortunately that's a side effect of the convoluted way SEF routing works in Joomla! :(

The only workaround is not creating menu items to the NewTicket view. Instead have menu items to the categories or the list of categories and let users click the New Ticket button there (that's how our site is set up). In this case you can copy the SEF URL of the new ticket page for each category and create Link menu items with this hardcoded relative URL. For example, I'd create a Link menu item with the URL /support/akeebatickets/new to show you the new ticket page for ATS support (https://www.akeebabackup.com/support/akeebatickets/new) on our site. I know that this sounds sketchy. Welcome to the wonderful world of Joomla! SEF routing that's claimed the sanity of many a developer...

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user85330
Hello, Nicholas.

Good evening!

Thank you very much for taking the time to write such a detailed explanation and for your suggestion. It's very useful and I will investigate based on what you have written. I just saw your reply as I have been investigating from the JavaScript angle (to no avail) as per your previous post. I think I have some JavaScript conflict as well because the "assign ticket" and "set status" buttons do not work. Moreover, when a reply is posted, the progress bar does not go away and the greyed out screen does not revert to a clear screen. Note - these JavaScript issues will be raised as another ticket should they not be solved (rather than be discussed here).

Thanks again for your post. Yes, sanity has been much stretched by Joomla!.

Take care!



nicholas
Akeeba Staff
Manager
What you describe is definitely a third party extension screwing up the Javascript. Try using the browser's debug console. For example, for Chrome: https://developers.google.com/web/tools/setup/workspace/setup-devtools

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user85330
Thanks, Nicholas.

You are right - it was caused by a plugin. Turned off the plugin one at a time to determine which one.

Take care!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!