Closed (fixed)
Project:
Drupal Commerce Quickbooks Webconnect
Version:
8.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
25 Jan 2018 at 23:54 UTC
Updated:
30 Mar 2018 at 17:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
trigdog commentedComment #3
heddnThanks for all your hard work here. Just a few questions.
Is 64 chars the limit in QB?
Can we not take the name/label from the adjustment to use for the description in QB? Why do we need to have a single discount for all line items? Please teach me what I don't know about quickbooks. Which I don't know that much :)
Comment #4
heddnAnd I'd like to see some tests added for adjustments. We have them already for shipping. So adding adjustments shouldn't be that hard. Settings to NW for that reason.
Comment #5
trigdog commentedUpdated patch.
Comment #7
trigdog commentedHmm, those strings that failed are the same.
Comment #9
trigdog commentedComment #11
trigdog commentedNot sure, where this is failing...doesn't fail locally.
Comment #12
trigdog commentedLets try this again.
Comment #13
heddnNo need for this empty check. Either we bite the bullet and write a hook_update, or we just assume that the get will always return a value. With the number of adopters of the module (few) I'd suggest we forego a hook update. Since we are still in alpha, that is acceptable. Folks will just need to reinstall.
We need to load the currency repository and see what fractal numbers are available for use. Not all currencies has 2 decimal points. See #2928178: Prices are not migrated correctly (deletes two digits)
Comment #14
trigdog commentedThanks for the review. Been tied up but here is an updated patch. Sorry, I never noticed comment #3.
#3-1.
No, I think item names are actually limited to 31 characters but I was actually think about writing a patch that split parent ref and item ref from a string if that is enabled in the admin config so lets just remove this restiction for now.
#3-2.
We don't but it would be hard to map discounts to different discount items in QB on the fly. I had this required that way because if this is empty or doesn't match a current item in Quickbooks the import will fail. Maybe better to set the field as required? This would also be necessary for shipping as well. If the name for the shipping doesn't match an item in Quickbooks the import will fail.
#13-1. - Answered in #3-2
#13-2. Update in patch. Let me know if you would like me to do it differently.
Comment #16
trigdog commentedFixed coding standards problems.
Comment #17
heddnHere's an interdiff.
Comment #18
heddnI don't think we can mark this required. If it isn't provided, it will simply be empty string.
There's Drupal\commerce_price\Calculator and NumberFormatterFactory that can do all this for you. For the number formatter, I think
$formatter->format()is what you want to use.Comment #19
heddnComment #20
trigdog commentedThe only problem is, if left as an empty string, and the XML has an empty value for
<ItemRef><fullName></fullName></ItemRef>the order will fail export with:If I do not set
<ItemRef><fullName></fullName></ItemRef>if the string is empty so it is not included at all, then I get:The same goes for shipping name.
Great, I didn't know that. I will take a look and update patch.
Comment #21
trigdog commentedSo I tried to do this directly in QuickBooks (leave a line item name empty) and it will not let you save the invoice with the same error. Line item names have to match an existing item in QuickBooks. See screenshot.
Comment #22
trigdog commentedLets just make this simpler and use the adjustedUnitPrice for order items. Removed #required for now and we can discuss that in a different issue.
Comment #23
heddnI'm actually OK with marking something required if it is required. But it sounds like it is only optionally required, if discounts are provided. It looks like the states API let's us do that. See https://api.drupal.org/api/drupal/core!includes!common.inc/function/drup....
But let's do things iteratively.
Shall we set the limit to 31 per #3 and #14?
If we want to open up the follow-up for the required thing and put an TODO with the issue link, then I'm ok. But for the char limit, maybe we should address that here. Or open it up and do the same thing and add a TODO.
Comment #24
heddnComment #25
heddnI'm reversing direction here. We can fix more things later on. Let's get this merged.
Comment #27
heddnComment #28
trigdog commentedSorry for the delay on this. I can work on this issue this afternoon.
The 31 char limit is for the full name of the item but the actual Quickbooks identifier uses the full name + the parent name (like you did on the product and product variation export). So if someone had a discount item they wanted to link that was under a parent (Discount Items:General Discount) they could go over the 31 character limit. Parent names do not have a limit.
In the case above we would have to handle splitting the parent name from the item name but that would be easy enough. Again this applies to the shipping name also.
I will open a new issue on this.