diff --git a/automation/auto-approve-transfer.php b/automation/auto-approve-transfer.php index 4958c4d..1d118fb 100644 --- a/automation/auto-approve-transfer.php +++ b/automation/auto-approve-transfer.php @@ -73,7 +73,7 @@ try { $to = $dbh->query("SELECT exdate FROM domain WHERE id = '$domain_id' LIMIT 1")->fetchColumn(); - $stmt_insert_statement = $dbh->prepare("INSERT INTO statement (registrar_id,date,command,domain_name,length_in_months,from,to,amount) VALUES(?,CURRENT_TIMESTAMP,?,?,?,?,?,?)"); + $stmt_insert_statement = $dbh->prepare("INSERT INTO statement (registrar_id,date,command,domain_name,length_in_months,fromS,toS,amount) VALUES(?,CURRENT_TIMESTAMP,?,?,?,?,?,?)"); $stmt_insert_statement->execute([$reid, 'transfer', $name, $date_add, $from, $to, $price]); $stmt_select_domain = $dbh->prepare("SELECT id,registrant,crdate,exdate,lastupdate,clid,crid,upid,trdate,trstatus,reid,redate,acid,acdate,transfer_exdate FROM domain WHERE name = ? LIMIT 1"); diff --git a/automation/change-domain-status.php b/automation/change-domain-status.php index d8acbd7..63d98bb 100644 --- a/automation/change-domain-status.php +++ b/automation/change-domain-status.php @@ -51,7 +51,7 @@ try { $dbh->exec("UPDATE registrar SET accountBalance = (accountBalance - $price) WHERE id = '$clid'"); $dbh->exec("INSERT INTO payment_history (registrar_id, date, description, amount) VALUES('$clid', CURRENT_TIMESTAMP, 'autoRenew domain $name for period 12 MONTH', '-$price')"); list($to) = $dbh->query("SELECT exdate FROM domain WHERE id = '$domain_id' LIMIT 1")->fetch(PDO::FETCH_NUM); - $sth = $dbh->prepare("INSERT INTO statement (registrar_id, date, command, domain_name, length_in_months, from, to, amount) VALUES(?, CURRENT_TIMESTAMP, ?, ?, ?, ?, ?, ?)"); + $sth = $dbh->prepare("INSERT INTO statement (registrar_id, date, command, domain_name, length_in_months, fromS, toS, amount) VALUES(?, CURRENT_TIMESTAMP, ?, ?, ?, ?, ?, ?)"); $sth->execute([$clid, 'autoRenew', $name, '12', $exdate, $to, $price]); if (!$dbh->query("SELECT id FROM statistics WHERE date = CURDATE()")->fetchColumn()) { $dbh->exec("INSERT IGNORE INTO statistics (date) VALUES(CURDATE())"); diff --git a/cp/app/Controllers/DomainsController.php b/cp/app/Controllers/DomainsController.php index 4d1ec04..24c26fb 100644 --- a/cp/app/Controllers/DomainsController.php +++ b/cp/app/Controllers/DomainsController.php @@ -562,8 +562,8 @@ class DomainsController extends Controller 'command' => 'create', 'domain_name' => $domainName, 'length_in_months' => $date_add, - 'from' => $from, - 'to' => $to, + 'fromS' => $from, + 'toS' => $to, 'amount' => $price ] ); @@ -1424,8 +1424,8 @@ class DomainsController extends Controller 'command' => 'renew', 'domain_name' => $domainName, 'length_in_months' => $date_add, - 'from' => $from, - 'to' => $to, + 'fromS' => $from, + 'toS' => $to, 'amount' => $price ] ); @@ -2277,8 +2277,8 @@ class DomainsController extends Controller 'command' => 'transfer', 'domain_name' => $domainName, 'length_in_months' => $date_add, - 'from' => $from, - 'to' => $to, + 'fromS' => $from, + 'toS' => $to, 'amount' => $price ] ); @@ -2603,8 +2603,8 @@ class DomainsController extends Controller 'command' => 'restore', 'domain_name' => $domainName, 'length_in_months' => 0, - 'from' => $from, - 'to' => $from, + 'fromS' => $from, + 'toS' => $from, 'amount' => $restore_price ] ); @@ -2617,8 +2617,8 @@ class DomainsController extends Controller 'command' => 'renew', 'domain_name' => $domainName, 'length_in_months' => 12, - 'from' => $from, - 'to' => $to, + 'fromS' => $from, + 'toS' => $to, 'amount' => $renew_price ] ); diff --git a/cp/app/Controllers/FinancialsController.php b/cp/app/Controllers/FinancialsController.php index 41c3a3a..3e50506 100644 --- a/cp/app/Controllers/FinancialsController.php +++ b/cp/app/Controllers/FinancialsController.php @@ -108,8 +108,8 @@ class FinancialsController extends Controller 'command' => 'create', 'domain_name' => 'deposit', 'length_in_months' => 0, - 'from' => $date, - 'to' => $date, + 'fromS' => $date, + 'toS' => $date, 'amount' => $amount ] ); @@ -226,8 +226,8 @@ class FinancialsController extends Controller 'command' => 'create', 'domain_name' => 'deposit', 'length_in_months' => 0, - 'from' => $date, - 'to' => $date, + 'fromS' => $date, + 'toS' => $date, 'amount' => $amount ] ); diff --git a/cp/resources/views/partials/js-transactions.twig b/cp/resources/views/partials/js-transactions.twig index 682486f..8b04548 100644 --- a/cp/resources/views/partials/js-transactions.twig +++ b/cp/resources/views/partials/js-transactions.twig @@ -29,8 +29,8 @@ {title:"Command", field:"command", headerSort:true, responsive:2}, {title:"Domain", field:"domain_name", headerSort:false, download:false, responsive:0}, {title:"Length", field:"length_in_months", headerSort:true, responsive:2}, - {title:"From", field:"from", headerSort:true, responsive:2}, - {title:"To", field:"to", headerSort:true, responsive:2}, + {title:"From", field:"fromS", headerSort:true, responsive:2}, + {title:"To", field:"toS", headerSort:true, responsive:2}, {title:"Amount", field:"amount", headerSort:false, download:false, responsive:2}, ], placeholder:function(){ diff --git a/database/registry.mariadb.sql b/database/registry.mariadb.sql index a218aeb..807f16d 100644 --- a/database/registry.mariadb.sql +++ b/database/registry.mariadb.sql @@ -168,8 +168,8 @@ CREATE TABLE IF NOT EXISTS `registry`.`statement` ( `command` enum('create','renew','transfer','restore','autoRenew') NOT NULL default 'create', `domain_name` varchar(68) NOT NULL, `length_in_months` tinyint(3) unsigned NOT NULL, - `from` datetime(3) NOT NULL, - `to` datetime(3) NOT NULL, + `fromS` datetime(3) NOT NULL, + `toS` datetime(3) NOT NULL, `amount` decimal(12,2) NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `statement_ibfk_1` FOREIGN KEY (`registrar_id`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT diff --git a/database/registry.postgres.sql b/database/registry.postgres.sql index e8be975..53c042b 100644 --- a/database/registry.postgres.sql +++ b/database/registry.postgres.sql @@ -174,8 +174,8 @@ CREATE TABLE registry.statement ( "command" varchar CHECK ("command" IN ( 'create','renew','transfer','restore','autoRenew' )) NOT NULL default 'create', "domain_name" varchar(68) NOT NULL, "length_in_months" smallint CHECK ("length_in_months" >= 0) NOT NULL, - "from" timestamp(3) without time zone NOT NULL, - "to" timestamp(3) without time zone NOT NULL, + "fromS" timestamp(3) without time zone NOT NULL, + "toS" timestamp(3) without time zone NOT NULL, "amount" decimal(12,2) NOT NULL, primary key ("id") ); diff --git a/epp/src/epp-create.php b/epp/src/epp-create.php index f7e583a..6d98d19 100644 --- a/epp/src/epp-create.php +++ b/epp/src/epp-create.php @@ -1174,7 +1174,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $selectDomainDatesStmt->execute([':name' => $domainName]); [$from, $to] = $selectDomainDatesStmt->fetch(PDO::FETCH_NUM); - $statementStmt = $db->prepare("INSERT INTO statement (registrar_id,date,command,domain_name,length_in_months,from,to,amount) VALUES(:registrar_id,CURRENT_TIMESTAMP(3),:cmd,:name,:date_add,:from,:to,:price)"); + $statementStmt = $db->prepare("INSERT INTO statement (registrar_id,date,command,domain_name,length_in_months,fromS,toS,amount) VALUES(:registrar_id,CURRENT_TIMESTAMP(3),:cmd,:name,:date_add,:from,:to,:price)"); $statementStmt->execute([ ':registrar_id' => $clid, ':cmd' => 'create', diff --git a/epp/src/epp-renew.php b/epp/src/epp-renew.php index fcde154..373d1b9 100644 --- a/epp/src/epp-renew.php +++ b/epp/src/epp-renew.php @@ -165,13 +165,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) { $to = $stmt->fetchColumn(); // Insert into statement: - if ($database_type === "mysql") { - $stmt = $db->prepare("INSERT INTO statement (registrar_id, date, command, domain_name, length_in_months, from, to, amount) VALUES (?, CURRENT_TIMESTAMP(3), ?, ?, ?, ?, ?, ?)"); - } elseif ($database_type === "pgsql") { - $stmt = $db->prepare('INSERT INTO statement (registrar_id, date, command, domain_name, length_in_months, "from", "to", amount) VALUES (?, CURRENT_TIMESTAMP(3), ?, ?, ?, ?, ?, ?)'); - } else { - throw new Exception("Unsupported database type: $database_type"); - } + $stmt = $db->prepare("INSERT INTO statement (registrar_id, date, command, domain_name, length_in_months, fromS, toS, amount) VALUES (?, CURRENT_TIMESTAMP(3), ?, ?, ?, ?, ?, ?)"); $stmt->execute([$clid['id'], 'renew', $domainName, $date_add, $from, $to, $price]); } } diff --git a/epp/src/epp-transfer.php b/epp/src/epp-transfer.php index 2bf1e3a..845a82c 100644 --- a/epp/src/epp-transfer.php +++ b/epp/src/epp-transfer.php @@ -501,7 +501,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $stmt->execute(['domain_id' => $domain_id]); $to = $stmt->fetchColumn(); - $stmt = $db->prepare("INSERT INTO statement (registrar_id,date,command,domain_name,length_in_months,from,to,amount) VALUES(:registrar_id, CURRENT_TIMESTAMP(3), :command, :domain_name, :length_in_months, :from, :to, :amount)"); + $stmt = $db->prepare("INSERT INTO statement (registrar_id,date,command,domain_name,length_in_months,fromS,toS,amount) VALUES(:registrar_id, CURRENT_TIMESTAMP(3), :command, :domain_name, :length_in_months, :from, :to, :amount)"); $stmt->execute(['registrar_id' => $reid, 'command' => 'transfer', 'domain_name' => $domainName, 'length_in_months' => $date_add, 'from' => $from, 'to' => $to, 'amount' => $price]); $stmt = $db->prepare("SELECT id,registrant,crdate,exdate,lastupdate,clid,crid,upid,trdate,trstatus,reid,redate,acid,acdate,transfer_exdate FROM domain WHERE name = :name LIMIT 1"); diff --git a/epp/src/epp-update.php b/epp/src/epp-update.php index 3fa2f25..07f1fd4 100644 --- a/epp/src/epp-update.php +++ b/epp/src/epp-update.php @@ -1692,7 +1692,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $stmt->execute([$domain_id]); $to = $stmt->fetchColumn(); - $sth = $db->prepare("INSERT INTO statement (registrar_id,date,command,domain_name,length_in_months,from,to,amount) VALUES(?,CURRENT_TIMESTAMP(3),?,?,?,?,?,?)"); + $sth = $db->prepare("INSERT INTO statement (registrar_id,date,command,domain_name,length_in_months,fromS,toS,amount) VALUES(?,CURRENT_TIMESTAMP(3),?,?,?,?,?,?)"); $sth->execute([$clid, 'restore', $domainName, 0, $from, $from, $restore_price]); $sth->execute([$clid, 'renew', $domainName, 12, $from, $to, $renew_price]);