Skip to content
Snippets Groups Projects
Commit 525df14d authored by Damien's avatar Damien
Browse files

FEAT #6263 Fix email + corporate

parent da1ca886
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,12 @@ class ContactController
}
if ($data['isCorporatePerson'] != 'Y') {
$data['isCorporatePerson'] = 'N';
} else {
$data['addressFirstname'] = $data['firstname'];
$data['addressLastname'] = $data['lastname'];
unset($data['firstname'], $data['lastname']);
}
if (empty($data['isPrivate'])) {
$data['isPrivate'] = 'N';
} elseif ($data['isPrivate'] != 'N') {
......
......@@ -15,6 +15,7 @@
namespace Core\Controllers;
use Core\Models\StatusModel;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Respect\Validation\Validator;
......@@ -95,6 +96,9 @@ class ResController
if (empty($data['status'])) {
$data['status'] = 'COU';
}
if (empty(StatusModel::getById(['id' => $data['status']]))) {
return $response->withStatus(400)->withJson(['errors' => 'Status not found']);
}
if (empty($data['historyMessage'])) {
$data['historyMessage'] = _UPDATE_STATUS;
}
......
......@@ -39,10 +39,10 @@ class ContactModelAbstract
public static function create(array $aArgs)
{
ValidatorModel::notEmpty($aArgs, ['firstname', 'lastname', 'contactType', 'isCorporatePerson', 'email', 'userId', 'entityId']);
ValidatorModel::notEmpty($aArgs, ['firstname', 'lastname', 'contactType', 'isCorporatePerson', 'userId', 'entityId']);
ValidatorModel::intVal($aArgs, ['contactType']);
ValidatorModel::stringType($aArgs, [
'firstname', 'lastname', 'isCorporatePerson', 'email', 'society',
'firstname', 'lastname', 'isCorporatePerson', 'society',
'societyShort', 'title', 'function', 'otherData', 'userId', 'entityId'
]);
......@@ -74,11 +74,11 @@ class ContactModelAbstract
public static function createAddress(array $aArgs)
{
ValidatorModel::notEmpty($aArgs, ['contactId', 'contactPurposeId', 'userId', 'entityId', 'isPrivate']);
ValidatorModel::notEmpty($aArgs, ['contactId', 'contactPurposeId', 'userId', 'entityId', 'isPrivate', 'email']);
ValidatorModel::intVal($aArgs, ['contactId', 'contactPurposeId']);
ValidatorModel::stringType($aArgs, [
'departement', 'addressFirstname', 'addressLastname', 'addressTitle', 'addressFunction', 'occupancy', 'addressNum', 'addressStreet', 'addressComplement',
'addressTown', 'addressZip', 'addressCountry', 'phone', 'addressEmail', 'website', 'salutationHeader', 'salutationFooter', 'addressOtherData',
'addressTown', 'addressZip', 'addressCountry', 'phone', 'email', 'website', 'salutationHeader', 'salutationFooter', 'addressOtherData',
'userId', 'entityId', 'isPrivate'
]);
......@@ -103,7 +103,7 @@ class ContactModelAbstract
'address_postal_code' => $aArgs['addressZip'],
'address_country' => $aArgs['addressCountry'],
'phone' => $aArgs['phone'],
'email' => $aArgs['addressEmail'],
'email' => $aArgs['email'],
'website' => $aArgs['website'],
'salutation_header' => $aArgs['salutationHeader'],
'salutation_footer' => $aArgs['salutationFooter'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment