Jump to content


Senior Member
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About sokalsondha

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. hello thanks for reading my text. i have whmcs latest version and what is the issue is i can see the cron not generating the monthly invoice. i have a customer who have an active product due at 08/08/2020 but i cant understand why the cron is not generating the invoice when its suppose to be generate 14 days earlier. but if i click on the customer dashboard generate due invoice i can see system create the invoice for that client. so can someone guide me what can be issue?? i can see in the logs but i can't find any issue at all 😞 dont know what to do just to let you know i have customized pdf invoice . is that giving any issue? thanks a million in advance. please stay safe
  2. Hello Everyone. hope all are fine. can someone help me to modify this code a little so i can achieved what i am looking for. basically i have hook file for a client custom field. what the hook does is when i create a new customer its create a random 8 digit number for the custom field Account Number. its fine until now but the problem is 1. This hook doesn't check the existing value in the database , so there is chance to create the duplicate account number and we cant allocate same account for two customer. 2. once the Account created and we have the account number then any admin or staff can modify the client details form and easily change the account number. and this is another dangerous point. we cant change the account number for any customer. once we create the customer we will have permanent account number for that customer. so what can i do in this case with this hook? i have given the code in here. thanks again in advance <?php use Carbon\Carbon; if (!defined("WHMCS")) die("This file cannot be accessed directly"); function AccountNumber($vars) { $userid = $vars['userid']; $command = 'UpdateClient'; $values = array( 'clientid' => $userid, 'customfields' => base64_encode(serialize(['Account Number'=>rand(11111111,99999999)])) ); $results = localAPI($command, $values); if ($results['result'] == 'success') { logActivity('Success : Customer ID set successfully to User # '.$userid); } else { logActivity('Error : Customer ID could not be set to User # '.$userid.'. Response : '.$results['result']); } } add_hook("ClientAdd",1,"AccountNumber");
  3. hello old post freshen up again. did someone found the way to work with this? i am having same issue with my .com.bd domain so may be someone have idea what to do? thanks
  4. Hello everyone Can you help me something on this please. In my invoice list I have changed the button name from Unpaid to Make-Payment. Because what I want is when my customer click on this make payment button it will be take them direct to payment page instead of viewinvoice page.. Because I have put a button to download the pdf invoice so my customer can download the pdf invoice if they want to see it. But I really need to skip the viewinvoice page. So if I have PayPal as a payment method for that invoice then when client click on that Make-Payment button it will be take them to PayPal directly. Can someone help me with the code in the template file. Thanks a million in advance Please see the current invoice list page
  5. yes brian you are very right as always.. from the database pulling will be the best idea. i will try to work it out thanks again for the kind help
  6. thanks brian for reply.. yes its good point. but i will be have only one product in the invoice. one customer = one product only can it possible to do?
  7. Hello everyone. i hope everyone is doing great. i need again some help from the community. hope someone correct my invoicepdf tpl file so it can complete my demand. i have done some modify but i can't understand how to fix some more. i want to make my invoice like this and this is my current code. its already modified mostly <?php # Logo $logoFilename = 'placeholder.png'; if (file_exists(ROOTDIR . '/assets/img/logo.png')) { $logoFilename = 'logo.png'; } elseif (file_exists(ROOTDIR . '/assets/img/logo.jpg')) { $logoFilename = 'logo.jpg'; } $pdf->Ln(5); $pdf->SetFont($pdfFont, 'B', 15); $pdf->SetFillColor(255); $pdf->SetFont($pdfFont, '', 16); $pdf->Cell(100, 6, "My Bill Summary", 0, 1, 'L', '1'); $pdf->Image(ROOTDIR . '/assets/img/' . $logoFilename, 120, 25, 75); # Company Details $pdf->SetXY(15, 70); $pdf->SetFont($pdfFont, '', 13); foreach ($companyaddress as $addressLine) { $pdf->Cell(180, 4, trim($addressLine), 0, 1, 'R'); $pdf->SetFont($pdfFont, '', 9); } if ($taxCode) { $pdf->Cell(180, 4, $taxIdLabel . ': ' . trim($taxCode), 0, 1, 'R'); } $pdf->Ln(5); # Clients Details $pdf->SetXY(15, 70); $pdf->SetFont($pdfFont, 'B', 10); $pdf->SetFont($pdfFont, '', 9); if ($clientsdetails["companyname"]) { $pdf->Cell(0, 4, $clientsdetails["companyname"], 0, 1, 'L'); $pdf->Cell(0, 4, Lang::trans('invoicesattn') . ': ' . $clientsdetails["firstname"] . ' ' . $clientsdetails["lastname"], 0, 1, 'L'); } else { $pdf->Cell(0, 4, $clientsdetails["firstname"] . " " . $clientsdetails["lastname"], 0, 1, 'L'); } $pdf->Cell(0, 4, $clientsdetails["address1"], 0, 1, 'L'); if ($clientsdetails["address2"]) { $pdf->Cell(0, 4, $clientsdetails["address2"], 0, 1, 'L'); } $pdf->Cell(0, 4, $clientsdetails["city"] . ", " . $clientsdetails["postcode"], 0, 1, 'L'); $pdf->Cell(0, 4, $clientsdetails["country"], 0, 1, 'L'); if (array_key_exists('tax_id', $clientsdetails) && $clientsdetails['tax_id']) { $pdf->Cell(0, 4, $taxIdLabel . ': ' . $clientsdetails['tax_id'], 0, 1, 'L'); } $pdf->Ln(10); $pdf->Ln(10); $pdf->Ln(10); # Header Bar /** * Invoice header * * You can optionally define a header/footer in a way that is repeated across page breaks. * For more information, see http://docs.whmcs.com/PDF_Invoice#Header.2FFooter */ $pdf->SetFont($pdfFont, 'B', 15); $pdf->SetFillColor(239); $pdf->SetFont($pdfFont, '', 12); if ($customfields) { foreach ($customfields as $customfield) { $pdf->Cell(125, 6, $customfield['fieldname'] . ': ' . $customfield['value'], 0, 1, 'L', '1'); } } $pdf->Cell(125, 6, "Invoice Number " . ': ' . $invoiceid, 0, 1, 'L', '1'); $pdf->Cell(125, 6, "Bill Issue Date" . ': ' . $datecreated, 0, 1, 'L', '1'); $pdf->Cell(125, 6, "Billing Period" . ': ' . $datecreated, 0, 1, 'L', '1'); $pdf->Ln(10); $startpage = $pdf->GetPage(); # Invoice Items $tblhtml = '<table width="70%" bgcolor="#ccc" cellspacing="1" cellpadding="2" border="0"> <tr height="30" bgcolor="#efefef" style="font-weight:bold;text-align:center;"> <td width="80%">' . Lang::trans('invoicesdescription') . '</td> <td width="20%">' . Lang::trans('quotelinetotal') . '</td> </tr>'; foreach ($invoiceitems as $item) { $tblhtml .= ' <tr bgcolor="#fff"> <td align="left">' . nl2br($item['description']) . '<br /></td> <td align="center">' . $item['amount'] . '</td> </tr>'; } $tblhtml .= ' <tr height="30" bgcolor="#efefef" style="font-weight:bold;"> <td align="right">' . Lang::trans('invoicessubtotal') . '</td> <td align="center">' . $subtotal . '</td> </tr>'; if ($taxname) { $tblhtml .= ' <tr height="30" bgcolor="#efefef" style="font-weight:bold;"> <td align="right">' . $taxrate . '% ' . $taxname . '</td> <td align="center">' . $tax . '</td> </tr>'; } if ($taxname2) { $tblhtml .= ' <tr height="30" bgcolor="#efefef" style="font-weight:bold;"> <td align="right">' . $taxrate2 . '% ' . $taxname2 . '</td> <td align="center">' . $tax2 . '</td> </tr>'; } $tblhtml .= ' <tr height="30" bgcolor="#efefef" style="font-weight:bold;"> <td align="right">' . Lang::trans('invoicescredit') . '</td> <td align="center">' . $credit . '</td> </tr> <tr height="30" bgcolor="#efefef" style="font-weight:bold;font-size:14px;"> <td align="right">' . "Total Amount Due" . '</td> <td align="center">' . $total . '</td> </tr> </table>'; $pdf->writeHTML($tblhtml, true, false, false, false, ''); $pdf->Ln(5); if ($status == 'Unpaid'){ $html = "<h2 style=\"color:red;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please pay by ${duedate} </h2>"; $pdf->writeHTML($html, true, false, false, false, ''); $pdf->Ln(10); $pdf->SetFont($pdfFont, 'B', 15); $pdf->SetFillColor(239); $pdf->SetFont($pdfFont, '', 10); $pdf->Cell(125, 6, "Failure to pay your account in full may result in loss of service.", 0, 1, 'L', '1'); $pdf->Cell(125, 6, "Reactivation of your service could take up to 7 days and will incur a fee. ", 0, 1, 'L', '1'); $pdf->Ln(10); } # Notes if ($notes) { $pdf->Ln(5); $pdf->SetFont($pdfFont, '', 8); $pdf->MultiCell(170, 5, Lang::trans('invoicesnotes') . ': ' . $notes); } /** * Invoice footer */ ============================ can someone please correct the code so my pdf invoice will be looks same like the image i provide thanks everyone and plesae stay safe
  8. hello brian your this line helped me again. but i applied this and works perfect. but my project is little different so i want the client can not take the tick out. by replace with your code i can see the TICK is coming automatically but is there any way can make this addon permanent with tick? basically i am settingup the product with SETUP FEES : ONE TIME MONTHLY FEES : RECURRING DEPOSIT : I WILL TAKE SOME AMOUNT AS DEPOSIT AND IT WILL BE REFUNDABLE ( Thats why i want to use the Addon as a deposit) Is there any way to do it? the configurable option works perfect. but there is no one time option for configurable . as all is monthly. thanks very much in advance Brian Please keep safe
  9. thanks but hook can check in database for existing number... so thats how its became unique
  10. Dear Members hope all are still safe. Can some one help me make a hook which will generate a 8 digit random number for the custom client field. so what will be happen when customer register in our website the hook will add automatically a 8 digit number in the custom client field. the field name will be Account Number. the number will be unique in the database for each client. hope i able to explain the thing Kind Regards Mahim
  11. Dear Brian.. I dont know how to say thank you.. its works like a dream. you are right we dont sell domains as this whmcs set up for ISP only broadband so and we will not allow customer will place an order from website. as all will be manual order from admin side can you please help me to remove this action button from the left side as client can see and click add new product which we dont want this.. hopefully you will able to help me this thing as well and brian i just post this thing. will you able to reply me on this. please sir Kind Regards Mahim
  12. hello brian thanks you for this code i put this and its work for me to but i want to remove some of other buttons from the menu too and i already remove those buttons <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) { if (!is_null($secondaryNavbar->getChild('Account'))) { $secondaryNavbar->getChild('Account') ->removeChild('Edit Account Details') ->removeChild('Security Settings') ->removeChild('Contacts/Sub-Accounts'); } }); so using the same hook file can you please help me to remove some more button Services -->>> Order New Services & View Available Addons Billing --->>>>> My Quotes d i would like to use only one hook file for the whole client area if its possible or i need to modify the template file? hope i am able to explain you... Thanks again brian for all the time help
  13. dear community member.. hope all doing very well. i am trying to make a module for my VoIP project . one of my friend helping me out in this module. but i dont know what he done something is he can't figure out how to fix. basically its for VoIP project. so we will sell voip service with local city number. so when the ordering time we will select the city and then based on the city name the available numbers will be display.. so for the list of city the api link is https://mydomainname.com/api/city_list.php?&token=123456 this api link display all the city name from remote database so thats i want it to show in one custom field and for the second custom field based on the city name i have another api link which is https://mydomainname.com/api/did_free.php?city=Dublin&token=123456 which shows result this way its only shows the number is dublin city from the remote database. my friend make the module for me. but the way i want its show very right in the customer order form . i mean if customer directly buy from the client area its shows perfect according to city name so when i select the city then i see available numbers based on the city which the way i wanted to see from the client area. so from the client area its works properly no problem. problem with from the admin area when i wanted to setup a product to client from admin in the admin panel i see like this which means its doesn't matter which city i select. but i see all numbers from my remote database. like 35391 is Galway numbers 35314 is Dublin Numbers and 35321 is Cork numbers. they are all showing together. which is very frustrating . here is my hook file code. can some please please tell me where he did wrong? HOOK FILE CODE ======================================== <?php use PDO; use Exception; use PDOException; use WHMCS\Database\Capsule; $host = 'https://mydomainname.com/api/'; $token = '123456'; $ch = curl_init(); $fields = array( 'token' => $token ); curl_setopt($ch, CURLOPT_URL, $host.'city_list.php?'.http_build_query($fields)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $city = curl_exec($ch); curl_close($ch); $packageNames = json_decode($city, true); $citylist = array(); $numberslist = array(); foreach ($packageNames['result'] as $packageName) { $citylist[$packageName['city']] = ucfirst($packageName['city']); $ch = curl_init(); $fields = array( 'city' => $packageName['city'], 'token' => $token ); curl_setopt($ch, CURLOPT_URL, $host.'did_free.php?'.http_build_query($fields)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $numbers = curl_exec($ch); $numbers = json_decode($numbers); $numberslist = array_merge($numbers->result,$numberslist); curl_close($ch); } $citylist = implode($citylist,','); $numberslist = implode($numberslist,','); //echo json_encode(array('cities'=>explode(",",$citylist),'numbers'=>explode(",",$numberslist))); $pdo = Capsule::connection()->getPdo(); try { $result = $pdo->query( "update tblcustomfields set fieldoptions = '".$citylist."' where fieldname = 'City'" ); } catch (\Exception $e) { echo "Uh oh! {$e->getMessage()}"; return $e->getMessage(); } try { $result = $pdo->query( "update tblcustomfields set fieldoptions = '".$numberslist."' where fieldname = 'Available Phone Numbers'" ); } catch (\Exception $e) { echo "Uh oh! {$e->getMessage()}"; return $e->getMessage(); } add_hook('OverrideModuleUsernameGeneration', 1, function($vars) { return $vars['customfields']['Available Phone Numbers']; }); ============================================================= please someone help me to correct the code. please
  14. hello my friends. how are you? i am having one major issue with my custom made payment gateway using sumup api. payment works fine. its marking the invoice paid too which works smoothly. but only the problem is after make successfull payment its not redirect to invoice page.. here is my callback file <?php session_start(); /* Gateway Module Name: Nexxus Payment Group Callback Description: Nexxus payment gateway module for WHMCS Version: 1.0 Author: Asif Iqbal Author URI: https://www.webwizo.com */ // Require libraries needed for gateway module functions. require_once __DIR__ . '/../../../init.php'; require_once __DIR__ . '/../../../includes/gatewayfunctions.php'; require_once __DIR__ . '/../../../includes/invoicefunctions.php'; // Detect module name from filename. $gatewayModuleName = basename(__FILE__, '.php'); // Fetch gateway configuration parameters. $gatewayParams = getGatewayVariables($gatewayModuleName); // Die if module is not active. if (!$gatewayParams['type']) { die("Module Not Activated"); } // Retrieve data returned in payment gateway callback // Varies per payment gateway $status = $_GET["status"]; $invoiceId = $_GET["invoice_id"]; $transactionId = $_GET["transactionId"]; $paymentAmount = $_GET["amount"]; $paymentFee = $_POST["x_fee"]; $transactionStatus = ucwords($status); /** * Validate Callback Invoice ID. * * Checks invoice ID is a valid invoice number. Note it will count an * invoice in any status as valid. * * Performs a die upon encountering an invalid Invoice ID. * * Returns a normalised invoice ID. */ $invoiceId = checkCbInvoiceID($invoiceId, $gatewayParams['name']); /** * Check Callback Transaction ID. * * Performs a check for any existing transactions with the same given * transaction number. * * Performs a die upon encountering a duplicate. */ checkCbTransID($transactionId); /** * Log Transaction. * * Add an entry to the Gateway Log for debugging purposes. * * The debug data can be a string or an array. In the case of an * array it will be * * @param string $gatewayName Display label * @param string|array $debugData Data to log * @param string $transactionStatus Status */ logTransaction($gatewayParams['name'], $_GET, $transactionStatus); if ($status == 'SUCCESSFULL') { /** * Add Invoice Payment. * * Applies a payment transaction entry to the given invoice ID. * * @param int $invoiceId Invoice ID * @param string $transactionId Transaction ID * @param float $paymentAmount Amount paid (defaults to full balance) * @param float $paymentFee Payment fee (optional) * @param string $gatewayModule Gateway module name */ addInvoicePayment( $invoiceId, $transactionId, $paymentAmount, $paymentFee, $gatewayModuleName ); }else{ addInvoicePayment( $invoiceId, $transactionId, $paymentAmount, $paymentFee, $gatewayModuleName ); header('Location:'.$_SESSION['return_url']); } can someone guide me with this? how to return to invoice page with success message thanks
  15. Dear everyone.. greetings from me. i just need some suggestion from the experts. currently i am in ireland and using my whmcs for irish market. so my currency is euro. and my website all the products shows as in euros. i am planning to start a brand for host in bangladesh where i am originally from but i have the different price set for bangladesh website.. just to let u know i made another website for bangladesh market. and in the website prices are set in BDT not in euro i am looking for some solution when a visitor visit bangladesh website and select the product it will be shows the product sets for bangladesh and price will shown BDT not in euros but when client from ireland will visit the website they will see euros.. i want to set euros as default. also like visitor from UK will see product sets for UK and price will shown in GBP. do i need hook make for this? or what thing i need to customise? or need some module? can someone help me with some suggestion? thanks in advance
  • 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