Skip to content

Commit

Permalink
Merge branch '1.1' of github.com:uvdesk/core-framework into 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhi12-gupta committed Jun 15, 2023
2 parents a5649f6 + 864b9ee commit 3cd0716
Show file tree
Hide file tree
Showing 14 changed files with 263 additions and 209 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG-1.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,24 @@ CHANGELOG for 1.1.x

This changelog references any relevant changes introduced in 1.1 minor versions.

* 1.1.x
* 1.1.4 (2023-06-13)
* Update: Render package version number dynamically

* 1.1.3 (2023-06-12)
* Update: Dropped dependency on uvdesk/composer-plugin in support of symfony/flex
* PR #638: Add RTL support for supported locales (ar) (Abhi12-gupta)
* Update: Redefined workflow events & action, updated workflow triggers for improved compatibility support
* Update: Correctly format email address collections for addresses with both name & address details while sending emails
* PR #615: Use ticket.createdAt instead of initialThread.createdAt for displaying created at timestamp in ticket details (Komal-sharma-2712)
* Bug #604: Error in deleting agent accounts from members dashboard (Komal-sharma-2712)
* Bug #622: Added viewport initial-scale in layout.html.twig file (Komal-sharma-2712)

* 1.1.2.2 (2023-02-14)
* Feature: Add formatted function to render timestamp based on available user locale preferences

* 1.1.2.1 (2023-01-31)
* Fixes: Resolve issues while saving custom fields on a ticket

* 1.1.2 (2022-11-02)
* PR #614: Changes to custom-fields app integration (Komal-sharma-2712)

Expand Down
26 changes: 15 additions & 11 deletions Controller/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,30 +511,34 @@ public function downloadZipAttachment(Request $request)
public function downloadAttachment(Request $request)
{
$attachmentId = $request->attributes->get('attachmendId');
$attachmentRepository = $this->getDoctrine()->getManager()->getRepository(Attachment::class);
$attachment = $attachmentRepository->findOneById($attachmentId);
$attachment = $this->getDoctrine()->getManager()->getRepository(Attachment::class)->findOneById($attachmentId);

$baseurl = $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath();

if (!$attachment) {
if (empty($attachment)) {
$this->noResultFound();
}

$ticket = $attachment->getThread()->getTicket();
$user = $this->userService->getSessionUser();

// Proceed only if user has access to the resource
if (false == $this->ticketService->isTicketAccessGranted($ticket, $user)) {
throw new \Exception('Access Denied', 403);
$thread = $attachment->getThread();

if (!empty($thread)) {
$ticket = $thread->getTicket();
$user = $this->userService->getSessionUser();

// Proceed only if user has access to the resource
if (false == $this->ticketService->isTicketAccessGranted($ticket, $user)) {
throw new \Exception('Access Denied', 403);
}
}

$path = $this->kernel->getProjectDir() . "/public/". $attachment->getPath();

$response = new Response();
$response->setStatusCode(200);

$response->headers->set('Content-type', $attachment->getContentType());
$response->headers->set('Content-Disposition', 'attachment; filename='. $attachment->getName());
$response->headers->set('Content-Length', $attachment->getSize());

$response->setStatusCode(200);
$response->sendHeaders();
$response->setContent(readfile($path));

Expand Down
11 changes: 11 additions & 0 deletions DependencyInjection/CoreFramework.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

class CoreFramework extends Extension
{
const VERSION = 'v1.1.4';

public function getAlias()
{
return 'uvdesk';
Expand All @@ -43,15 +45,19 @@ public function load(array $configs, ContainerBuilder $container)
$services->load('automations.yaml');
}

$container->setParameter("uvdesk.core.version", self::VERSION);

// Load bundle configurations
$configuration = $this->getConfiguration($configs, $container);

foreach ($this->processConfiguration($configuration, $configs) as $param => $value) {
switch ($param) {
case 'support_email':
case 'upload_manager':
foreach ($value as $field => $fieldValue) {
$container->setParameter("uvdesk.$param.$field", $fieldValue);
}

break;
case 'default':
foreach ($value as $defaultItem => $defaultItemValue) {
Expand All @@ -60,20 +66,25 @@ public function load(array $configs, ContainerBuilder $container)
foreach ($defaultItemValue as $template => $templateValue) {
$container->setParameter("uvdesk.default.templates.$template", $templateValue);
}

break;
case 'ticket':
foreach ($defaultItemValue as $option => $optionValue) {
$container->setParameter("uvdesk.default.ticket.$option", $optionValue);
}

break;
default:
$container->setParameter("uvdesk.default.$defaultItem", $defaultItemValue);

break;
}
}

break;
default:
$container->setParameter("uvdesk.$param", $value);

break;
}
}
Expand Down
155 changes: 77 additions & 78 deletions Entity/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,59 @@ class Attachment
*/
private $name;

/**
* @var string
* @ORM\Column(name="path", type="text", nullable=true)
*/
private $path;

/**
* @var string
*
* @ORM\Column(name="content_type", length=255, type="string", nullable=true)
*/
private $contentType;

/**
* @var integer
*
* @ORM\Column(name="size", type="integer", nullable=true)
*/
private $size;

/**
* @var string
*
*
*/
public $attachmentThumb;

/**
* @var integer
*/
public $attachmentOrginal;

/**
* @var string
*
* @ORM\Column(name="content_id", type="string", length=255, nullable=true)
*/
private $contentId;

/**
* @var string
*
* @ORM\Column(name="file_system", type="string", length=255, nullable=true)
*/
private $fileSystem;

/**
* @var \Webkul\TicketBundle\Entity\Thread
*
* @ORM\ManyToOne(targetEntity="Thread", inversedBy="attachments")
* @ORM\JoinColumn(name="thread_id", referencedColumnName="id", onDelete="CASCADE")
*/
private $thread;

/**
* Get id
Expand Down Expand Up @@ -62,12 +115,6 @@ public function getName()
{
return $this->name;
}
/**
* @var string
* @ORM\Column(name="path", type="text", nullable=true)
*/
private $path;


/**
* Set path
Expand All @@ -91,70 +138,12 @@ public function getPath()
{
return $this->path;
}
/**
* @var \Webkul\TicketBundle\Entity\Thread
*
* @ORM\ManyToOne(targetEntity="Thread", inversedBy="attachments")
* @ORM\JoinColumn(name="thread_id", referencedColumnName="id", onDelete="CASCADE")
*/
private $thread;


/**
* Set thread
*
* @param \Webkul\TicketBundle\Entity\Thread $thread
* @return Attachment
*
*/
public function setThread(\Webkul\UVDesk\CoreFrameworkBundle\Entity\Thread $thread = null)
{
$this->thread = $thread;

return $this;
}

/**
* Get thread
*
* @return \Webkul\UVDesk\CoreFrameworkBundle\Entity\Thread
*/
public function getThread()
{
return $this->thread;
}

/**
* @var string
*
* @ORM\Column(name="content_type", length=255, type="string", nullable=true)
*/
private $contentType;

/**
* @var integer
*
* @ORM\Column(name="size", type="integer", nullable=true)
*/
private $size;

/**
* @var string
*
*
*/
public $attachmentThumb;

public function getAttachmentThumb()
{
return $this->attachmentThumb;
}

/**
* @var integer
*/
public $attachmentOrginal;

public function getAttachmentOrginal()
{
return $this->attachmentOrginal;
Expand Down Expand Up @@ -205,13 +194,6 @@ public function getSize()
{
return $this->size;
}
/**
* @var string
*
* @ORM\Column(name="content_id", type="string", length=255, nullable=true)
*/
private $contentId;


/**
* Set contentId
Expand All @@ -235,13 +217,6 @@ public function getContentId()
{
return $this->contentId;
}
/**
* @var string
*
* @ORM\Column(name="file_system", type="string", length=255, nullable=true)
*/
private $fileSystem;


/**
* Set fileSystem
Expand All @@ -265,4 +240,28 @@ public function getFileSystem()
{
return $this->fileSystem;
}

/**
* Set thread
*
* @param \Webkul\TicketBundle\Entity\Thread $thread
* @return Attachment
*
*/
public function setThread(\Webkul\UVDesk\CoreFrameworkBundle\Entity\Thread $thread = null)
{
$this->thread = $thread;

return $this;
}

/**
* Get thread
*
* @return \Webkul\UVDesk\CoreFrameworkBundle\Entity\Thread
*/
public function getThread()
{
return $this->thread;
}
}
4 changes: 1 addition & 3 deletions FileSystem/FileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ public function getFileTypeAssociations(Attachment $attachment, $firewall = 'mem
{
$router = $this->container->get('router');
$request = $this->requestStack->getCurrentRequest();

$baseURL = $router->generate('base_route', [], UrlGeneratorInterface::ABSOLUTE_URL);


$assetDetails = [
'id' => $attachment->getId(),
'name' => $attachment->getName(),
Expand Down
24 changes: 0 additions & 24 deletions Package/Composer.php

This file was deleted.

7 changes: 0 additions & 7 deletions Resources/views/Snippets/createMemberTicket.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,6 @@
},
'reply' : {
fn: function(value) {
var content = tinyMCE.activeEditor.getContent();
if (content) {
return false;
}else {
return true;
}
if(!tinyMCE.get("uv-edit-create-thread"))
return false;
var html = tinyMCE.get("uv-edit-create-thread").getContent();
Expand Down
9 changes: 8 additions & 1 deletion Resources/views/Templates/layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
</head>

<body>
{% set bodyClass = '' %}
{% set bodySkinClass = '' %}

{% if app.request.locale == "ar" %}
{% set bodyClass = 'uv-rtl' %}
{% endif %}

<body class="{{ bodySkinClass ~ ' ' ~ bodyClass }}">
<div class="uv-notifications-wrapper">
<noscript>
<div class="uv-notification page-load uv-error">
Expand Down
Loading

0 comments on commit 3cd0716

Please sign in to comment.