From a868f3632d48d2401ec0457c43206d752525a94a Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Mon, 17 Feb 2020 18:14:31 +0100
Subject: [PATCH] FEAT #12072 TIME 0:25 Fix from merge request

---
 sql/structure.sql                                          | 1 +
 src/app/email/controllers/EmailController.php              | 4 ++--
 .../sended-resource-page/sended-resource-page.component.ts | 7 +++++--
 src/frontend/lang/lang-fr.ts                               | 4 ++--
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/sql/structure.sql b/sql/structure.sql
index 016cf7215fe..5a7245b8edf 100755
--- a/sql/structure.sql
+++ b/sql/structure.sql
@@ -1108,6 +1108,7 @@ document_type character varying(255) NOT NULL,
 options json DEFAULT '{}',
 fee FLOAT NOT NULL,
 recipient_entity_id INTEGER NOT NULL,
+recipients jsonb DEFAULT '[]',
 account_id character varying(64) NOT NULL,
 creation_date timestamp without time zone NOT NULL,
 CONSTRAINT shippings_pkey PRIMARY KEY (id)
diff --git a/src/app/email/controllers/EmailController.php b/src/app/email/controllers/EmailController.php
index 2989c2056ec..b94571805d6 100644
--- a/src/app/email/controllers/EmailController.php
+++ b/src/app/email/controllers/EmailController.php
@@ -313,7 +313,7 @@ class EmailController
             } elseif ($queryParams['type'] == 'm2m') {
                 $where[] = 'message_exchange_id is not null';
             } elseif ($queryParams['type'] == 'email') {
-                $where[] = "object NOT LIKE '[AR]%'";
+                $where[] = "(object NOT LIKE '[AR]%' OR object is null)";
                 $where[] = 'message_exchange_id is null';
             }
         }
@@ -512,7 +512,7 @@ class EmailController
                     'label'     => $rawNote['note_text'],
                     'typeLabel' => 'note',
                     'creator'   => UserModel::getLabelledUserById(['id' => $rawNote['user_id']]),
-                    'format'    => 'html',
+                    'format'    => 'pdf',
                     'size'      => null
                 ];
             }
diff --git a/src/frontend/app/sendedResource/sended-resource-page/sended-resource-page.component.ts b/src/frontend/app/sendedResource/sended-resource-page/sended-resource-page.component.ts
index 20592b35ab4..78f371da5af 100644
--- a/src/frontend/app/sendedResource/sended-resource-page/sended-resource-page.component.ts
+++ b/src/frontend/app/sendedResource/sended-resource-page/sended-resource-page.component.ts
@@ -468,8 +468,11 @@ export class SendedResourcePageComponent implements OnInit {
             this.http.get(`../../rest/resources/${this.data.resId}/emailsInitialization`).pipe(
                 tap((data: any) => {
                     Object.keys(data).forEach(element => {
-                        if (element === 'resource') {  
-                            this.emailAttachTool.document.list = [data[element]];
+                        if (element === 'resource') {
+                            this.emailAttachTool.document.list = [];
+                            if (!this.functions.empty(data[element])) {
+                                this.emailAttachTool.document.list = [data[element]];
+                            }
                         } else {
                             this.emailAttachTool[element].list = data[element].map((item: any) => {
                                 return {
diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts
index 7a00fae0fc5..b20bab02a6f 100755
--- a/src/frontend/lang/lang-fr.ts
+++ b/src/frontend/lang/lang-fr.ts
@@ -1540,8 +1540,8 @@ export const LANG_FR = {
     "reaffectContactRedirect" : "Réaffecter à un contact",
     "contactReplacement" : "Contact remplaçant",
     "deleteContactwithtoutReassign" : "Supprimer le contact sans le remplacer",
-    "deleteContactInformations" : "Les différents liens entre le contact et les courriers, pièce-jointes ou accusés de réceptions seront supprimés.",
-    "reaffectContactInformations" : "Les différents liens entre le contact et les courriers, pièce-jointes ou accusés de réceptions seront réaffecter au nouveau contact choisi.",
+    "deleteContactInformations" : "Les différents liens entre le contact et les courriers, pièce-jointes ou accusés de réception seront supprimés.",
+    "reaffectContactInformations" : "Les différents liens entre le contact et les courriers, pièce-jointes ou accusés de réception seront réaffectés au nouveau contact choisi.",
     "availableContacts" : "Contact(s) disponible(s)",
     "sent" :  "Envoyé",
     "notSent" :  "Non envoyé",
-- 
GitLab