More custom price per registrar preparations

This commit is contained in:
Pinga 2024-07-28 18:33:54 +03:00
parent 52409dcfbd
commit 0799781491
3 changed files with 27 additions and 9 deletions

View file

@ -515,7 +515,7 @@ function updatePermittedIPs($pool, $permittedIPsTable) {
}
}
function getDomainPrice($pdo, $domain_name, $tld_id, $date_add = 12, $command = 'create') {
function getDomainPrice($pdo, $domain_name, $tld_id, $date_add = 12, $command = 'create', $registrar_id = null) {
// Check if the domain is a premium domain
$stmt = $pdo->prepare("
SELECT c.category_price
@ -556,8 +556,17 @@ function getDomainPrice($pdo, $domain_name, $tld_id, $date_add = 12, $command =
// Get regular price for the specified period
$priceColumn = "m" . $date_add;
$stmt = $pdo->prepare("SELECT $priceColumn FROM domain_price WHERE tldid = ? AND command = '$command' LIMIT 1");
$stmt->execute([$tld_id]);
$sql = "
SELECT $priceColumn
FROM domain_price
WHERE tldid = ?
AND command = ?
AND (registrar_id = ? OR registrar_id IS NULL)
ORDER BY registrar_id DESC
LIMIT 1
";
$stmt = $pdo->prepare($sql);
$stmt->execute([$tld_id, $command, $registrar_id]);
if ($stmt->rowCount() > 0) {
$regularPrice = $stmt->fetch()[$priceColumn];