Open dextermb opened 5 years ago
Looking at the request for the line item with tracking, it seems like rather than just sending the name and option name as stated by the API documentation, it actually sends up the whole objects which probably get ignored.
@calcinai
@calcinai @timacdonald Any ideas on how to resolve this issue?
@dextermb Tracking seems to be a perpetual issue as it behaves differently at different endpoints. Have you tried altering the LineItem class yo make it submit only the string?
@dextermb Tracking seems to be a perpetual issue as it behaves differently at different endpoints. Have you tried altering the LineItem class yo make it submit only the string?
I have not, but unrelated to invoices I have had to edit the endpoint (on my fork) from TrackingOptions
to Options
and with new functionality in my fork I removed the root node so that it will update/save as JSON.
A solution for the invoicing issue is to create a local tracking category and only give it the data it needs:
$tracking = new TrackingCategory($xero);
$tracking->setName($category->getName());
$tracking->setOption($option->getName());
$lineItem->addTracking($tracking);
This seems to work but obviously isn't ideal.
Edit: It seems that updating of tracking category options still doesn't seem to work properly
I am attempting to set the tracking option on a line item for an invoice. Here's what I've currently got:
As you cannot directly load tracking options, I loop through a given tracking category and match an option. Once an option is matched then I set it as the option and set the option name based on the option.
This then gets piped into the Line Item:
Here's what the tracking looks like when creating a line item. When I go to the invoice page and look at the line item that has just had the tracking set the category is empty without the option I set selected.
Is there a solution for this?