From b7f0e048f0c40a84bcfaebd72becb796b6c6f03d Mon Sep 17 00:00:00 2001 From: Vinciane <vinciane.bizet@maarch.org> Date: Mon, 11 Mar 2019 10:15:53 +0100 Subject: [PATCH] FEAT #9514 List of resId send by paper and email --- .../AcknowledgementReceiptController.php | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/app/acknowledgementReceipt/controllers/AcknowledgementReceiptController.php b/src/app/acknowledgementReceipt/controllers/AcknowledgementReceiptController.php index c6277bd8f85..630bdaa3107 100644 --- a/src/app/acknowledgementReceipt/controllers/AcknowledgementReceiptController.php +++ b/src/app/acknowledgementReceipt/controllers/AcknowledgementReceiptController.php @@ -138,8 +138,14 @@ class AcknowledgementReceiptController return $response->withStatus(400)->withJson(['errors' => 'Data resources is empty or not an array']); } - $sendEmail = 0; - $sendPaper = 0; + $sendEmail = [ + 'number' => 0, + 'list' => [], + ]; + $sendPaper = [ + 'number' => 0, + 'list' => [], + ]; $noSendAR = [ 'number' => 0, 'list' => [], @@ -298,8 +304,14 @@ class AcknowledgementReceiptController } } - $sendEmail += $email; - $sendPaper += $paper; + if ($email > 0) { + $sendEmail['number'] += $email; + $sendEmail['list'][] = $resId; + } + if ($paper > 0) { + $sendPaper['number'] += $paper; + $sendPaper['list'][] = $resId; + } } return $response->withJson(['sendEmail' => $sendEmail, 'sendPaper' => $sendPaper, 'noSendAR' => $noSendAR, 'alreadySend' => $alreadySend, 'alreadyGenerated' => $alreadyGenerated]); -- GitLab