This should most be a 1:1 port from the 7.x branch, as the receipt functionality will stay the same, just updating to twig and 2.x
| Comment | File | Size | Author |
|---|---|---|---|
| #37 | 2901030-37.patch | 42.79 KB | smccabe |
| #25 | 2901030-25.patch | 35.6 KB | subhojit777 |
| #24 | 2901030-24.patch | 7.37 KB | subhojit777 |
| #22 | 2901030-22.patch | 15.41 KB | subhojit777 |
| #18 | receipt_printing-2901030-18-interdiff.txt | 14.47 KB | sorabh.v6 |
Comments
Comment #2
cornifex commentedThis is just a baseline for now. Was working on the access and page callbacks, but was having some issues with my dev site.
Comment #3
cornifex commentedAccess callback needs actual permissions to check. The ones added are just ported over from D7
Comment #4
thejacer87 commentedHere's some more work. Just wanted to post the WIP. If you make a payment on an order and you go to `/admin/commerce/pos/{payment_id}/print-receipt` it will load a page with a "print out".
Next steps, as I see it:
PS, I didn't post an interdiff, because I couldn't get @cornifex's patch to apply cleanly for me.
Comment #5
thejacer87 commentedcreated the settings menu. saves the header and footer. also start the conversion to ajax. but something is wrong so i could use a hand with that.
Comment #6
smccabe commentedStill TODO:
Comment #7
moshe weitzman commentedWorking off the last TODO:
MW: I looked through the PHP code and my eyeballs didn't bleed (at all). The compliance is at least "Good.". I can run phpcs against it and remedy any problems if desired.
MW: I guess you mean item totals. I've added them to the receipt.
MW: I'm not yet clear on the user interaction that's expected. Where is the Reprint receipt button supposed to appear? Right now, its on the main POS form (commerce_pos), and its hard coded to order 1. I would expect a 'Print receipt' Operation to be added to each row in admin/commerce/orders, admin/commerce/orders/payments, and an action link when viewing order details. I might be missing something because I can't get an order to Save when using the main POS form. It just keeps returning me to an order submission.
MW: I've added instructions to the README for getting jQuery.print plugin. Its slightly painful, because this is an unsolved problem, even in D8. Seehttps://www.drupal.org/node/2605130. One alternative approach is to rely on Aset Packagist per https://dev.acquia.com/blog/round-up-your-frontend-javascript-libraries-.... If we do that, would be ideal if implemented in Drupal Commerce, so the whole ecosystem could benefit.
MW: Not seeing any default HTML for the header/footer in D7. Someone needs to compose it?
MW: Where is the transaction type? Is that
$payment->getState()?MW: I simplified the preprocess function to not do its own rendering - that is done for us by twig. Further, I consolidated to one variable called 'receipt'.
Also, CommercePOSSettingsForm is in the visible menu but doesn't do anything yet. Should we comment it out or remove it? Its a bit confusing as we have two links both named Point of Sale. Perhaps its too early to discuss details like this.
Comment #8
smccabe commented1. There is a phpcs.xml in the repo, if it passes against that we're good
2. correct
3. this will actually go on the payment page eventually, that patch isn't finished though, although I do like adding it to the additional sections you mentioned, can you spin out a new issue for that plz
4. talked with Bojanz, lets go with the lightning way
5. @fergy will writeup and add to this issue
6. yes, the state of the most recent payment
Comment #9
fergy commented5.
Header:
(logo??)
Company Name/Store#
Address line 1
Address line 2
Phone #
Footer:
Thanks for shopping at CompanyName!
Return Policy --
Exchange Policy --
Company Motto
Website --
(optional)
Visit our website for a chance to --
Comment #10
moshe weitzman commented1. phpcs is now passing
3. New issue created https://www.drupal.org/node/2915872 (Add receipt print functionality in 3 places). Not sure if there is anything left to do before the Payment patch lands.
4. I'll do this in https://www.drupal.org/node/2916058.
5. Default configuration (with schema) now exists for header/footer.
We should consider deferring test writing until this functionality is on the payment page.
Comment #11
smccabe commentedpayments page has landed, we should be good to finish off the last of the stuff here.
#2907670: POS Payment Page
Comment #12
moshe weitzman commentedThis one is pretty close.
Comment #13
smccabe commentedStill TODO
Optional
The #attached stuff could probably be abstracted somewhat so as to be more user friendly, but that might be overkill is it will be used in 2 places at most I think.
Comment #14
sorabh.v6@smccabe I tried to apply patch in #13. But patch is not applying and I am getting error -
But I can apply patch in #12successfully.
Comment #15
sorabh.v6Uploading patchfile and interdiff. I tried to apply patch in #13 but it did not applied using
git applyso I applied the patch manually. This patch includes work of TODO in #13, i.e. -Please review.
Comment #16
travis-bradbury commentedThere's some code standards issues.
🐧 phpcs --standard=phpcs.xml src tests modules commerce_pos.module -s FILE: /home/tbradbury/src/drupal/commerce_pos/src/Form/POSForm.php ---------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ---------------------------------------------------------------------- 483 | ERROR | [x] Missing function doc comment | | (Drupal.Commenting.FunctionComment.Missing) ---------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ---------------------------------------------------------------------- FILE: ...home/tbradbury/src/drupal/commerce_pos/modules/receipt/README.md ---------------------------------------------------------------------- FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE ---------------------------------------------------------------------- 19 | WARNING | Line exceeds 80 characters; contains 85 characters | | (Drupal.Files.TxtFileLineLength.TooLong) ---------------------------------------------------------------------- FILE: ...l/commerce_pos/modules/receipt/tests/src/Functional/LoadTest.php ---------------------------------------------------------------------- FOUND 3 ERRORS AFFECTING 3 LINES ---------------------------------------------------------------------- 14 | ERROR | [x] Opening brace should be on the same line as the | | declaration | | (Drupal.Classes.ClassDeclaration.BraceOnNewLine) 34 | ERROR | [x] Opening brace should be on the same line as the | | declaration | | (Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine) 44 | ERROR | [x] Opening brace should be on the same line as the | | declaration | | (Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine) ---------------------------------------------------------------------- PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY ---------------------------------------------------------------------- FILE: .../drupal/commerce_pos/modules/receipt/commerce_pos_receipt.module ---------------------------------------------------------------------- FOUND 3 ERRORS AND 3 WARNINGS AFFECTING 5 LINES ---------------------------------------------------------------------- 35 | WARNING | [x] A comma should follow the last multiline array item. | | Found: 'commerce-pos-receipt' | | (Drupal.Array.Array.CommaLastItem) 42 | WARNING | [ ] Format should be "* Implements hook_foo().", "* | | Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* | | Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", | | "* Implements hook_foo_BAR_ID_bar() for | | xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() | | for block templates." (Drupal.Commenting.HookComment) 44 | ERROR | [x] Data types in @param tags need to be fully | | namespaced | | (Drupal.Commenting.DataTypeNamespace.DataTypeNamespace) 44 | ERROR | [x] Parameter comment must be on the next line | | (Drupal.Commenting.FunctionComment.ParamCommentNewLine) 46 | ERROR | [ ] Description for the @return value is missing | | (Drupal.Commenting.FunctionComment.MissingReturnComment) 77 | WARNING | [x] A comma should follow the last multiline array item. | | Found: ) (Drupal.Array.Array.CommaLastItem) ---------------------------------------------------------------------- PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY ---------------------------------------------------------------------- FILE: ...al/commerce_pos/modules/receipt/src/Ajax/PrintReceiptCommand.php ---------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ---------------------------------------------------------------------- 14 | ERROR | [x] Missing function doc comment | | (Drupal.Commenting.FunctionComment.Missing) ---------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ---------------------------------------------------------------------- FILE: .../commerce_pos/modules/receipt/src/Controller/PrintController.php ---------------------------------------------------------------------- FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES ---------------------------------------------------------------------- 36 | WARNING | [x] A comma should follow the last multiline array item. | | Found: ) (Drupal.Array.Array.CommaLastItem) 37 | WARNING | [x] A comma should follow the last multiline array item. | | Found: ] (Drupal.Array.Array.CommaLastItem) 60 | WARNING | [x] A comma should follow the last multiline array item. | | Found: ) (Drupal.Array.Array.CommaLastItem) ---------------------------------------------------------------------- PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY ---------------------------------------------------------------------- Time: 668ms; Memory: 12MbThe difference between items mentioned as TODO in #13 and fixed in #15 leaves
For receipt CSS, I tested on a 72mm receipt and thought it looked fine.
Comment #17
sorabh.v6Okay, I will remove PHPCS errors.
Comment #18
sorabh.v6Updated patch with removed code standard errors. Only errors left in the code are some @todo code which exceeds 80 chars. Patch and interdiff uploading, please review.
Thanks
Comment #19
smccabe commentedThe TODO's in #13 still need to be done i believe to wrap this up
Comment #20
sorabh.v6@smccabe as per #16 @tbradbury tested the receipt on 72 mm and he says it looked good. Can you tell me what kind of styling is required for it?
Also,
By this, you are indicating about -
or
or both.
Comment #21
subhojit777Comment #22
subhojit777Patch rerolled. Will check now whether all the TODO items have been covered.
Comment #23
subhojit777Patch in #22 not rerolled correctly.
Comment #24
subhojit777Comment #25
subhojit777Comment #26
subhojit777Fixing failing tests.
Comment #27
subhojit777The test is going to fail in DrupalCI. Because DrupalCI does not downloads any external library (from GitHub). I too had this same problem. But that was months ago, I don't know the state of DrupalCI now. We can try invoking a command that would download this library first. Otherwise we have to rely on TravisCI/CircleCI.
This is not good at all.
POSForm::ajaxReceipt()should be moved to the sub-module, as a form alter or something.Comment #28
subhojit777I am first going to take care of #13. Then we can address the problems as mentioned in #27
Comment #29
subhojit777This can be moved to a base test class.
Comment #30
subhojit777TODOs mentioned in #13 are covered in the patch. I made some slight improvements/corrections in the README.
Comment #31
subhojit777Working on #27.2
Comment #32
subhojit777Shawn confirmed that #27.2 is in his machine. He will upload the patch.
Comment #33
subhojit777Comment #35
smccabe commentedI did some work on friday that I ran out of time to post a patch for, rolled it in with @subhojit777 work. It solves 27.2 and gets receipts printing properly on order completion. It still needs review and testing, but I figured I better get it up before we start duplicating work.
I had relatively few merge conflicts, so I think the patches merged together fine, let me know if you see any issues.
Comment #37
smccabe commentedOk, cleaned out a few bits that got left in during the merge, 27.2 is now fixed up properly.
Also got tests running, their were 2 issues.
I don't think there are any direct TODOs left, I am going to create some spin-off issues for some additional work, but I want to get this large patch in since it is working cleanly.
Comment #39
smccabe commentedCommitted, Moshe wins the author credit by virtue of having the most patches. Thanks everyone.