Closed (fixed)
Project:
Commerce Point of Sale (POS)
Version:
8.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Nov 2017 at 21:05 UTC
Updated:
11 Jan 2018 at 19:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
shabana.navas commentedComment #3
shabana.navas commentedComment #4
alexpottI think in an ideal world we'd do this a bit differently. I think we should deny access to register creation if there are no stores. And on admin/commerce/config/pos/registers if there are no stores then we should have help text to explain that in order to add a register you need to add a store. However that's quite a bit of work for not a huge amount of gain. We could just use drupal_set_message() and do
throw new AccessDeniedHttpException();as a quick work around. That would also remove the need for overriding the actions method.See #2923176-5: No Register helper text for a comment about the translatability of something like this.
Comment #5
shabana.navas commentedComment #6
sorabh.v6Comment #7
sorabh.v6Rerolled patch, as it wasn't applying on my local. RegisterForm.php had different code.
Please review, changes made as suggested in #4.
Comment #8
jnrfred commentedPatch tested and works as described above. But do we need to show access denied? Because it sounds like a permission issue.
Comment #9
smccabe commentedAgree with Fred, the not authorized makes this weird, you are authorized, you just don't meet the prerequisites to do anything yet. I think we're using permissions as a proxy for just not showing a link here, which isn't really good either. We WANT the user to attempt to setup a register and then see that they need to create a store, it leads them to the right place, if we hide an option, it only makes it more difficult for them.
Alex, in the reference issue, you recommend a set message instead of a form warning, any reason one is better than the other?
Comment #10
rakesh.gectcrAssigning myself.
Comment #11
rakesh.gectcrComment #12
rakesh.gectcrI am totally agreeing with #8 and #9, So removing
throw new AccessDeniedHttpException();.IMHO, drupal_set_message() automatically themed. Alex also mentions that in comments on the other issue.
Comment #13
subhojit777Reviewing the patch.
Comment #14
subhojit777This is not working.
Better do this
return parent::actions(), instead of creating new variable.Found these problems. I am going to work on them.
Comment #15
subhojit777Unnecessary
usestatement also found.Comment #16
subhojit777Comment #17
smccabe commentedAdded one more change, as with Alex's access deny removed, we still see a form we can't use, but can fill out. I added a quick return so as to not show the form if we have no stores, and only the message.
Comment #18
subhojit777We can do
return parent::form()here.Whitespace.
Comment #19
sorabh.v6Comment #20
sorabh.v6Hi,
Patch updated as per #18. Please review.
Comment #21
smccabe commentedAdded a test as well as some code styling cleanup so this would pass. It fixes a few small styling issues unrelated to this patch, but I wanted 100% passing and I figured it wasn't worth an extra issue since they're very minor.
Just gonna wait for tests to pass Drupal CI and then I'm gonna merge in, thanks all.
Comment #23
smccabe commented