Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: fix issue related to the display of ticket comment form and … #97

Open
wants to merge 1 commit into
base: oro-3.1-upgrade
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public function deleteTicketComment($id)
* @return void
* @throws \RuntimeException if Comment does not exists or Comment has no particular attachment
*/
public function removeAttachmentFromComment(RemoveCommentAttachmentCommand $command)
public function removeAttachmentFromComment(RemoveCommentAttachmentCommand $command, $flush = true)
{
parent::removeAttachmentFromComment($command, true);
}
Expand Down
10 changes: 4 additions & 6 deletions src/Diamante/DeskBundle/Controller/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Diamante\DeskBundle\Entity\Ticket;
use Diamante\UserBundle\Model\User;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
Expand Down Expand Up @@ -108,10 +109,7 @@ private function edit(CommentCommand $command, $callback, Ticket $ticket)
$response = null;
$form = $this->createForm('diamante_comment_form', $command);
$formView = $form->createView();
$formView->children['attachmentsInput']->vars = array_replace(
$formView->children['attachmentsInput']->vars,
array('full_name' => 'diamante_comment_form[attachmentsInput][]')
);

try {
$this->handle($form);
$callback($command);
Expand Down Expand Up @@ -174,8 +172,8 @@ public function downloadAttachmentAction($commentId, $attachId)
$attachment = $commentService->getCommentAttachment($retrieveCommentAttachment);

$filename = $attachment->getFilename();
$filePathname = realpath($this->container->getParameter('kernel.root_dir') . '/attachments/comment')
. '/' . $attachment->getFilename();
$filePathname = realpath($this->container->getParameter('diamante.attachment.upload_dir.path'))
. '/comment/' . $attachment->getFilename();

if (!file_exists($filePathname)) {
$this->addErrorMessage('diamante.desk.attachment.messages.get.error');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AttachmentTransformer implements DataTransformerInterface
*/
public function transform($value)
{
return "";
return '';
}

/**
Expand All @@ -45,10 +45,6 @@ public function reverseTransform($value)

$inputs = array();

if (!$value) {
return $inputs;
}

foreach ($value as $each) {
if ($each) {
if (false === ($each instanceof UploadedFile)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Diamante/DeskBundle/Resources/config/attachment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parameter key="diamante.attachment.entity.class">Diamante\DeskBundle\Entity\Attachment</parameter>
<parameter key="diamante.attachment.entity.factory.class">Diamante\DeskBundle\Model\Attachment\AttachmentFactory</parameter>
<parameter key="diamante.attachment.directory.name">attachments</parameter>
<parameter key="diamante.attachment.upload_dir.path">%kernel.root_dir%/%diamante.attachment.directory.name%</parameter>
<parameter key="diamante.attachment.upload_dir.path">%kernel.project_dir%/var/%diamante.attachment.directory.name%</parameter>
<parameter key="diamante.attachment.manager.class">Diamante\DeskBundle\Model\Attachment\ManagerImpl</parameter>
<parameter key="diamante.attachment.file_storage.service.class">Diamante\DeskBundle\Infrastructure\Attachment\FileStorage\LocalFileStorageService</parameter>
<parameter key="diamante.attachment.imagine_data_loader.class">Diamante\DeskBundle\Infrastructure\Attachment\Imagine\Data\Loader\FileSystemAttachmentLoader</parameter>
Expand Down