diff --git a/cp/app/Controllers/DomainsController.php b/cp/app/Controllers/DomainsController.php index 77fe247..f5d4dbd 100644 --- a/cp/app/Controllers/DomainsController.php +++ b/cp/app/Controllers/DomainsController.php @@ -3159,13 +3159,24 @@ class DomainsController extends Controller $creditLimit = $result['creditLimit']; $renew_price = $db->selectValue( - 'SELECT m12 FROM domain_price WHERE tldid = ? AND command = ? LIMIT 1', - [$tldid, 'renew'] + "SELECT m12 + FROM domain_price + WHERE tldid = ? + AND command = ? + AND (registrar_id = ? OR registrar_id IS NULL) + ORDER BY registrar_id DESC + LIMIT 1", + [$tldid, 'renew', $clid] ); - + $restore_price = $db->selectValue( - 'SELECT price FROM domain_restore_price WHERE tldid = ? LIMIT 1', - [$tldid] + "SELECT price + FROM domain_restore_price + WHERE tldid = ? + AND (registrar_id = ? OR registrar_id IS NULL) + ORDER BY registrar_id DESC + LIMIT 1", + [$tldid, $clid] ); if (($registrar_balance + $creditLimit) < ($renew_price + $restore_price)) { diff --git a/epp/src/epp-check.php b/epp/src/epp-check.php index 2c1bc05..bd8bc5f 100644 --- a/epp/src/epp-check.php +++ b/epp/src/epp-check.php @@ -377,8 +377,15 @@ function processDomainCheck($conn, $db, $xml, $trans, $clid) { $returnValue = getDomainPrice($db, $domainName, $tld_id, $date_add, $commandName, $clid); $price = $returnValue['price']; - $sth = $db->prepare("SELECT price FROM domain_restore_price WHERE tldid = ? LIMIT 1"); - $sth->execute([$tld_id]); + $sth = $db->prepare(" + SELECT price + FROM domain_restore_price + WHERE tldid = ? + AND (registrar_id = ? OR registrar_id IS NULL) + ORDER BY registrar_id DESC + LIMIT 1 + "); + $sth->execute([$tld_id, $clid]); $restore_price = $sth->fetchColumn(); if ($commandName == 'restore') { diff --git a/epp/src/epp-update.php b/epp/src/epp-update.php index a7a6712..a3e6992 100644 --- a/epp/src/epp-update.php +++ b/epp/src/epp-update.php @@ -1795,12 +1795,27 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $sth->execute([$clid]); list($registrar_balance, $creditLimit) = $sth->fetch(); - $sth = $db->prepare("SELECT m12 FROM domain_price WHERE tldid = ? AND command = 'renew' LIMIT 1"); - $sth->execute([$row['tldid']]); + $sth = $db->prepare(" + SELECT m12 + FROM domain_price + WHERE tldid = ? + AND command = 'renew' + AND (registrar_id = ? OR registrar_id IS NULL) + ORDER BY registrar_id DESC + LIMIT 1 + "); + $sth->execute([$row['tldid'], $clid]); $renew_price = $sth->fetchColumn(); - $sth = $db->prepare("SELECT price FROM domain_restore_price WHERE tldid = ? LIMIT 1"); - $sth->execute([$row['tldid']]); + $sth = $db->prepare(" + SELECT price + FROM domain_restore_price + WHERE tldid = ? + AND (registrar_id = ? OR registrar_id IS NULL) + ORDER BY registrar_id DESC + LIMIT 1 + "); + $sth->execute([$row['tldid'], $clid]); $restore_price = $sth->fetchColumn(); if (($registrar_balance + $creditLimit) < ($renew_price + $restore_price)) {