Evgeny
Member-
Posts
23 -
Joined
-
Last visited
-
Days Won
1
Evgeny last won the day on March 11 2024
Evgeny had the most liked content!
About Evgeny

Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Evgeny's Achievements
Junior Member (1/3)
1
Reputation
-
Evgeny started following additionalfields with active type , Add Funds Restricted by User , Hook for creating pdf from link and 4 others
-
got it, did it differently, placed the php file in callback folder with include to module and add access with token. Thank you for your consultation.
-
In general, I need to launch a link from my personal account or through the admin panel by specifying the user parameters, I did not find examples of how to do this by specifying the username and password to execute the link. I would be very glad if you share This link https://domain.tld/whmcs/admin/addonmodules.php?module=mymodule&action=printpage&id=10310 or this link https://domain.tld/whmcs/index.php?m=mymodule&id=10310 from an authorized user. Is it possible to somehow pass these parameters in a link or what options are there?
-
Ok, i need to make request by admin (api) user I try use this link https://domain.tld/whmcs/admin/addonmodules.php?module=mymodule&action=printpage&id=10310&username=admin&password=MyPass&accesskey=mykey But it redirect to admin login page. How i can make request to access this page. If i logged in admin area it working, but i need to make request from hook with admin login and password. &username=admin&password=MyPass&accesskey=mykey i find it Access Control - WHMCS Developer Documentation but it not working for me.
-
Hello, I want make hook, after InvoicePaid by hand (bank invoice) i generate some html table page with stamp, whis page available only for customers and require login in clientarea. Pdf generation work by link: If this link in clientarea pdf created blank $url = 'https://domain.tld/whmcs/index.php?m=receipt&id=6750; If url for some page as example $url = 'https://domain.tld/123.php; it generate good. <?php use WHMCS\Database\Capsule; use TCPDF; if (!defined("WHMCS")) { die("This file cannot be accessed directly"); } add_hook('InvoicePaid', 1, function($vars) { logActivity('Starting InvoicePayment hook for Invoice ID: ' . $vars['invoiceid']); if ($invoice->paymentmethod == 'bankinvoice') { logActivity('Manual payment detected for Invoice ID: ' . $vars['invoiceid']); $invoiceId = $vars['invoiceid']; $invoice = Capsule::table('tblinvoices')->where('id', $invoiceId)->first(); if ($invoice) { logActivity('Invoice found for Invoice ID: ' . $invoiceId); $client = Capsule::table('tblclients')->where('id', $invoice->userid)->first(); if ($client) { logActivity('Client data retrieved for Client ID: ' . $invoice->userid); require_once '/var/www/vhosts/domain.tld/whmcs/vendor/tecnickcom/tcpdf/tcpdf.php'; $pdf = new TCPDF(); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Your Company'); $pdf->SetTitle('Invoice ' . $invoiceId); $pdf->SetSubject('Invoice PDF'); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, 'Invoice', 'Your Company'); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->AddPage(); $url = 'https://domain.tld/whmcs/index.php?m=receipt&id=' . $invoiceId; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([ 'username' => $client->email, 'password' => $client->password ])); curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt'); $html = curl_exec($ch); if (curl_errno($ch)) { logActivity('cURL error: ' . curl_error($ch)); } else { logActivity('cURL request successful for Invoice ID: ' . $invoiceId); } curl_close($ch); $pdf->writeHTML($html, true, false, true, false, ''); $uploadsDir = __DIR__ . '/../../uploads/'; $pdfFilePath = $uploadsDir . 'Invoice_' . $invoiceId . '.pdf'; $pdf->Output($pdfFilePath, 'F'); logActivity('PDF generated and saved successfully for Invoice ID: ' . $invoiceId); echo 'PDF generated successfully. <a href="' . $pdfFilePath . '">Download PDF</a>'; } else { logActivity('Client data not found for Client ID: ' . $invoice->userid); } } else { logActivity('Invoice not found for Invoice ID: ' . $invoiceId); } } else { logActivity('Non-manual payment detected for Invoice ID: ' . $vars['invoiceid']); } }); I mark the invoice as paid manually in the admin panel. Apparently, authorization is not working correctly. How can I make it request data from the user, the account owner?
-
Hi, I have module bankinvoice and it generate qr code for banks. I want to add QR code picture to PDF template in file invoicepdf.tpl I add all php code at the begin of file invoicepdf.tpl ... code .. code... $qrcode = base64_encode($contents); in callback php file i use this string to show it <img style="width: 35mm; height: 35mm;" src="data:image/png;base64, <? echo $qrcode; ?>" /> and it show qr code. Return to file invoicepdf.tpl I try this $pdf->writeHTML($qrcode, true, false, false, false, ''); and it show content in base64 result: BxCry.. ...sria7= It's tell me that inserted code work good and i try to show it as image $paymethhtml = ' <img style="width: 35mm; height: 35mm;" src="data:image/png;base64, '.$qrcode.' />'; $pdf->writeHTML($paymethhtml, true, false, false, false, ''); but it not add QR (PDF generated as base, i think that i make something wrong. Please help to execute this string: <img style="width: 35mm; height: 35mm;" src="data:image/png;base64, <? echo $qrcode; ?>" /> in file invoicepdf.tpl correctly to show QR in PDF.
- 1 reply
-
1
-
This is the question and the point of having this option in the account options in the admin panel.
-
Hello, In the invoice option we can edit the invoice created date and payment end date. After the payment is credited, a payment date is generated, according to which we issue documents, and sometimes this date needs to be changed so that the document is generated with the date we need. Is it possible to somehow edit this field ($invoice->datepaid) for certain invoices in the admin panel?
-
When searching, he (whmcs) removes the dot, this is the question of who does the billing or the registrar module
-
I add com.cy in whois.json, but error same test123.comcy not available I think it depends on the registrar module. { "extensions": ".com.cy", "uri": "socket://whois.nic.cy", "available": "NOT FOUND" }
-
Hello, Please help, i add .com.cy domain in price list, but after i search test123.com.cy i have message test123.comcy not available I use registrar module and have turn on registrar whois search to work with premium domains. I want to understand maybe what needs to be enabled or the case is in the registrar module? Thank you.
-
Hi. UP! This problem is relevant to this day.
-
How to show fields depending on the type of domain registration ($tldmyname_type), for an individual or for a company. If the type of individual is selected, then display the fields for individuals and same if select company (show only fields for company): $tldmyname_type = array ( 'IND' => 'Personal', 'ORG' => 'Company' ); $additionaldomainfields['.tld'][] = array('Name' => 'Type', "LangVar" => "domain_type_register", 'Type' => 'dropdown', 'Options' => join($tldmyname_type,','), 'Required' => true); $additionaldomainfields['.tld'][] = array('Name' => 'LastName', "LangVar" => "domain_lastname", 'Type' => 'text', 'Size' => '20'); $additionaldomainfields['.tld'][] = array('Name' => 'Birthday', "LangVar" => "domain_birthday", 'Type' => 'text', 'Size' => '10'); $additionaldomainfields['.tld'][] = array('Name' => 'Passport', "LangVar" => "domain_passport_number", 'Type' => 'text', 'Size' => '20'); $additionaldomainfields['.tld'][] = array('Name' => '','Description' => '<center><br/><b>For Company</b></center>'); $additionaldomainfields['.tld'][] = array('Name' => 'Company_name', "LangVar" => "domain_company_name", 'Type' => 'text'); $additionaldomainfields['.tld'][] = array('Name' => 'Company_id', "LangVar" => "domain_company_id", 'Type' => 'text'); This will also allow me to make required fields, since this is currently not possible and in general it will be more convenient.
-
Found, thank you very much, this is what I need. So even better!
