Jump to content

tiagocaus

Retired Forum Member
  • Posts

    29
  • Joined

  • Last visited

Everything posted by tiagocaus

  1. @Brian Hi Brian, how can I generate the Token when the email is sent to the customer? &token={$token}
  2. I need to mount a customer report by state, can you help me? <?php use WHMCS\Database\Capsule; use WHMCS\Utility\State; if (!defined("WHMCS")) { die("This file cannot be accessed directly"); } $reportdata["title"] = "Clients by States"; $reportdata["description"] = "This report shows the total number of active services per state, as well as total active unique clients per state in the table below."; $reportdata["tableheadings"] = array("State","Active Services","Active Clients"); $states = new State(); $states = $states->getStateNameArray(); $clientstats = array(); $results = Capsule::table('tblclients') ->select(Capsule::raw('state, count(*) as `count`')) ->where('Status', '=', 'Active') ->groupBy('state') ->orderBy('state', 'asc') ->get() ->all(); foreach ($results as $result) { $clientstats[$result->state] = $result->count; } $results = Capsule::table('tblhosting') ->select(Capsule::raw('tblclients.state, count(*) as `count`')) ->join('tblclients', 'tblclients.id', '=', 'tblhosting.userid') ->where('domainstatus', '=', 'Active') ->groupBy('state') ->orderBy('state', 'asc') ->get() ->all(); foreach ($results as $result) { $statename = $states[$result->state]; if ($statename) { $reportdata["tablevalues"][] = [ $statename, $result->count, $clientstats[$result->state], ]; $chartdata['rows'][] = [ 'c' => [ ['v' => $result->state], ['v' => $result->count], ['v' => $clientstats[$result->state]], ] ]; unset($clientstats[$result->state]); } } foreach ($clientstats AS $state=>$activeclient) { $statename = $states[$state]; if ($statename) { $reportdata["tablevalues"][] = array($statename,'0',$activeclient); $chartdata['rows'][] = array('c'=>array(array('v'=>$state),array('v'=>0),array('v'=>$activeclient))); } } $chartdata['cols'][] = array('label'=>'State','type'=>'string'); $chartdata['cols'][] = array('label'=>'Active Services','type'=>'number'); $args = array(); $args['legendpos'] = 'right'; $reportdata["headertext"] = $chart->drawChart('Geo',$chartdata,$args,'600px');
  3. I am creating a new report. I need to get the value of a custom field. How do I get the value of the custom field to appear in the report? $reportdata["tableheadings"] = array("Chave", "Client Name", "Telefone", "Product Name", "Service ID"); $result = select_query("tblhosting", "tblhosting.*, tblclients.firstname, tblclients.lastname, tblproducts.name, tblclients.phonenumber", array( "tblproducts.name"=>$tblproductsName, "tblclients.country"=>"BR", "domainstatus"=>$status, //Active, Pending, Terminated, Cancelled, Fraud ), "id","ASC","","tblclients ON tblclients.id=tblhosting.userid INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid" ); while ($data = mysql_fetch_array($result)) { $serviceid = $data["id"]; $userid = $data["userid"]; $phonenumber = $data["phonenumber"]; $clientname = $data["firstname"]." ".$data["lastname"]; $productname = $data["name"]; $phonenumber = str_replace(array(" ", "(", ")", "-"), "", $phonenumber); $reportdata["tablevalues"][] = array( "", <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Chave $clientname, $phonenumber, $productname, '<a href="clientshosting.php?userid=' . $userid . '&id=' . $serviceid . '">' . $serviceid . '</a>' ); }
  4. @brian! There is only one custom field with the name Chave.
  5. @steven99 When using the given code, this error appears:
  6. @brian! Yes, it is a customized field on the product screen. See image below. I wrote here in English, but the name of the field is in Portuguese. After I get the value of the "Chave", I will make a select in the external database to get some data related to the client and put it in the clientssummarybox.
  7. @steven99 How do I check using your option 2?
  8. When capturing the value of the key, I will make a select in the external database, to obtain some values, and thus show this data on the screen in a `clientssummarybox`.
  9. @steven99 I don't know how to capture it, I just want to be able to print the value of the custom field on the clientssummary screen, then I can handle that value the way I need to do it. But at the moment, I just need to be able to capture the value within the clientssummary. How to do this?
  10. @steven99 How do I capture the value of the custom field (Key) into the file clientssummary.tpl I tried that way, but it doesn't appear: {php} echo $params['customfields']["Chave"]; {/php} Thank you.
  11. I created a custom field called KEY. It appears on the PRODUCTS / SERVICES screen. I need to get theVALUE from the KEY field, inside the clientssumary.tpl file. I tried it this way: {php} echo $params['customfields']["KEY"]; {/php} But it doesn't capture the value. How to do this? Thank you.
  12. I need to create a custom field for two services. This field will only be seen by Admin. How do I make this CHAVE field generate an md5 code automatically?
  13. I would like to perform an action, only for a selected product. At the time the order is placed by the site or the admin, justify the selected product and take action. add_hook('PreModuleCreate', 1, function($vars) { $return = []; if ($vars['packageid'] == 119 OR $vars['packageid'] == 94) { // // Code // } return $return; } ); Admin Order: Admin > Client Profile > Products/Services Order by site
  14. Hi Stvens, The code above generated the following variables: https://aaa.bbbb.com.br/whmcs/criar.php? key=1FB6F6C9F7D0FE2F7998FCF07EA1BE06 &action=adicionar &nomeCompleto=Contade+Teste &email=sac.teste@teste.net &usuario=1 &senha=1z%232Sl%3B0mMkV8R &Chave=d41d8cd98f00b204e9800998ecf8427e &matrizFiliais=99999 &veiculos=99999 &funcionarios=99999 But it was not registered in the USERNAME and CHAVE fields. This data needs to be recorded in the inputs. For the intention is that when the order is made by the site already have this data recorded, because as soon as the payment is approved whmcs create the account already with the input data.
  15. To help me in development, I found the CentosWebPanel system modules. Link https://wiki.centos-webpanel.com/whmcs-module-for-cwp-api In their module, they create using the GET method, send the variables by URL. I was just stuck with these two fields, USERNAME and the CHAVE custom field. See this is the code: <?php function carros7_ConfigOptions() { $configarray = array( "matrizFiliais" => array( "FriendlyName" => "Matris/Filiais", "Type" => "text", "Default" => "1"), "veiculos" => array( "FriendlyName" => "Veículos", "Type" => "text" , "Default" => "3",), "funcionarios" => array( "FriendlyName" => "Funcionários", "Type" => "text", "Default" => "Ilimitado", ), ); return $configarray; } function carros7_CreateAccount($params) { if ($params["server"] == 1) { $postvars = array( 'key' => $params["serveraccesshash"], 'action' => 'adicionar', 'nomeCompleto' => $params["fullname"], // Get full name {Still does not work} 'email' => $params["clientsdetails"]["email"], 'usuario' => $params["username"], //{Still does not work} 'senha' => $params["password"], 'Chave' => $params["chave"], // Key Custom Field {Still does not work} 'matrizFiliais' => $params["configoption1"], 'veiculos' => $params["configoption2"], 'funcionarios' => $params["configoption3"] ); $postdata = http_build_query($postvars); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'https://' . $params["serverhostname"] . 'whmcs/criar.php'); curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata); $answer = curl_exec($curl); logModuleCall('carroswhmcs','CreateAccount_UserAccount','https://' . $params["serverhostname"] . 'whmcs/criar.php?'.$postdata,$answer); } if(strpos($answer,"OK")!==false){$result='success';}else{$result=json_decode($answer,true); $result=$result['msj'];} return $result; } THAT'S THE GENERATED LINK https://www.aaaa.com/whmcs/criar.php? key=1FB6FAC9F7D0FE2G7998FCF07EA1HE06 &action=adicionar &nomeCompleto= &email=sac.teste@teste.net &usuario= &senha=1z%232Sl%3B0mMkV8R &Chave= &matrizFiliais=1 &veiculos=3 &funcionarios=10 How should I modify this file to work? Thank you.
  16. Hi Steven, I'm still lost, this is the first time I have made a module for WHMCS. Inside my folder whmcs > module > servers I created my folder called /carros7. Inside the folder /carros7/ I have these files: carros7.php and hooks.php Do I put the code you sent me into the hooks.php file? Thank you.
  17. I have a car rental system. I am creating a module to control sales through WHMCS. I need two of your help. 1º) How to make the field USERNAME receive the first name of the register? 2º) In the custom field, called CHAVE , how do I automatically generate an MD5 number? Thank you.
  18. Good afternoon. I have a car rental system. I am creating a module to control sales through WHMCS. I need two of your help. 1º) How to make the field USERNAME receive the first name of the register? 2º) In the custom field, called CHAVE , how do I automatically generate an MD5 number? Thank you.
  19. Can you help me create the hooks to hide this part of the menu? Portal Home / Client Area / My Products & Services / Product Details This part of the menu should only be hidden if the product is = "Plano Site para Igreja" I'm not sure how to create it, I've never done it before.
  20. Good night. Like a mask on the field phone to create a partão because customers diditam with spaces, characters, etc ... I'm using: <script src="includes/jscript/jquery-1.5.2.min.js" type="text/javascript"></script> <script src="includes/jscript/jquery.maskedinput-1.3.min.js" type="text/javascript"></script> {literal} <script type="text/javascript"> jQuery(function($){ $("#phonenumber").mask("(099)9999-9999?9"); }); </script> {/literal} But when I put does not record when you click register, go to the login screen: What to do?
  21. How do I create a new file register.php? I want to create this new file with only the field NAME and EMAIL. It is for people who want to register and receive news of our system. When we send the current page of the record people do not make the order. You can send this modified file to me or tell how to do? Thank you.
  22. How to install this add? Where I see the manual to install?
  23. {$customfields} Array (1) Painel => N
  24. I did not friend, is the first time I do it, give me more guidance?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated