Closed (fixed)
Project:
Commerce Point of Sale (POS)
Version:
8.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Feb 2018 at 02:04 UTC
Updated:
16 Mar 2018 at 21:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
fergy commentedThis could either clear out automatically or maybe a prompt could appear asking you to void that transaction before you are able to close register. Whichever way would work as long as it is gone by the next open.
Comment #3
alexpottHere's another idea. Let's completely remove the concept of current order. It's not necessary. Without a current order this behaviour goes away.
Comment #4
alexpott12 files changed, 62 insertions, 195 deletions.is the kind of diff stat I like.Comment #6
alexpottFixing the tests.
For me this change makes the parked order concept make sense since now we don't save an order unless you park it or complete it.
Comment #7
alexpottAnother advantage of this change is that now editing an order has the same UI as creating - ie with the park buttons etc...
This is a big improvement to this test. We weren't testing that the parked order that was retrieved correctly populated the form.
Comment #8
alexpottRe-ordering the files.
Comment #9
alexpottThis will fail now I've committed #2944411: Add test for commerge_log integration. Here's a fix.
Comment #11
smccabe commentedComment #13
smccabe commentedOn further usage, this patch has a fairly significant side effect, due to the fact that we don't save the order anymore, if you move to any other page your POS form is wiped and you have to start from scratch, if you're just trying to check a customers old order or something this would be very very annoying.
I'm reverting this patch and putting it back to "needs work"
Comment #14
alexpottSo it behaves like a normal entity. Which is good because we were only saving an order on certain actions but not all. What we need is a piece of JS saying don't leave the page without parking.
Comment #15
smccabe commentedDisagree with that, it shouldn't behave like a regular entity form, it should behave like a cart like commerce proper does.
Parking an order is if you wish to stop that order, run a new order, then later continue your parked order. Needing to use it anytime you want to do anything else is a bad and unnecessary user experience, say if I am part way through an order a customer asks me to update their profile.
It also means we couldn't do stuff like have a button to take you to that customer directly, if you'd loaded them up, it would make you park, but then you'd lose that order, or we'd have to build some sort of auto-park.
With a saved order the flow is much simpler
Comment #16
alexpottBut the problem is, for example, at the moment if you change the customer or add an adjustment the order is not saved. We only save the order if you add an order item or add a note.
Anyhow we can still remove the current order service and encapsulate it more to the POS class which should prevent it's usage everywhere - and also just store the ID so we're not providing something so convenient you wouldn't use the form state entity. And the patch adds back all the points where we saved the order before.
No interdiff cause rebase. Also we need to add tests around how current order works so we have the expectations tested. And we need to add tests about what happens if the register is closed.
Comment #17
smccabe commentedCode looks good and works as expected, setting to Needs Work for the outstanding tests, everything else is good to go though.
Comment #18
smccabe commentedRerolled patch to fix some minor conflicts
Comment #19
alexpottHere's a test that ensures the expected current order logic works. One difference to the issue title summary is that if the current order matches the newly re-opened register it is not removed. I think that that makes sense. If you open a different register it is cleared.
Comment #21
alexpottThere was a bot wobble seemingly.
Comment #22
joshmillerPer Alex's point, we are postponing #2938694: Allow a Register to be changed until this patch lands.
Comment #23
smccabe commentedEverything about the patch is good except for the not clearing on the same register part. 99% of the time it will be the same register and the idea is that you don't start a new day with anything set, since it gives the possibility to add something extra to the first order of the day by mistake, where as the idea you'd want to resume a partially done order form the day before that you haven't parked is pretty unlikely.
Conversely, this code also prevents you from ever loading up an order on a different register, which you may want to do if you are resuming a parked order from a different till.
I changed the patch slightly by clearing the current order any time a new till is opened and removing the register doesn't match check.
Comment #25
alexpottThis makes sense but then what should the order's register be set to? The register that initiated or the register that finally took payment? My guess is that it should be updated on unparking.
Comment #26
smccabe commented@alexpott Agreed, added a line to set the register each time we load up an order.
I think one test is still failing, but it's not a test we changed, so I'm posting to see if it is just my local.
Comment #28
smccabe commentedFixed bug with saving order causing an out of sync issue.
Comment #29
joshmillerA couple of nits. Leaving open for someone to review for functionality.
Missing @param
run-on sentence. Better:
Is this better than getting it from the tempStore current_order_id variable?
Naming convention: We changed "$order" to "$commerce_order" above. Perhaps we should settle on one and change it all over?
Are we just creating screenshots here or do we test for "expected screenshot similarity"?
Comment #30
smccabe commented1. Fixed
2. Fixed
3. the entity is already loaded and also the most up to date, loading via ID would load the one from the db.
4. Checkin in commerce core, it does use both but mostly uses $order so changed everything to be $order
5. For debugging, removed
Comment #32
alexpottLet's file a follow-up for the $order standardisation. We'll need to change route parameters and go through the code with a fine tooth comb. It's just creating a lot of noise on this issue. Reverting this from #30 and fixing the PosForm too.
Comment #33
alexpottNeed to add test coverage of this.
Comment #34
alexpottHere's a test which yet again proves the old adage
.
Comment #35
alexpottI think fixing the code so that the order on the register that completes it is a major bug fix.
Comment #36
alexpottUpdating for changes to HEAD.
Comment #37
alexpottRerolled after some cleanup.
Comment #38
alexpottCreated #2948455: Standardise on order over commerce_order as a followup
Comment #39
sorabh.v6Comment #40
sorabh.v6I tried to find some knit picks :D. The patch is from @alexpott and very hard to find any knit picks. I checked the functionality and its working fine. I close my register it takes me to end-of-day reports page when I close the register. Then I again opened the POS by selecting the same register and the draft order was already gone.
Setting it to RTBC.
Comment #42
smccabe commented