TBroMEM Posted January 6 Share Posted January 6 We have some custom PHP deployed to our environment so we can make requests from an external app. The custom PHP includes various functions that uses localAPI. We would like to add data capsule code to update some additional values in tblinvoiceitems, to get around issue we had encountered in updating duedate (not propagating duedate on tblinvoiceitems). Is it suitable to add the additional data capsule update code just after this but before function termination? This is pseudo code. There is additional code initializing and setting environment variables such as the LocalAPI request public function updateinfo($invoiceId, $dueDate, ...) { { //define data } $data = [ 'invoiceid' => (int) $invoiceId, 'duedate' => date('Y-m-d', strtotime($dueDate)), 'itemdescription' => $itemDescriptions, 'itemamount' => $itemAmounts, 'itemtaxed' => $itemTaxeds ]; $this->api('UpdateInvoice', $data); // can data capsule code suitable be added here to update tblinvoiceitems? } 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted January 8 Share Posted January 8 The UpdateInvoice command allows you to change invoice items as well: https://developers.whmcs.com/api-reference/updateinvoice/ 0 Quote Link to comment Share on other sites More sharing options...
TBroMEM Posted January 8 Author Share Posted January 8 Our existing updateinvoice internal API request updats the duedate and the invoice items (description, etc.) but the duedate is not propagating down to the tblinvoiceitems, which causes duplicate invoice to be generate when the cron runs on the following day. We think there is an issue in the updateinvoice internal api method so splitting out the update of duedate and invoice item description. If this does not prove fruitful we would want to simply update the tblinvoiceitems.duedate directly through capsule just after initial updateinvoice request. I am trying to get ahead of it. 0 Quote Link to comment Share on other sites More sharing options...
TBroMEM Posted Thursday at 09:30 PM Author Share Posted Thursday at 09:30 PM We confirmed that using local API that the using UpdateInvoice to update duedate is NOT propagating down the updated duedate to tblinvoiceitems. It only touches tblinvoice.duedate. Does anyone have any thoughts on whether we can add database capsule code to our custom PHP (which initiates local API function/calls) to the same function called to update the invoice due date and invoice items (description, etc.)? If so, please provide some guidance. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.