diff --git a/rest/index.php b/rest/index.php index 97e45fbee63a8838e00514de75d00a4dfb8123ef..ab3d2f7ee72981a5426a8d922ef2df668e4e698a 100755 --- a/rest/index.php +++ b/rest/index.php @@ -137,6 +137,7 @@ $app->post('/contactsGroups/{id}/contacts', \Contact\controllers\ContactGroupCon $app->delete('/contactsGroups/{id}/contacts/{contactId}', \Contact\controllers\ContactGroupController::class . ':deleteContact'); $app->get('/contactsParameters', \Contact\controllers\ContactController::class . ':getContactsParameters'); $app->put('/contactsParameters', \Contact\controllers\ContactController::class . ':updateContactsParameters'); +$app->get('/civilities', \Contact\controllers\ContactController::class . ':getCivilities'); //Convert $app->post('/convertedFile', \Convert\controllers\ConvertPdfController::class . ':convertedFile'); diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php index e633252cce6d471c8cc3e1bd0621aa2759691a3d..87df30f994f15f7672eb1297c20652ed73c1b089 100755 --- a/src/app/contact/controllers/ContactController.php +++ b/src/app/contact/controllers/ContactController.php @@ -503,6 +503,13 @@ class ContactController return $response->withJson(['contact' => $contact]); } + public static function getCivilities(Request $request, Response $response) + { + $civilities = ContactModel::getCivilities(); + + return $response->withJson(['civilities' => $civilities]); + } + public static function getFillingRate(array $aArgs) { ValidatorModel::notEmpty($aArgs, ['contactId']); diff --git a/src/app/contact/models/ContactModel.php b/src/app/contact/models/ContactModel.php index b0ee39ea56b2be127d30266330d52838825561b1..5625f13b21d685e10b6e428029db27e83f100a02 100755 --- a/src/app/contact/models/ContactModel.php +++ b/src/app/contact/models/ContactModel.php @@ -190,10 +190,12 @@ class ContactModel $result = $loadedXml->xpath('/ROOT/titles'); foreach ($result as $title) { foreach ($title as $value) { - $civilities[(string) $value->id] = [ - 'label' => (string)$value->label, - 'abbreviation' => (string)$value->abbreviation, - ]; + if (!empty((string) $value->id)) { + $civilities[(string) $value->id] = [ + 'label' => (string)$value->label, + 'abbreviation' => (string)$value->abbreviation, + ]; + } } } } diff --git a/src/core/controllers/AutoCompleteController.php b/src/core/controllers/AutoCompleteController.php index 6ff31de499d5a91834618e5c87b328797fe3ca17..b2c822f67d8ab308e294ccd3f870d2cb06fabcc1 100755 --- a/src/core/controllers/AutoCompleteController.php +++ b/src/core/controllers/AutoCompleteController.php @@ -183,7 +183,7 @@ class AutoCompleteController 'select' => ['id'], 'where' => $requestData['where'], 'data' => $requestData['data'], - 'orderBy' => ['company', 'lastname'], + 'orderBy' => ['company', 'lastname NULLS FIRST'], 'limit' => self::TINY_LIMIT ]);