Skip to content
Snippets Groups Projects
Commit d6d2e854 authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

FEAT #11720 TIME 0:30 contact export change route + fix boolean values + fix custom array

parent 71ae85d2
No related branches found
No related tags found
No related merge requests found
......@@ -131,6 +131,7 @@ $app->put('/configurations/{service}', \Configuration\controllers\ConfigurationC
$app->get('/contacts', \Contact\controllers\ContactController::class . ':get');
$app->post('/contacts', \Contact\controllers\ContactController::class . ':create');
$app->get('/contacts/{id}', \Contact\controllers\ContactController::class . ':getById');
$app->put('/contacts/export', \Contact\controllers\ContactController::class . ':exportContacts');
$app->put('/contacts/{id}', \Contact\controllers\ContactController::class . ':update');
$app->delete('/contacts/{id}', \Contact\controllers\ContactController::class . ':delete');
$app->put('/contacts/{id}/activation', \Contact\controllers\ContactController::class . ':updateActivation');
......@@ -138,7 +139,6 @@ $app->get('/formattedContacts/{id}/types/{type}', \Contact\controllers\ContactCo
$app->get('/ban/availableDepartments', \Contact\controllers\ContactController::class . ':getAvailableDepartments');
$app->get('/duplicatedContacts', \Contact\controllers\ContactController::class . ':getDuplicatedContacts');
$app->put('/contacts/{id}/merge', \Contact\controllers\ContactController::class . ':mergeContacts');
$app->post('/contacts/export', \Contact\controllers\ContactController::class . ':exportContacts');
//ContactsCustomFields
$app->get('/contactsCustomFields', \Contact\controllers\ContactCustomFieldController::class . ':get');
......
......@@ -1174,12 +1174,15 @@ class ContactController
foreach ($contacts as $contact) {
foreach ($contact as $field => $value) {
if (strpos($field, 'contactCustomField_') !== false) {
if (strpos($field, 'contact_custom_field_') !== false) {
$decoded = json_decode($value, true);
if (is_array($decoded)) {
$contact[$field] = implode("\n", $decoded);
}
}
if (Validator::boolType()->validate($value)) {
$contact[$field] = $value ? 'TRUE' : 'FALSE';
}
}
if (!empty($contact['creator_label'])) {
$contact['creator_label'] = UserModel::getLabelledUserById(['id' => $contact['creator_label']]);
......
......@@ -138,7 +138,7 @@ export class ContactExportComponent implements OnInit {
exportData() {
this.localStorage.save(`exportContactFields_${this.headerService.user.id}`, JSON.stringify(this.exportModel));
this.loadingExport = true;
this.http.post('../rest/contacts/export', this.exportModel, { responseType: 'blob' }).pipe(
this.http.put('../rest/contacts/export', this.exportModel, { responseType: 'blob' }).pipe(
tap((data: any) => {
if (data.type !== 'text/html') {
const downloadLink = document.createElement('a');
......
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