Needs work
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Customer
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Jul 2015 at 00:39 UTC
Updated:
5 Apr 2016 at 01:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
joelpittetUX could use some love but seems to do the trick.
Comment #2
joelpittetStatus!
Comment #3
jnicola commentedReviewed code. Works as stated. No bugs, no errors, no warnings, all is well for me!
Updated patch to include the following:
1- Better label/title for check box.
2- A description explaining the implication
3- A permission check for "Edit any profile". May be wiser to change to be relevant to orders as this has a far reaching implication on orders possibly and is most relevant to that.
Only other thing I think I'd suggest on this is adding an entity field query to see if there are even orders out there containing this profile ID. If so, display the option, if not, do not.
Leaving as needs review so as others can chime in on the changes I've made and/or recommended.
Comment #4
jnicola commentedActually... thinking on it further it just makes sense to check if user can edit (essentially, affect) any order. Checking this box will in turn affect orders. I kept that check along with edit any profile check. Feel free to strike the edit any profile check.
Also I forgot to mention I downgraded this to a minor issue. It would seem the need for this in Drupal Commerce is up for debate.
Comment #5
joelpittetInterdiff would be nice between #1 and #3 and #3 and #4.
@see https://www.drupal.org/documentation/git/interdiff
Comment #6
joelpittet@jnicola It's not a minor issue, it causes a crap load of confusion.
Where did this go?
I can't see how this entity is now getting this property since it's transfer is now missing.
Comment #7
jnicola commentedHmmm you're right. That did drop out of my patches somehow. How strange!
Included. I'll let the actual maintainers of this decide to move this around or prioritize as they want. I can see why it's confusing, but I can also see why this was done the way it was.
I personally think a different approach all together might be wiser. Perhaps do something in the validation handler that checks for the conflict, and if the conflict exists and the user has appropriate permissions, prompt the user with a choice of what they desire to do.
This does resolve the issue though, and with a proper description and title makes it's purpose clear. Adding in permissions checks ensures we aren't showing something highly technical to casual user roles... you're in a good spot. Further review should quickly open this up for acceptance if the maintainers desire to include this.
Comment #8
joelpittetPlease add interdiffs with your changes so we know what you've changed and what you've left in the patch. It's helpful for anybody reviewing.
Thanks for the doc update. Not sure on the permission around that field yet, may be unnessasary since they wouldn't get to that edit form without those permissions to start with?
Comment #9
jnicola commentedA user may be able to edit profiles, and not orders. Adjusting a profile and forcing it to update relevant orders will in turn affect orders.
Comment #10
joelpittetInteresting point. Not directly editing the order just indirectly editing the order... hmmm.
So we shouldn't need
user_access('edit any commerce_customer_profile entity')check to my point still?Maybe we need the other one, but better would be to check which order type it belongs to and check the permissions on that type?
Comment #11
mglamanPosting interdiff as requested in #8
Since updating existing profiles adjusts orders I could see needing order edit permission. How does Commerce Address book work? Doesn't that edit existing entries?
Comment #13
joelpittetBased on the interdiff:
This may be a better title change but maybe lower case the words after, isn't that the convention? Sorry that was my fault too.
Still not convinced we need both or any of these permission checks.
Thanks for adding the description.
Condidering the $profile->status was done in the other function, that's why I put it there, why the move?
Why was this global added if it's not used?
Comment #14
joelpittetre #11 from what I recall it disables and creates a new one, or maybe it just endlessly duplicates things:)
Comment #15
joelpittetComment #16
joelpittetI'm still using patch #1 in production, btw.
Comment #17
smccabe commentedHey @joelpittet
I took the changes to title and description from #13 and rolled them into your original #1 patch. I didn't take anything else from the other patches as they didn't make sense to me either. I think this patch is good to go now.
Comment #18
joelpittetThanks this looks RTBC to me:) It's docs updates to #1 for better clarity.
Comment #19
mglamanLooks good to me, with #17. I'll mark RTBC and try to ping rszrama before commit.
Comment #20
jnicola commentedWoohoo! Given that last commit contains some of my work I look forward to having authorship on a commit to commerce :)
Comment #21
rszrama commentedThe good vibes are almost making me feel bad about being a pedant ... but still. : D
It seems a better title for the form element and process here is exactly what the issue title stays, force_update / "Force update". Additionally, I don't think we should have such a long description. In general, checkboxes shouldn't require descriptions and should just use a sufficiently descriptive title. (I'm sure I read about that from Nielsen once but am having a hard time finding the article now ... I just never see checkboxes with descriptions outside of Drupal. : )
In any event, I think this is too much explanation:
We can probably just shorten it to the title being "Force update this profile without creating a copy if necessary." or else put it behind a vertical tab if we truly need something longer. Or if we want, a longer checkbox title could be used in a settings form that enables this feature, which brings us to...
I do agree with the order permission check for the same reasons Jesse pointed out above. Since you are potentially indirectly editing other orders, it makes sense to protect this feature. That said, since we allow customer profile updating already within the context of an order edit form, we probably don't need the customer profile check ... but maybe we can replace that with a check against a variable called commerce_customer_profile_allow_force_update.
In fact, at first I was going to suggest we don't need that variable to be editable outside of code, but now I'm kinda thinking we should make it available and default it to FALSE. That will ensure sites that update and get this feature don't automatically have it appear but essentially have to opt-in from the order settings form.