Needs review
Project:
Ubercart
Version:
7.x-3.x-dev
Component:
User Interface
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Jun 2011 at 20:26 UTC
Updated:
23 Oct 2014 at 12:42 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tr commentedIf you're talking about the save and continue button on the node edit form node/%/edit, that is controlled by Drupal. Ubercart has nothing to do with this. If you're not talking about that button, well maybe you could spare a few more keystrokes to fully describe your request.
Comment #2
longwave"Save and continue" is actually added by uc_product_form_alter() to product node forms.
Comment #3
shp commentedYes, I mean the button on the node edit form.
I've made some analysis :) See the
drupal_goto()source code. When there are$_REQUEST['destination']or$_REQUEST['edit']['destination']variables, the $url for theheader()will be taken from it. So, we have to delete those variables beforedrupal_goto()call. It can be performed in the button's submit handler (uc_product_save_continue_submit()):P.S. This simple solution has one disadvantage: the "destination" param will FINALLY disappear from the URL, so it will be impossible to push default Save button to return to the original "destination" URL. This problem can be solved with the help of the
hook_exit()(seedrupal_goto()) - we have to backup the original "destination" in theuc_product_save_continue_submit()and then restore it in thehook_exit().Comment #4
longwaveI think I understand what you mean, but not sure about your hook_exit implementation - if you can provide a patch that would help get this feature included.
Comment #5
shp commentedSee the patch attached. It's my second patch for Drupal and unfortunately I have no time to play with GIT at this moment, so please try to apply it. Any comments are welcome :)
P.S.
1. Perhaps these modules implement the same functionality:
http://drupal.org/project/save_edit
http://drupal.org/project/mb
(I haven't tested it, just read the descriptions)
2. In D7 this patch will be simpler.
Comment #6
longwavePatch looks good, and incredibly well commented - I just need time to test it.
Comment #8
longwaveComment #9
shp commented1. Small improvement -
unset($_REQUEST['edit']['destination']);changed to(see comments).
2. I've installed a git-client and created patch from it. Hope, that the patch will pass the tests...
Comment #10
shp commentedNo "#" in the filename...
Comment #11
shp commentedlongwave, why this patch cannot be tested automatically? Unfortunately, it wasn't released in the yesterday's 6.x-2.6 version...
P.S. I'm going to port it to D7-branch.
Comment #13
tr commented@shp: If you click on "View details" in #10, you will see that the testbot reports that your patch is in an invalid format, and tells you to "Ensure the patch only contains unix-style line endings."
I also think that using hook_exit() should be avoided at all costs, because it has impact on caching. Any patch which creates a new implementation of hook_exit(), like this one does, is going to need testing under a variety of circumstances to ensure that a little fix like this doesn't cause a major unintended behavior difference.
Comment #14
longwaveMarking as "minor" because this only has a very small number of use cases that I can see.
Can we just get away with a simpler implementation of unsetting $_REQUEST['destination'] in the submit handler, and not using hook_exit()? This means that ?destination URLs will be lost when using Save & continue, but that's an even more minor problem than the original issue here.
If we do go with this method:
Why bother duplicating the work that drupal_goto() does? Just back up the destination as provided, and let drupal_goto() perform sanity checks on it when it will actually be used.
Comment #15
longwaveAlso, when is $_REQUEST['edit']['destination'] actually used instead of just $_REQUEST['destination']? I can see core deals with this case, but do we need to handle it here as well?
Comment #16
hanoiiI just needed to fix this, attached is a patch for D7, haven't really reviewed the other patches but as there were complains and they fail tests, mine is really a simple one.
Also something very similar can be done for D6, but slightly different. I stumbled upon with this useful post that allowed me to work out this patch very nicely: https://drupal.org/comment/4792980#comment-4792980
EDIT: I also change it to a minor "Bug" because of what you'd expect from the "Save and continue" button.
Comment #17
hanoiiEDIT: Cleared because I really wanted to update the Issue summary. Will do that now.
Comment #18
hanoiiComment #19
hanoiiBumping this easy fix, still applies to 3.8.