tsvetanakos Posted April 18, 2015 Share Posted April 18, 2015 Hello! I'm trying to create a hook which is supposed to run when an invoice is overdue and update some data on our servers, but so far I'm unable to get the service of the invoice. I mean the invoice details are not containing the service that is tied with the invoice. Here is what I have inside of my hook: $command = "logactivity"; $adminuser = "admin"; $invoiceId = print_r($vars[invoiceid], true); $command1 = "getinvoice"; $values1["invoiceid"] = $invoiceId; $results1 = localAPI($command1,$values1,$adminuser); // The client's ID - I need it in order to get the email. So far, so good. $clientId = print_r($results1[userid], true); $command2 = "getclientsdetails"; $values["clientid"] = $clientId; $values["stats"] = true; $values["responsetype"] = "xml"; $results2 = localAPI($command2,$values,$adminuser); // The client's email - excellent! $userEmail = print_r($results2[client][email], true); $values["description"] = "proof wr_hook_InvoiceChange was called userId: ".$clientId." invoiceId: ".$invoiceId." email: ".$userEmail; // Log the values - cool! $results = localAPI($command,$values,$adminuser); As you can see in the code above I'm getting the user email - because I need it in order to update some info on our servers, but how am I supposed to get the service that provoked the invoice?! There should be a way to know which service is overdue, right? So far the documentation is not helping me. Can you give me a push? I know that I'm missing a really small point here, but I'm not able to spot it. Thanks in advance for any help! 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted April 18, 2015 Share Posted April 18, 2015 SELECT relid FROM tblinvoiceitems WHERE invoiceid = '12' 0 Quote Link to comment Share on other sites More sharing options...
tsvetanakos Posted April 18, 2015 Author Share Posted April 18, 2015 (edited) SELECT relid FROM tblinvoiceitems WHERE invoiceid = '12' Thanks it worked! Edited April 19, 2015 by tsvetanakos 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.