<?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.