• 03-03-2025, 23:21:24
    #1
    Admin paneline giriş yapabiliyorum fakat müşteri alanı böyle bir hata ile karşılaştım.

    includes/hooks/ClientInvoice.php(36): number_format()
    #1 [internal function]: WHMCSUtilitySafeInclude::{closure}()
    Oops!

    Something went wrong and we couldn't process your request.

    Please go back to the previous page and try again.
    For additional assistance, please reference the WHMCS TroubleShooting Guide »

    TypeError: number_format(): Argument #1 ($num) must be of type float, string given in
  • 03-03-2025, 23:30:15
    #2
    includes/hooks/ClientInvoice.php 36. satırdaki veri türünü zorunlu olarak float'a çevirin: Eğer $num değişkeni bir string içeriyorsa, floatval() fonksiyonuyla dönüştürebilirsiniz:

    $num = floatval($num);
    echo number_format($num, 2);
  • 03-03-2025, 23:34:09
    #3
    Kodespa adlı üyeden alıntı: mesajı görüntüle
    includes/hooks/ClientInvoice.php 36. satırdaki veri türünü zorunlu olarak float'a çevirin: Eğer $num değişkeni bir string içeriyorsa, floatval() fonksiyonuyla dönüştürebilirsiniz:

    $num = floatval($num);
    echo number_format($num, 2);
    36. satırda bu var hocam
     $total_tr    = number_format(($total_raw), 2, ',', '.') . ' TL';
  • 03-03-2025, 23:36:30
    #4
    fiberhosting adlı üyeden alıntı: mesajı görüntüle
    36. satırda bu var hocam
     $total_tr    = number_format(($total_raw), 2, ',', '.') . ' TL';

    $total_tr = number_format(floatval($total_raw), 2, ',', '.') . ' TL';
    Bununla güncelleyin sorun çözülecek mi bakın
  • 03-03-2025, 23:37:28
    #5
    Kodespa adlı üyeden alıntı: mesajı görüntüle
    $total_tr = number_format(floatval($total_raw), 2, ',', '.') . ' TL';
    Bununla güncelleyin sorun çözülecek mi bakın
    sonuç yine aynı hocam
  • 03-03-2025, 23:40:20
    #6
    Tüm sayfa kodunu iletir misiniz inceleyelim.
    Ayrıca cache silmeyi unutmayın. varsa geçici olarak cache kapatın.
  • 03-03-2025, 23:45:30
    #7
    Kodespa adlı üyeden alıntı: mesajı görüntüle
    Tüm sayfa kodunu iletir misiniz inceleyelim.
    Ayrıca cache silmeyi unutmayın. varsa geçici olarak cache kapatın.
    buyrun hocam

    <?php
    
    function is_renew_invoice($invoiceid){
    
        $invoice_result = localAPI('GetInvoice', ['invoiceid'=>$invoiceid]);
    
       if($invoice_result['items']['item'][0]['type']=='Hosting'){
           $h = Illuminate\Database\Capsule\Manager::table('tblhosting')->where('id',$invoice_result['items']['item'][0]['relid'])->first();
    
           if($h->regdate!=$invoice_result['date']){
               return true;
           }else{
               return false;
           }
       }elseif(strpos(strtolower($invoice_result['items']['item'][0]['type']),'domain' ) !== false){
           $h = Illuminate\Database\Capsule\Manager::table('tbldomains')
               ->where('id',$invoice_result['items']['item'][0]['relid'])
               ->first();
    
           if($h->registrationdate!=$invoice_result['date']){
               return true;
           }else{
               return false;
           }
       }
    
    }
    
    add_hook('ClientAreaPage', 1, function ($vars) {
    
            $total_raw    = preg_replace("/[^0-9\.]/", '', $vars['invoice']['total']);
            $subtotal_raw = preg_replace("/[^0-9\.]/", '', $vars['invoice']['subtotal']);
            $tax_raw      = preg_replace("/[^0-9\.]/", '', $vars['invoice']['tax']);
            $credit_raw   = preg_replace("/[^0-9\.]/", '', $vars['clientsdetails']['credit']);
    
            $total_tr    = number_format(($total_raw), 2, ',', '.') . ' TL';
            $subtotal_tr = number_format(($subtotal_raw), 2, ',', '.') . ' TL';
            $tax_tr      = number_format(($tax_raw), 2, ',', '.') . ' TL';
            $credit_tr   = number_format(($credit_raw), 2, ',', '.') . ' TL';
    
            return [
                'total_raw'    => $total_raw,
                'subtotal_raw' => $subtotal_raw,
                'discount_raw' => $tax_raw,
                'taxtotal_raw' => $credit_raw,
                'total_tr'     => $total_tr,
                'subtotal_tr'  => $subtotal_tr,
                'tax_tr'       => $tax_tr,
                'tax_raw'      => $tax_raw,
                'credit_tr'    => $credit_tr,
                'usdc'         => $c->currency
            ];
    
    });
  • 04-03-2025, 00:10:09
    #8
    <?php
    
    function is_renew_invoice($invoiceid) {
    
    $invoice_result = localAPI('GetInvoice', ['invoiceid' => $invoiceid]);
    
    if ($invoice_result['items']['item'][0]['type'] == 'Hosting') {
    $h = Illuminate\Database\Capsule\Manager::table('tblhosting')->where('id', $invoice_result['items']['item'][0]['relid'])->first();
    
    return $h->regdate != $invoice_result['date'];
    } elseif (strpos(strtolower($invoice_result['items']['item'][0]['type']), 'domain') !== false) {
    $h = Illuminate\Database\Capsule\Manager::table('tbldomains')
    ->where('id', $invoice_result['items']['item'][0]['relid'])
    ->first();
    
    return $h->registrationdate != $invoice_result['date'];
    }
    
    return false;
    }
    
    add_hook('ClientAreaPage', 1, function ($vars) {
    
    // Yalnızca sayıları ve noktaları al, ardından float'a çevir
    $total_raw = isset($vars['invoice']['total']) ? floatval(preg_replace("/[^0-9\.]/", '', $vars['invoice']['total'])) : 0.00;
    $subtotal_raw = isset($vars['invoice']['subtotal']) ? floatval(preg_replace("/[^0-9\.]/", '', $vars['invoice']['subtotal'])) : 0.00;
    $tax_raw = isset($vars['invoice']['tax']) ? floatval(preg_replace("/[^0-9\.]/", '', $vars['invoice']['tax'])) : 0.00;
    $credit_raw = isset($vars['clientsdetails']['credit']) ? floatval(preg_replace("/[^0-9\.]/", '', $vars['clientsdetails']['credit'])) : 0.00;
    
    // number_format() fonksiyonuna float gönderildiğinden hata oluşmayacak
    $total_tr = number_format($total_raw, 2, ',', '.') . ' TL';
    $subtotal_tr = number_format($subtotal_raw, 2, ',', '.') . ' TL';
    $tax_tr = number_format($tax_raw, 2, ',', '.') . ' TL';
    $credit_tr = number_format($credit_raw, 2, ',', '.') . ' TL';
    
    return [
    'total_raw' => $total_raw,
    'subtotal_raw' => $subtotal_raw,
    'discount_raw' => $tax_raw,
    'taxtotal_raw' => $credit_raw,
    'total_tr' => $total_tr,
    'subtotal_tr' => $subtotal_tr,
    'tax_tr' => $tax_tr,
    'tax_raw' => $tax_raw,
    'credit_tr' => $credit_tr,
    'usdc' => isset($c->currency) ? $c->currency : null
    ];
    });
    Bunu dener misiz sorun devam etmemesi gerekiyor.
  • 04-03-2025, 00:14:42
    #9
    Kodespa adlı üyeden alıntı: mesajı görüntüle
    <?php
    
    function is_renew_invoice($invoiceid) {
    
    $invoice_result = localAPI('GetInvoice', ['invoiceid' => $invoiceid]);
    
    if ($invoice_result['items']['item'][0]['type'] == 'Hosting') {
    $h = Illuminate\Database\Capsule\Manager::table('tblhosting')->where('id', $invoice_result['items']['item'][0]['relid'])->first();
    
    return $h->regdate != $invoice_result['date'];
    } elseif (strpos(strtolower($invoice_result['items']['item'][0]['type']), 'domain') !== false) {
    $h = Illuminate\Database\Capsule\Manager::table('tbldomains')
    ->where('id', $invoice_result['items']['item'][0]['relid'])
    ->first();
    
    return $h->registrationdate != $invoice_result['date'];
    }
    
    return false;
    }
    
    add_hook('ClientAreaPage', 1, function ($vars) {
    
    // Yalnızca sayıları ve noktaları al, ardından float'a çevir
    $total_raw = isset($vars['invoice']['total']) ? floatval(preg_replace("/[^0-9\.]/", '', $vars['invoice']['total'])) : 0.00;
    $subtotal_raw = isset($vars['invoice']['subtotal']) ? floatval(preg_replace("/[^0-9\.]/", '', $vars['invoice']['subtotal'])) : 0.00;
    $tax_raw = isset($vars['invoice']['tax']) ? floatval(preg_replace("/[^0-9\.]/", '', $vars['invoice']['tax'])) : 0.00;
    $credit_raw = isset($vars['clientsdetails']['credit']) ? floatval(preg_replace("/[^0-9\.]/", '', $vars['clientsdetails']['credit'])) : 0.00;
    
    // number_format() fonksiyonuna float gönderildiğinden hata oluşmayacak
    $total_tr = number_format($total_raw, 2, ',', '.') . ' TL';
    $subtotal_tr = number_format($subtotal_raw, 2, ',', '.') . ' TL';
    $tax_tr = number_format($tax_raw, 2, ',', '.') . ' TL';
    $credit_tr = number_format($credit_raw, 2, ',', '.') . ' TL';
    
    return [
    'total_raw' => $total_raw,
    'subtotal_raw' => $subtotal_raw,
    'discount_raw' => $tax_raw,
    'taxtotal_raw' => $credit_raw,
    'total_tr' => $total_tr,
    'subtotal_tr' => $subtotal_tr,
    'tax_tr' => $tax_tr,
    'tax_raw' => $tax_raw,
    'credit_tr' => $credit_tr,
    'usdc' => isset($c->currency) ? $c->currency : null
    ];
    });
    Bunu dener misiz sorun devam etmemesi gerekiyor.

    Bu seferde Domain List hatası çıktı hocam düzeltmeniz işe yaradı