Closed (fixed)
Project:
Commerce Affiliate
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Jun 2015 at 02:56 UTC
Updated:
10 Oct 2015 at 23:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
deggertsen commentedComment #2
deggertsen commentedComment #3
deggertsen commentedComment #4
deggertsen commentedOK, I've at least found the problem. Not sure the best way to fix it. For some reason $form_state['commission_type'] is not being passed from commerce_affiliate_ui_enable_commission_type_form() to commerce_affiliate_ui_enable_commission_type_form_submit(). I tried to simply get rid of commerce_affiliate_ui_enable_commission_type_form_submit() and put the necessary stuff into commerce_affiliate_ui_enable_commission_type_form() and it worked. Of course it skipped the confirmation step and it also didn't redirect back, but at least it enabled the commission type.
Still trying to figure out a more permanent solution and write a patch.
Comment #5
deggertsen commentedok, here's a first run at a patch. The main problem with the patch is that it doesn't redirect back to the commission types page, but everything else seems to be working. I removed the confirmation page as I see very little reason to have one as it's inconsequential to enable/disable a commission type and I couldn't figure out how to get the commission_type to pass through the confirm_form() function in order to fix the error. Removing the extra step makes it so I can actually enable/disable commission types.
This definitely needs review from someone who knows what they're doing. =)
Comment #6
liliplanet commentedHi! Watching the progress daily as the affiliate system is so important for my next phase. Its been very quiet since June, is there perhaps any news of a stable version?
Most most appreciate your expert work on this :)
Comment #7
deggertsen commented@Liliplanet, tests are helpful! That's the only thing this patch is working on. I could go ahead and commit it myself, but I would like others to test first.
As far as a stable release, we have three issues outstanding (including this one) shown on the project page that we'd love to have your help on!
Comment #8
jedihe commented@deggertsen: I think the original issue is caused by $form_state not being passed by reference to the form constructor. I tested your patch in simplytest.me and it got the commission type enabled/disabled, but I think it's much better practice to keep the confirmation form.
I'm attaching a patch with my proposed fix. Will test in simplytest.me and report back the results.
Comment #9
jedihe commentedMissed the disable form in my previous patch. Adding that now and posting in order to test.
Comment #10
jedihe commented#9 worked flawlessly in simplytest.me. If you want to see the details, please watch: https://drive.google.com/file/d/0B2jEubEfYfP2X2tQWTdrTzR6dmM/view?pli=1 (runtime: 2:38)
As a final note, form constructors are expected to set $form_state by reference, please see example code in the docs: https://api.drupal.org/api/drupal/includes!form.inc/group/form_api/7
@deggertsen: moving to RTBC, please check and let me know if it looks good for you to commit :D. Thanks!
Comment #11
deggertsen commented@jedihe, yes! I think that's probably all it was. I don't have time to test right now, but I'll go ahead and commit it to dev as it looks good to me. If anyone finds any problems with it they can post here and we can fix it.
Comment #13
deggertsen commented