Skip to content

Commit

Permalink
Merge pull request #10 from ThomasDaSilva/feat/on-hold-status
Browse files Browse the repository at this point in the history
add on-hold-status
  • Loading branch information
zawaze committed Dec 4, 2023
2 parents 1261acd + 7901a3d commit 290acb4
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.0.6</version>
<version>1.0.7</version>
<authors>
<author>
<name>thomas da silva mendonca</name>
Expand Down
1 change: 1 addition & 0 deletions Controller/ConfigurationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function saveParameters(ParserContext $parserContext) : RedirectResponse|
ZenDesk::setConfigValue("zen_desk_ticket_type", $data["ticket_type"]);
ZenDesk::setConfigValue("zen_desk_hide_column", $data["column_hide"]);
ZenDesk::setConfigValue("zen_desk_show_private_comment", $data["private_comment"]);
ZenDesk::setConfigValue("zen_desk_status_hold", $data["status_hold"]);

return $this->generateSuccessRedirect($form);
} catch (FormValidationException $e) {
Expand Down
4 changes: 3 additions & 1 deletion Controller/FrontController.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ public function getCommentsByTicketsId(RequestStack $requestStack, ZenDeskManage
"ticketId" => $id,
"ticketName" => $ticketName,
"status" => $ticket["ticket"]->status,
"zendesk_rules" => (bool)ZenDesk::getConfigValue("zen_desk_user_rules")
"zendesk_rules" => (bool)ZenDesk::getConfigValue("zen_desk_user_rules"),
"zendesk_hold" => (bool)ZenDesk::getConfigValue("zen_desk_status_hold"),
]);
}

Expand Down Expand Up @@ -200,6 +201,7 @@ public function updateTicketStatus(
if (
$status ==="open" ||
$status === "pending" ||
$status === "hold" ||
$status ==="solved"
) {
$params = [
Expand Down
9 changes: 9 additions & 0 deletions Form/ParametersForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ protected function buildForm()
'data' => (bool)ZenDesk::getConfigValue('zen_desk_show_private_comment')
]
)
->add(
'status_hold',
CheckboxType::class,
[
'label' => Translator::getInstance()->trans("Status \"On-hold\" Activated ?", [], ZenDesk::DOMAIN_NAME),
'required' => false,
'data' => (bool)ZenDesk::getConfigValue('zen_desk_status_hold')
]
)
;
}
}
2 changes: 2 additions & 0 deletions I18n/fr_FR.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
'Role' => 'Rôle',
'Show private comments ?' => 'Montrer les commentaires privés ?',
'Status' => 'Statut',
'Status "On-hold" Activated ?' => 'Statut "En pause" Activé ?',
'Ticket Type' => 'Type de Ticket',
'Update At' => 'Date de modification',
'Updated_At' => 'Date de modification',
Expand All @@ -46,6 +47,7 @@
'description' => 'Description',
'description of your issue' => 'description du ticket',
'hide a column (only work with ticket type : all)' => 'masque une colonne (fonctionne seulement avec le type de ticket : tous les tickets)',
'hold' => 'En pause',
'https://{subdomain}.zendesk.com' => 'https://{sous-domaine}.zendesk.com',
'mail of the assignee' => 'mail de l\'assigné au ticket',
'name of your organisation' => 'nom de l\'organisation',
Expand Down
1 change: 1 addition & 0 deletions I18n/frontOffice/default/fr_FR.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'Create a new Zendesk ticket' => 'Créer un nouveau ticket Zendesk',
'My ZenDesk Tickets' => 'Mon suivi SAV',
'ADD A COMMENT' => 'RÉDIGER UN COMMENTAIRE',
'Hold' => 'En Pause',
'Open' => 'Ouvert',
'Open Ticket comments' => 'Ouvrir les commentaires',
'Pending' => 'En Attente',
Expand Down
13 changes: 11 additions & 2 deletions Service/ZendeskService.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function sortOrderTickets(
$ticketsNew = [];
$ticketsOpen = [];
$ticketsPending = [];
$ticketsHold = [];
$ticketsClosed = [];

$sort = $order['dir'];
Expand All @@ -56,6 +57,10 @@ public function sortOrderTickets(
$ticketsPending[] = $ticket;
}

if ($ticket->status === "hold") {
$ticketsHold[] = $ticket;
}

if ($ticket->status === "closed" ||
$ticket->status === "solved") {
$ticketsClosed[] = $ticket;
Expand All @@ -66,6 +71,7 @@ public function sortOrderTickets(
$this->sortByUpdatedAt($ticketsNew, $columnDefinition),
$this->sortByUpdatedAt($ticketsOpen, $columnDefinition),
$this->sortByUpdatedAt($ticketsPending, $columnDefinition),
$this->sortByUpdatedAt($ticketsHold, $columnDefinition),
$this->sortByUpdatedAt($ticketsClosed, $columnDefinition)
);
}
Expand Down Expand Up @@ -156,7 +162,7 @@ public function jsonFormat(stdClass $ticket): array
$ticketType = ZenDesk::getConfigValue("zen_desk_ticket_type");
$hiddenColumn = ZenDesk::getConfigValue("zen_desk_hide_column");

if ($ticketType === "requested" || $ticketType === "all" && $hiddenColumn === "requested hide") {
if ($ticketType === "requested" || ($ticketType === "all" && $hiddenColumn === "requested hide")) {
return
[
$ticket->id,
Expand All @@ -174,7 +180,7 @@ public function jsonFormat(stdClass $ticket): array
];
}

if ($ticketType === "assigned" || $ticketType === "all" && $hiddenColumn === "assigned hide") {
if ($ticketType === "assigned" || ($ticketType === "all" && $hiddenColumn === "assigned hide")) {
return
[
$ticket->id,
Expand Down Expand Up @@ -252,6 +258,9 @@ public function translateStatus(string $status): ?string
if ($status === "pending") {
return Translator::getInstance()->trans('pending', [], ZenDesk::DOMAIN_NAME);
}
if ($status === "hold") {
return Translator::getInstance()->trans('hold', [], ZenDesk::DOMAIN_NAME);
}
if ($status === "solved") {
return Translator::getInstance()->trans('solved', [], ZenDesk::DOMAIN_NAME);
}
Expand Down
1 change: 1 addition & 0 deletions ZenDesk.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function postActivation(ConnectionInterface $con = null): void
self::setConfigValue('zen_desk_ticket_type', 'assigned');
self::setConfigValue('zen_desk_hide_column', 'nothing hide');
self::setConfigValue('zen_desk_show_private_comment', 'false');
self::setConfigValue('zen_desk_status_hold', 'false');
}

/**
Expand Down
1 change: 1 addition & 0 deletions templates/backOffice/default/module_configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
{render_form_field field='ticket_type'}
{render_form_field field='column_hide'}
{render_form_field field='private_comment'}
{render_form_field field='status_hold'}
<button type="submit" class="btn btn-success" >{intl l="Save Parameters" d="zendesk.bo.default"}</button>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion templates/frontOffice/default/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<a class="Button Button--primary" href="#{count($comments)}">{intl l="show last message" d='zendesk.fo.default'}</a>
</div>
<hr>

{if $zendesk_rules && $status != "closed"}
<div class="text-center m-2">
<a class="Button Button--{if $status == "open"}secondary{else}primary{/if}" href="{if $status == "open"}#{else}{url path="/zendesk/tickets/$ticketId/status/open"}{/if}">{intl l="Open" d='zendesk.fo.default'}</a>
<a class="Button Button--{if $status == "pending"}secondary{else}primary{/if}" href="{if $status == "pending"}#{else}{url path="/zendesk/tickets/$ticketId/status/pending"}{/if}">{intl l="Pending" d='zendesk.fo.default'}</a>
{if $zendesk_hold}<a class="Button Button--{if $status == "hold"}secondary{else}primary{/if}" href="{if $status == "hold"}#{else}{url path="/zendesk/tickets/$ticketId/status/hold"}{/if}">{intl l="Hold" d='zendesk.fo.default'}</a>{/if}
<a class="Button Button--{if $status == "solved"}secondary{else}primary{/if}" href="{if $status == "solved"}#{else}{url path="/zendesk/tickets/$ticketId/status/solved"}{/if}">{intl l="Solved" d='zendesk.fo.default'}</a>
</div>
<hr>
Expand Down

0 comments on commit 290acb4

Please sign in to comment.