Jump to content

All Activity

This stream auto-updates     

  1. Today
  2. @steven99 it worked with me, forget to thank you Thank you very much
  3. Yesterday
  4. @Kian Thanks for your help, Thank God I have reached to solution add_hook('ClientEdit', 1, function($vars) { $client = Menu::context('client'); $activeorders = $client->orders->where('status','Active')->count(); if (!is_null($client)) { $id = $vars["client_id"]; $defaultgateway = Capsule::table('tblclients')->where('id',$id )->first()->defaultgateway; $disallowed = getnotsafepayment(); if(in_array($defaultgateway,$disallowed)) { $command = 'GetInvoices'; $postData = array( 'userid' => $id, 'status' => 'unpaid', ); $results = localAPI($command, $postData); if($results["totalresults"]> 0) { foreach ($results['invoices']['invoice'] as $inv) { $invid = $inv['id']; $allowed_arr =get_allowed_payment_methods_for_invoice($invid,$client); // edit to first of the allowed payment $command = 'UpdateInvoice'; $postData = array( 'invoiceid' => $invid, 'paymentmethod' => array_values($allowed_arr)[0]['module'], ); $results = localAPI($command, $postData); } } } } }); this hook I have written if any one face the same problem , ==== @Kian by the way about the code you mentiond to edit html code in "gatewaydropdown" as I tested and worked for me , edit "availableGateways" is Enough $availableGateways = $vars['availableGateways']; foreach ($availableGateways as $key => $value) {if (in_array($key,$dis)) unset($availableGateways[$key]);} return array("availableGateways" => $availableGateways); ==== Thanks for your help
  5. V 1.0.5 Fixed Support PHP 8.1Fixed Bootstrap 4Updated Remove Support for PHP 7.2 to 7.3Updated Remove Support for WHMCS V8.2 to 8.3
  6. V 1.0.1 * Fixed Support PHP 8.1 * Updated Remove Support for PHP 7.2 to 7.3 * Updated Remove Support for WHMCS V8.2 to 8.3
  7. We used to send emails to our registered customers in last 90 days or something using Mass Mail in order versions of WHMCS but now after email campaign there is no option to send email to the clients registered during specific duration. I also wanted to know if is there any way to schedule emails to the verified emails only
  8. Version 1.0.1 Fixed Support PHP 8.1Updated Remove Support for PHP 7.2 to 7.3Updated Remove Support for WHMCS V8.2 to 8.3
  9. Version 1.1.2 Fixed Support PHP 8.1Fixed Issue with subscribe still active after removedUpdated Remove Support for PHP 7.2 to 7.3Updated Remove Support for WHMCS V8.2.x to 8.3.x
  10. Version 1.0.1 * Fixed Support PHP 8.1 * Fixed Error report on lang * Updated Remove Support for PHP 7.2 to 7.3 * Updated Remove Support for WHMCS V8.2 to 8.3
  11. Last week
  12. Version 4.0.1 Fixed Automatic purge days would not show for Error LogFixed Support PHP 8.1Updated Remove Support for PHP 7.2 to 7.3Updated Remove Support for WHMCS V8.2 to 8.3
  13. V 1.1.1 Fixed Support PHP 8.1Updated Remove Support for PHP 7.2 to 7.3Updated Remove Support for WHMCS V8.2 to 8.3
  14. V 2.1.2 Fixed Active Language selection issueFixed Support PHP 8.1Updated Remove Support for PHP 7.2 to 7.3Updated Remove Support for WHMCS V8.2 to 8.3
  15. Version 3.3.3 Fixed Support PHP 8.1 Updated Remove Support for PHP 7.2 to 7.3 Updated Remove Support for WHMCS V8.2 to 8.3
  16. V 3.2.1 Fixed Support PHP 8.1 Updated Remove Support for PHP 7.2 to 7.3 Updated Remove Support for WHMCS V8.2 to 8.3
  17. Okay, here is the hook which is based on this other one - this one has more features.
  18. V 4.8.3 Fixed Support PHP 8.1 Updated Remove Support for PHP 7.2 to 7.3 Updated Remove Support for WHMCS V8.2 to 8.3
  19. V 4.8.2 Fixed Issue with redirecting admin with access Fixed Issue with admin assigned to the client
  20. Incidentally I am working on an action hook where I need to remove specific payment methods from payment method dropdown (the one accessible from viewinvoice.php) depending on clients' groups. It is almost what you need. Basically there's an array like this one. define('kt_companies', [ 1 => [ 'tax_exempt' => true, 'invoice_header' => 'Ferrari S.p.A.' . PHP_EOL . 'Via Emilia Est 1163' . PHP_EOL . '41121 Modena - Italia', 'allowed_payment_gateways' => [ 'paypalcheckout' ] ], 2 => [ 'tax_exempt' => false, 'invoice_header' => 'Juventus S.p.A.' . PHP_EOL . 'Via Druento 175' . PHP_EOL . '10151 Torino - Italia', 'allowed_payment_gateways' => [ 'banktransfer', // The first gateway is always used as default to override restricted gateways (the ones not listed here) on open invoices (not in Paid, Collections, Refund, Payment Pending status) 'katamaze_nexi' ] ] ]); The keys (1 and 2) correspond to WHMCS client group. If a customer belongs to group id 2 (the second element of the array), I read allowed_payment_gateways array where I store payment gateways that the customer beloning to this group is allowed to use. I compare this array against all payment gateways available on WHMCS to find the the ones that the group is not allowed to use. Here's an example. WHMCS has gateway X, Y and Z. Group id 2 can only use X and Y. As a consequence Z is the gateway I need to restrict. Okay now I do 2 things. First. I remove Z from payment method dropdown (viewinvoice.php page). Second. I update all open invoices (not in Paid, Collections, Refund and Payment Pending status) of the client in question replacing Z (if present) with the first payment gateway in my allowed_payment_gateways array. If you can wait, I can extract the part that you need from the hook that I am finishing (btw I'll post that too). If you can't wait that's how I remove gateways from the dropdown. <?php // Apply kt_companies settings when a client is viewing an invoice add_hook('ClientAreaPageViewInvoice', 1, function($vars) { $data = kt_LoadCompanySettings($vars['userid']); // There are no restrictions on payment gateways for the client. There's no need to continue. The standard "Payment method" dropdown of WHMCS is good if (!isset($data['settings']['restricted_gateways'])) { return; } // At least one payment gateway is restricted to client. I parse $vars['gatewaydropdown'] (it contains the entire HTML of the "Payment method" dropdown accessible from viewinvoice.php) as HTML $dom = new DOMDocument(); $dom->loadHTML($vars['gatewaydropdown']); // I need to use xPath to read all the "<option></option>" tags of the "<select></select>" as an array $xpath = new DomXPath($dom); // I use this array to store xPath select conditions. I need this to communicate to xPath that for example I don't want "paypal" and "banktransfer" inside "Payment method" dropdown $xpath_conditions = []; // Looping every restricted payment gateway foreach ($data['settings']['restricted_gateways'] as $v) { $xpath_conditions[] = '@value="' . $v . '"'; } // Imploding condition by " or " as xPath is expecting $xpath_conditions = implode($xpath_conditions, ' or '); // Looping every "<option></option>" to detect restricted payment gateways and remove them from "Payment method" dropdown foreach($xpath->query('//select/option[(' . $xpath_conditions . ')]') as $node) { // Removing the restricted payment gateway $node->parentNode->removeChild($node); } return [ 'gatewaydropdown' => $dom->saveXml() // Overriding default WHMCS dropdown with mine ]; }); You should change the $data = kt_LoadCompanySettings($vars['userid']); part with this: $data['settings']['restricted_gateways'] = [ // Gateways you want to restrict 'paypaycheckout', 'banktrasnfer' ] Keep in mind that I'm still working on this code. It works for me but I still haven't tested everything.
  21. hi @leemahoney3 i am having the same issue here and there is nothing in console and it just adds # at the end of the URL Mark
  22. Welcome the most hungry bargain hunters! We know you've been on the lookout for details about our Black Friday event, but what you don't know is that you're in for a much bigger treat than you thought. We’ve launched our Black Weeks action, empowering you to stock up on every WHMCS product from our huge marketplace at a staggering 25% discount, which includes not only annual licenses but also open source products as well as license upgrades! Keep filling your shopping cart until December 4th without a shadow of a guilty conscience - your WHMCS business will thank you for that! Embark on the wildest shopping frenzy of the year!
  23. Thanks, Kian I've been working on that approach too, just didn't want to reinvent the wheel 😕 But it seems there's no other way. Well, I could fill a feature request xD xD
  1. Load more activity
×
×
  • 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