Bidi Posted August 25, 2015 Share Posted August 25, 2015 Hy there cand someone help me why is this one not working ? from admin area if i use Create Add Funds Invoice it works but it ads the amount to the customer directly <?php function hook_smsinvoicecreated($vars) { $invoiceid = $vars['invoiceid']; include("../rwsfunctions.php"); include("../rwsconfig.php"); $rid = full_query("SELECT userid,duedate,total FROM tblinvoices WHERE id='".$invoiceid."'"); $did = mysql_fetch_array($rid); $clientid = $did['userid']; $rcr = full_query("SELECT credit,smsphone,smsinvoicecreated FROM tblclients WHERE id = '".$clientid."'"); $dcr = mysql_fetch_array($rcr); if ($dcr['smsinvoicecreated'] == "1" && "0.05" <= $dcr['credit']) { $phone = $dcr['smsphone']; $dd = $did['duedate']; $d = explode("-", $dd); $duedate = $d['2']." ".$d['1']." ".$d['0']; $total = $did['total']; $message = "Va informam ca a fost emisa in contul dvs o noua factura cu nr: ".$invoiceid.", total ".$total." Euro, data scadenta ".$duedate.". ".$brand; if (strlen($phone) == "10") { $command = "addcredit"; $adminuser = $adminuser; $values['clientid'] = $clientid; $values['description'] = "Trimitere SMS catre ".$phone; $values['amount'] = 0 - $amountinvoicecreated; $results = localAPI($command,$values,$adminuser); if ($results['result'] == "success") { sendsms($sid, $password, $phone, $message); } else { $res = $results['message']; } } else { $res = "Telefon Invalid"; } } } add_hook("InvoiceCreated", 2, "hook_smsinvoicecreated"); ?> 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.