From d68c6e2414c4dcfb78bd73e005aa388becde2893 Mon Sep 17 00:00:00 2001 From: wilsonmoura Date: Mon, 17 Oct 2022 14:29:32 -0300 Subject: [PATCH] #541 -- Update protocol comments feature --- .../Protocol/protocol_another_infos.html.twig | 18 +++++++----------- .../ModelBundle/Entity/ProtocolComment.php | 10 ++++------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/symphony/src/Proethos2/CoreBundle/Resources/views/Protocol/protocol_another_infos.html.twig b/symphony/src/Proethos2/CoreBundle/Resources/views/Protocol/protocol_another_infos.html.twig index aff2d8d0..b32da386 100644 --- a/symphony/src/Proethos2/CoreBundle/Resources/views/Protocol/protocol_another_infos.html.twig +++ b/symphony/src/Proethos2/CoreBundle/Resources/views/Protocol/protocol_another_infos.html.twig @@ -265,12 +265,10 @@ {{ comment.created|date('d/m/Y H:i:s') }} {{ comment.owner }} {% if comment.isConfidential %}{% endif %} - {{ comment.message|nl2br }} + {{ comment.message|nl2br }} {% if comment.filename %} - - - + {% endif %} @@ -321,14 +319,12 @@ {% for comment in protocol.comment %} {% if 'member-of-committee' == comment.role %} - {{ comment.created|date('d/m/Y H:i:s') }} - {{ comment.owner }} - {{ comment.message|nl2br }} - + {{ comment.created|date('d/m/Y H:i:s') }} + {{ comment.owner }} + {{ comment.message|nl2br }} + {% if comment.filename %} - - - + {% endif %} diff --git a/symphony/src/Proethos2/ModelBundle/Entity/ProtocolComment.php b/symphony/src/Proethos2/ModelBundle/Entity/ProtocolComment.php index a34035a4..ddfb9d2d 100644 --- a/symphony/src/Proethos2/ModelBundle/Entity/ProtocolComment.php +++ b/symphony/src/Proethos2/ModelBundle/Entity/ProtocolComment.php @@ -77,18 +77,16 @@ class ProtocolComment extends Base */ private $filepath; - public function __toString() { - return $this->getDate() . " - " . $this->getSubject(); - } - public function getRealFilename() { $filename = explode('_', $this->getFilename(), 2); return end($filename); } public function getUploadDirectory() { + $upload_directory = __DIR__.'/../../../../uploads/comments'; - + $upload_directory = $upload_directory . "/" . str_pad($this->getProtocol()->getId(), 5, '0', STR_PAD_LEFT); + if(!is_dir($upload_directory)) { mkdir($upload_directory); } @@ -113,7 +111,7 @@ public function setFile($file) { public function getUri() { - return "/uploads/comments/" . $this->getFilename(); + return "/uploads/comments/" . str_pad($this->getProtocol()->getId(), 5, '0', STR_PAD_LEFT) . "/" . $this->getFilename(); } /**