diff --git a/app/Domain/Comments/Repositories/Comments.php b/app/Domain/Comments/Repositories/Comments.php index be17d2e672..c4f868740b 100644 --- a/app/Domain/Comments/Repositories/Comments.php +++ b/app/Domain/Comments/Repositories/Comments.php @@ -252,15 +252,13 @@ public function deleteComment($id): bool */ public function editComment($text, $id): bool { - $sql = "UPDATE zp_comment SET text = :text WHERE id = :id"; $stmn = $this->db->database->prepare($sql); $stmn->bindValue(':id', $id, PDO::PARAM_INT); - $stmn->bindValue(':text', $text, PDO::PARAM_INT); + $stmn->bindValue(':text', $text, PDO::PARAM_STR); $result = $stmn->execute(); $stmn->closeCursor(); - return $result; } } diff --git a/app/Domain/Comments/Services/Comments.php b/app/Domain/Comments/Services/Comments.php index 7a7383d91d..b62ef433a4 100644 --- a/app/Domain/Comments/Services/Comments.php +++ b/app/Domain/Comments/Services/Comments.php @@ -60,7 +60,6 @@ public function getComments($module, $entityId, int $commentOrder = 0): false|ar */ public function addComment($values, $module, $entityId, $entity): bool { - if (isset($values['text']) && $values['text'] != '' && isset($values['father']) && isset($module) && isset($entityId) && isset($entity)) { $mapper = array( 'text' => $values['text'], @@ -120,9 +119,16 @@ public function addComment($values, $module, $entityId, $entity): bool } /** - * @param $commentId + * @param $values + * @param $id * @return bool + * @throws BindingResolutionException */ + public function editComment($values, $id): bool + { + return $this->commentRepository->editComment($values['text'], $id); + } + /** * @param $commentId * @return bool @@ -132,6 +138,7 @@ public function deleteComment($commentId): bool return $this->commentRepository->deleteComment($commentId); } + } } diff --git a/app/Domain/Comments/Templates/submodules/generalComment.sub.php b/app/Domain/Comments/Templates/submodules/generalComment.sub.php index 748c8c1c69..9555a6d3bd 100644 --- a/app/Domain/Comments/Templates/submodules/generalComment.sub.php +++ b/app/Domain/Comments/Templates/submodules/generalComment.sub.php @@ -23,7 +23,7 @@ &v==format(session("userdata.modified"))->timestamp() ?>" />