Fixes for domain restore

This commit is contained in:
Pinga 2023-12-07 13:46:48 +02:00
parent 96034f2219
commit 8b66028052
2 changed files with 18 additions and 14 deletions

View file

@ -1740,7 +1740,7 @@ class DomainsController extends Controller
$this->container->get('flash')->addMessage('error', 'Database failure: ' . $e->getMessage()); $this->container->get('flash')->addMessage('error', 'Database failure: ' . $e->getMessage());
return $response->withHeader('Location', '/domain/renew/'.$domainName)->withStatus(302); return $response->withHeader('Location', '/domain/renew/'.$domainName)->withStatus(302);
} }
$isImmediateDeletion = true;
} }
} elseif ($rgpstatus === 'autoRenewPeriod') { } elseif ($rgpstatus === 'autoRenewPeriod') {
$autoRenewPeriod_id = $db->selectValue( $autoRenewPeriod_id = $db->selectValue(
@ -1835,7 +1835,11 @@ class DomainsController extends Controller
} }
} }
$this->container->get('flash')->addMessage('success', 'Domain ' . $domainName . ' deleted successfully'); if ($isImmediateDeletion) {
$this->container->get('flash')->addMessage('success', 'Domain ' . $domainName . ' deleted successfully');
} else {
$this->container->get('flash')->addMessage('info', 'Deletion process for domain ' . $domainName . ' has been initiated');
}
return $response->withHeader('Location', '/domains')->withStatus(302); return $response->withHeader('Location', '/domains')->withStatus(302);
} else { } else {
// Redirect to the domains view // Redirect to the domains view
@ -2049,7 +2053,7 @@ class DomainsController extends Controller
return $response->withHeader('Location', '/transfer/request/')->withStatus(302); return $response->withHeader('Location', '/transfer/request/')->withStatus(302);
} }
$this->container->get('flash')->addMessage('success', 'Transfer for ' . $domainName . ' has been started successfully on ' . $qdate . ' An action is pending'); $this->container->get('flash')->addMessage('info', 'Transfer for ' . $domainName . ' has been started successfully on ' . $qdate . ' An action is pending');
return $response->withHeader('Location', '/transfers')->withStatus(302); return $response->withHeader('Location', '/transfers')->withStatus(302);
} else { } else {
try { try {
@ -2101,7 +2105,7 @@ class DomainsController extends Controller
return $response->withHeader('Location', '/transfer/request/')->withStatus(302); return $response->withHeader('Location', '/transfer/request/')->withStatus(302);
} }
$this->container->get('flash')->addMessage('success', 'Transfer for ' . $domainName . ' has been started successfully on ' . $qdate . ' An action is pending'); $this->container->get('flash')->addMessage('info', 'Transfer for ' . $domainName . ' has been started successfully on ' . $qdate . ' An action is pending');
return $response->withHeader('Location', '/transfers')->withStatus(302); return $response->withHeader('Location', '/transfers')->withStatus(302);
} }
} elseif ($trstatus === 'pending') { } elseif ($trstatus === 'pending') {
@ -2494,7 +2498,7 @@ class DomainsController extends Controller
] ]
); );
$this->container->get('flash')->addMessage('success', 'Restore process for ' . $domainName . ' has started successfully'); $this->container->get('flash')->addMessage('info', 'Restore process for ' . $domainName . ' has started successfully');
return $response->withHeader('Location', '/domains')->withStatus(302); return $response->withHeader('Location', '/domains')->withStatus(302);
} else { } else {
$this->container->get('flash')->addMessage('error', 'pendingRestore can only be done if the domain is now in redemptionPeriod'); $this->container->get('flash')->addMessage('error', 'pendingRestore can only be done if the domain is now in redemptionPeriod');
@ -2569,7 +2573,7 @@ class DomainsController extends Controller
$db->beginTransaction(); $db->beginTransaction();
$db->exec( $db->exec(
'UPDATE domain SET exdate = DATE_ADD(exdate, INTERVAL 12 MONTH), rgpstatus = NULL, rgpresTime = CURRENT_TIMESTAMP(3), update = CURRENT_TIMESTAMP(3) WHERE name = ?', 'UPDATE domain SET exdate = DATE_ADD(exdate, INTERVAL 12 MONTH), rgpstatus = NULL, rgpresTime = CURRENT_TIMESTAMP(3), `update` = CURRENT_TIMESTAMP(3) WHERE name = ?',
[ [
$domainName $domainName
] ]

View file

@ -17,18 +17,18 @@
var actionButtons = ''; var actionButtons = '';
var hasPendingDelete = rowData.domain_status.some(statusObj => statusObj.status && statusObj.status.includes('pendingDelete')); var hasPendingDelete = rowData.domain_status.some(statusObj => statusObj.status && statusObj.status.includes('pendingDelete'));
var hasPendingRestore = rowData.domain_status.some(statusObj => statusObj.status && statusObj.status.includes('pendingRestore')); var hasPendingRestore = rowData.rgpstatus ? rowData.rgpstatus.includes('pendingRestore') : false;
// Common action button for all statuses // Common action button for all statuses
actionButtons += `<a class="btn btn-primary btn-icon" href="domain/update/${cell.getRow().getData().name}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"></path><path d="M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"></path><path d="M16 5l3 3"></path></svg></a> `; actionButtons += `<a class="btn btn-primary btn-icon" href="domain/update/${cell.getRow().getData().name}" title="Update Domain"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"></path><path d="M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"></path><path d="M16 5l3 3"></path></svg></a> `;
if (hasPendingDelete) { if (hasPendingRestore) {
actionButtons += `<a class="btn btn-outline-yellow btn-icon" href="domain/restore/${cell.getRow().getData().name}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 4.55a8 8 0 0 0 -6 14.9m0 -4.45v5h-5" /><path d="M18.37 7.16l0 .01" /><path d="M13 19.94l0 .01" /><path d="M16.84 18.37l0 .01" /><path d="M19.37 15.1l0 .01" /><path d="M19.94 11l0 .01" /></svg></a>`; actionButtons += `<a class="btn btn-outline-green btn-icon" href="domain/report/${cell.getRow().getData().name}" title="Submit Report"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3.06 13a9 9 0 1 0 .49 -4.087" /><path d="M3 4.001v5h5" /><path d="M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /></svg></a>`;
} else if (hasPendingRestore) { } else if (hasPendingDelete) {
actionButtons += `<a class="btn btn-outline-green btn-icon" href="domain/report/${cell.getRow().getData().name}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3.06 13a9 9 0 1 0 .49 -4.087" /><path d="M3 4.001v5h5" /><path d="M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /></svg></a>`; actionButtons += `<a class="btn btn-outline-yellow btn-icon" href="domain/restore/${cell.getRow().getData().name}" title="Restore Domain"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 4.55a8 8 0 0 0 -6 14.9m0 -4.45v5h-5" /><path d="M18.37 7.16l0 .01" /><path d="M13 19.94l0 .01" /><path d="M16.84 18.37l0 .01" /><path d="M19.37 15.1l0 .01" /><path d="M19.94 11l0 .01" /></svg></a>`;
} else { } else {
actionButtons += `<a class="btn btn-secondary btn-icon" href="domain/renew/${cell.getRow().getData().name}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"></path><path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"></path></svg></a> `; actionButtons += `<a class="btn btn-secondary btn-icon" href="domain/renew/${cell.getRow().getData().name}" title="Renew Domain"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"></path><path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"></path></svg></a> `;
actionButtons += `<a class="btn btn-danger btn-icon" href="domain/delete/${cell.getRow().getData().name}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7h16"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path><path d="M10 12l4 4m0 -4l-4 4"></path></svg></a>`; actionButtons += `<a class="btn btn-danger btn-icon" href="domain/delete/${cell.getRow().getData().name}" title="Delete Domain"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7h16"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path><path d="M10 12l4 4m0 -4l-4 4"></path></svg></a>`;
} }
return actionButtons; return actionButtons;