The shop's own words reach the bottom of its own bill - #847
Merged
Merged
Conversation
footer_print is a box on the printing settings screen. A restaurant had "Thanking You / Visit Again" saved in it and handed every guest a bill saying "Thank you, please visit again" - the generic line the renderer falls back to. Nothing had failed. escpos-receipt reads sale.footer and always has. bill-payload never set it; the word "footer" did not appear in that file at all. A setting written, stored, offered on a screen, and read by nobody. The fourth of this shape found today. Trimmed, empty lines dropped, and capped at four lines of sixty-four characters: it is free text on a document a customer keeps, printed on a roll that does not stop, so a paste accident should cost a line rather than a roll of paper. CRLF from a Windows textarea is handled without caring which arrived. 7 tests, and the last one is the one that matters: it reads every sale.<field> out of the renderer and asks the payload for each. That sweep is what would have caught this. It found six more the renderer reads and nothing feeds - cashier, branch, payments, change, itemCount, totalWeight - and they are NAMED in the test rather than quietly allowed, because a named gap is the opposite of this bug. Two are honestly conditional (a BILL is unpaid, so payments and change have nothing to say); four are branches waiting for a caller. Shrink that list, never grow it.
Contributor
|
Merged to Try it at https://develop.posnic.io, or run it yourself: git fetch origin develop && git checkout develop
npm install && npm --prefix api install
npm run dev # then http://localhost:3000When you have tested it, say what you did and what happened, and set Reporting that something is broken is as useful as fixing it. It is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while checking a live restaurant's print settings before a handover.
footer_printis a box on the printing settings screen. That shop had "Thanking You / Visit Again" saved in it, and every bill it handed a guest said "Thank you, please visit again" — the generic line the renderer falls back to.Nothing had failed.
escpos-receiptreadssale.footerand always has.bill-payloadnever set it: the word "footer" did not appear in that file at all. A setting written, stored, offered on a screen, and read by nobody.That is the fourth of this exact shape found today, after the module packaged where nothing could require it (#830), the guard whose regex could never match (#831), and the settings save that never moved its watermark (#838).
The fix
One field, trimmed, empty lines dropped, capped at four lines of sixty-four characters. It is free text on a document a customer keeps, printed on a roll that does not stop, so a paste accident should cost a line rather than a roll of paper. CRLF from a Windows textarea is handled without caring which arrived.
The test that would have caught it
7 tests, and the last is the important one: it reads every
sale.<field>out of the renderer and asks the payload for each one, because the gap between those two files is where this keeps happening.It immediately found six more the renderer reads and nothing feeds:
cashier,branch,payments,change,itemCount,totalWeight. They are named in the test rather than quietly allowed, because a named gap is the opposite of this bug. Two are honestly conditional — a BILL is unpaid, sopaymentsandchangehave nothing to say. The other four are branches waiting for a caller.The comment on that list says: shrink it, never grow it.
api 11,113 pass. Desktop 2842 pass.