ezyweb Posted October 31, 2022 Share Posted October 31, 2022 Hi everyone, We've just upgraded to the latest version of WHMCS and that's presented a couple of issues with some of our custom modules. After the module in question queries the server for reporting and billing data, we then ask it to add "Next Invoice" billable items with that data. However, we're now getting the following error, and I wondered if someone might be able to point in the right direction to quickly fix this issue. ... Invalid Unit, please specify either ‘hours’ or ‘quantity’ I can see that our module has been using "period", but if we change all of those to, eg, "hours", the module errors again saying that we're calling an incorrect database table. Could someone point in the right direction to get this fixed? Kerry 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted November 3, 2022 Share Posted November 3, 2022 I presume you are using the addbillingitem api call and that you are using hours. If so, the variables should be: $postData = array( 'clientid' => 1, 'description' => "Coffee", 'amount' => 500, 'invoiceaction' => "nextinvoice", 'quantity'=>1, 'unit'=>'hours' ); If you're not using hours, then just get rid of "unit" completely so the variables look like: $postData = array( 'clientid' => 1, 'description' => "pizza", 'amount' => 100, 'invoiceaction' => "nextinvoice", 'quantity'=>5, ); 0 Quote Link to comment Share on other sites More sharing options...
ezyweb Posted November 4, 2022 Author Share Posted November 4, 2022 That's excellent, Steven. Thank you. We found it was necessary to add a column to the table dealing with this data for our module, but that was an easy fix once we understood where to place the additional variable. However, because that variable is now considered "required" by the addbillingitem API, leaving it out altogether would have left our code the way it was .. broken. Adding it fixed the issue straight away. Thanks so much for your help. 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.