xero-php icon indicating copy to clipboard operation
xero-php copied to clipboard

Error when adding `PurchaseDetails`

Open DrRoach opened this issue 7 years ago • 2 comments

When using the addPurchaseDetail method in Item.php the purchase detail is added as a new array element. This causes an issue in the arrayToXML method in the Helpers.php file.

When a sequential array is passed to this method, it singularizes the key and then adds it to the XML resulting in the following XML output:

<PurchaseDetails>
  <PurchaseDetail>
    <COGSAccountCode>300</COGSAccountCode>
  </PurchaseDetail>
</PurchaseDetails>

Which is incorrectly formatted. I made a small fix for this by removing the new array element creation in addPurchaseDetail but wanted to know if that's required for any other methods before making a merge request.

DrRoach avatar Sep 12 '17 09:09 DrRoach

Hmm, I'm not sure if it's required elsewhere. Open the fix for this for the time being.

calcinai avatar Sep 13 '17 04:09 calcinai

See #308

DrRoach avatar Sep 13 '17 13:09 DrRoach