mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-15 09:07:00 +02:00
Fixed issue with repeating names for launch phases
This commit is contained in:
parent
db83b1aa69
commit
db0c0286ef
1 changed files with 15 additions and 2 deletions
|
@ -1497,7 +1497,13 @@ class SystemController extends Controller
|
||||||
OR (start_date >= ? AND (end_date IS NULL OR end_date <= ?))
|
OR (start_date >= ? AND (end_date IS NULL OR end_date <= ?))
|
||||||
)
|
)
|
||||||
AND (end_date IS NULL OR end_date >= NOW()) -- Ensures ongoing phases count
|
AND (end_date IS NULL OR end_date >= NOW()) -- Ensures ongoing phases count
|
||||||
) AS dateOverlapExists";
|
) AS dateOverlapExists,
|
||||||
|
|
||||||
|
(SELECT COUNT(*)
|
||||||
|
FROM launch_phases
|
||||||
|
WHERE tld_id = ?
|
||||||
|
AND phase_name = ?
|
||||||
|
) AS duplicatePhaseNameExists";
|
||||||
|
|
||||||
$result = $db->selectRow(
|
$result = $db->selectRow(
|
||||||
$query,
|
$query,
|
||||||
|
@ -1505,7 +1511,8 @@ class SystemController extends Controller
|
||||||
$sData['tldid'], $sData['phaseType'], $sData['phaseName'],
|
$sData['tldid'], $sData['phaseType'], $sData['phaseName'],
|
||||||
$sData['tldid'], $sData['phaseEnd'], $sData['phaseStart'],
|
$sData['tldid'], $sData['phaseEnd'], $sData['phaseStart'],
|
||||||
$sData['phaseStart'], $sData['phaseEnd'],
|
$sData['phaseStart'], $sData['phaseEnd'],
|
||||||
$sData['phaseStart'], $sData['phaseEnd']
|
$sData['phaseStart'], $sData['phaseEnd'],
|
||||||
|
$sData['tldid'], $sData['phaseName']
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1516,6 +1523,12 @@ class SystemController extends Controller
|
||||||
return $response->withHeader('Location', '/registry/tld/'.$sData['extension'])->withStatus(302);
|
return $response->withHeader('Location', '/registry/tld/'.$sData['extension'])->withStatus(302);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($result['duplicatePhaseNameExists'] > 0) {
|
||||||
|
$db->rollBack();
|
||||||
|
$this->container->get('flash')->addMessage('error', 'A phase with this name already exists for this TLD.');
|
||||||
|
return $response->withHeader('Location', '/registry/tld/'.$sData['extension'])->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
if ($result['dateOverlapExists'] > 0) {
|
if ($result['dateOverlapExists'] > 0) {
|
||||||
// Date range overlaps with an existing entry
|
// Date range overlaps with an existing entry
|
||||||
$db->rollBack();
|
$db->rollBack();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue