feat: bootstrap JOBcard CRM foundation
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Return whether a client name already occurs in a list, ignoring case and outer whitespace.
|
||||
* Existing entries may be strings or rows containing a `name` field.
|
||||
*/
|
||||
function client_name_is_duplicate(string $name, array $existingClients): bool
|
||||
{
|
||||
$candidate = strtolower(trim($name));
|
||||
foreach ($existingClients as $existing) {
|
||||
$existingName = is_array($existing) ? ($existing['name'] ?? '') : $existing;
|
||||
if (is_string($existingName) && strtolower(trim($existingName)) === $candidate) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user