From 9e97d82555cfd3a1be48b8c01540a88497f084b3 Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Tue, 3 Mar 2020 17:31:48 +0100 Subject: [PATCH] FEAT #13119 TIME 0:40 added email status + exclude ar in emails --- .../controllers/FolderPrintController.php | 23 +++++++++++++++---- src/core/lang/lang-en.php | 2 ++ src/core/lang/lang-fr.php | 2 ++ src/core/lang/lang-nl.php | 2 ++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/app/resource/controllers/FolderPrintController.php b/src/app/resource/controllers/FolderPrintController.php index 48c7b60d040..cd5f359efdb 100644 --- a/src/app/resource/controllers/FolderPrintController.php +++ b/src/app/resource/controllers/FolderPrintController.php @@ -332,8 +332,8 @@ class FolderPrintController } } $emails = EmailModel::get([ - 'select' => ['id', 'user_id', 'sender', 'recipients', 'cc', 'cci', 'object', 'body', 'document', 'send_date'], - 'where' => ['id in (?)'], + 'select' => ['id', 'user_id', 'sender', 'recipients', 'cc', 'cci', 'object', 'body', 'document', 'send_date', 'status'], + 'where' => ['id in (?)', "object NOT LIKE '[AR]%'"], 'data' => [$resource['emails']], 'orderBy' => ['creation_date desc'] ]); @@ -342,8 +342,8 @@ class FolderPrintController } } else { $emails = EmailModel::get([ - 'select' => ['id', 'user_id', 'sender', 'recipients', 'cc', 'cci', 'object', 'body', 'document', 'send_date'], - 'where' => ["cast(document->>'id' as INT) = ? "], + 'select' => ['id', 'user_id', 'sender', 'recipients', 'cc', 'cci', 'object', 'body', 'document', 'send_date', 'status'], + 'where' => ["cast(document->>'id' as INT) = ? ", "object NOT LIKE '[AR]%'"], 'data' => [$resource['resId']], 'orderBy' => ['creation_date desc'] ]); @@ -684,7 +684,7 @@ class FolderPrintController $date = new \DateTime($email['send_date']); $date = $date->format('d-m-Y H:i'); - $sentDate = _SENT_DATE . ' ' . $date; + $sentDate = _CREATED . ' ' . $date; $sentBy = UserModel::getLabelledUserById(['id' => $email['user_id']]); @@ -705,6 +705,16 @@ class FolderPrintController $recipientsCopyHidden = implode(", ", $recipientsCopyHidden); $recipientsCopyHidden = !empty($recipientsCopyHidden) ? $recipientsCopyHidden : _UNDEFINED; + if ($email['status'] == 'SENT') { + $status = _EMAIL_SENT; + } else if ($email['status'] == 'DRAFT') { + $status = _EMAIL_DRAFT; + } else if ($email['status'] == 'WAITING') { + $status = _EMAIL_SENDING; + } else { + $status = _EMAIL_ERROR_SENT; + } + $pdf = new Fpdi('P', 'pt'); $pdf->setPrintHeader(false); $pdf->AddPage(); @@ -738,6 +748,9 @@ class FolderPrintController $pdf->MultiCell($widthQuarter, 30, '<b>' . _SUBJECT . '</b>', 1, 'L', false, 0, '', '', true, 0, true); $pdf->MultiCell($widthThreeQuarter, 30, $email['object'] , 1, 'L', false, 1, '', '', true, 0, true); + $pdf->MultiCell($widthQuarter, 30, '<b>' . _STATUS . '</b>', 1, 'L', false, 0, '', '', true, 0, true); + $pdf->MultiCell($widthThreeQuarter, 30, $status , 1, 'L', false, 1, '', '', true, 0, true); + $pdf->SetY($pdf->GetY() + 5); $pdf->writeHTML($email['body']); diff --git a/src/core/lang/lang-en.php b/src/core/lang/lang-en.php index 7b6dfb135e6..d03d03000ce 100755 --- a/src/core/lang/lang-en.php +++ b/src/core/lang/lang-en.php @@ -354,6 +354,8 @@ define("_EMAIL_WAIT", "Waiting to be send"); define("_EMAIL_SENT", "Sent"); define("_EMAIL_ERROR", "Error when sending"); define("_EMAIL_DRAFT_SAVED", "Draft saved"); +define("_EMAIL_ERROR_SENT", "Not sent"); +define("_EMAIL_SENDING", "Sending email..."); define("_MAILEVA_ADDED", "Shipping Maileva added"); define("_MAILEVA_UPDATED", "Shipping Maileva updated"); diff --git a/src/core/lang/lang-fr.php b/src/core/lang/lang-fr.php index 90508e9149d..f4c0fbe987d 100755 --- a/src/core/lang/lang-fr.php +++ b/src/core/lang/lang-fr.php @@ -355,6 +355,8 @@ define("_EMAIL_WAIT", "En attente d'envoi"); define("_EMAIL_SENT", "Envoyé"); define("_EMAIL_ERROR", "Erreur lors de l'envoi"); define("_EMAIL_DRAFT_SAVED", "Brouillon enregistré"); +define("_EMAIL_ERROR_SENT", "Non envoyé"); +define("_EMAIL_SENDING", "En cours d'envoi..."); define("_MAILEVA_ADDED", "Envoi postal Maileva ajouté"); define("_MAILEVA_UPDATED", "Envoi postal Maileva mis à jour"); diff --git a/src/core/lang/lang-nl.php b/src/core/lang/lang-nl.php index 4a207003e23..57da7457e53 100755 --- a/src/core/lang/lang-nl.php +++ b/src/core/lang/lang-nl.php @@ -356,6 +356,8 @@ define("_EMAIL_WAIT", "Waiting to be send_TO_TRANSLATE"); define("_EMAIL_SENT", "Sent_TO_TRANSLATE"); define("_EMAIL_ERROR", "Error when sending_TO_TRANSLATE"); define("_EMAIL_DRAFT_SAVED", "Draft saved_TO_TRANSLATE"); +define("_EMAIL_ERROR_SENT", "Not sent"); //TO TRANSLATE +define("_EMAIL_SENDING", "Sending email..."); //TO TRANSLATE define("_MAILEVA_ADDED", "Shipping Maileva added_TO_TRANSLATE"); define("_MAILEVA_UPDATED", "Shipping Maileva updated_TO_TRANSLATE"); -- GitLab