Skip to content

Commit

Permalink
Merge pull request #7 from ThomasDaSilva/main
Browse files Browse the repository at this point in the history
change translation + add hide column option
  • Loading branch information
zawaze authored Oct 10, 2023
2 parents 8b6f53b + 50231be commit dec35b6
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 6 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.1</version>
<version>1.0.2</version>
<authors>
<author>
<name>thomas da silva mendonca</name>
Expand Down
Empty file added Config/update/1.0.2
Empty file.
1 change: 1 addition & 0 deletions Controller/ConfigurationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function saveParameters(ParserContext $parserContext) : RedirectResponse|

ZenDesk::setConfigValue("zen_desk_user_rules", $data["user_rules"]);
ZenDesk::setConfigValue("zen_desk_ticket_type", $data["ticket_type"]);
ZenDesk::setConfigValue("zen_desk_hide_column", $data["column_hide"]);

return $this->generateSuccessRedirect($form);
} catch (FormValidationException $e) {
Expand Down
22 changes: 22 additions & 0 deletions Form/ParametersForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,28 @@ protected function buildForm()
'data' => ZenDesk::getConfigValue('zen_desk_ticket_type')
]
)
->add(
'column_hide',
ChoiceType::class,
[
'choices' => [
Translator::getInstance()->trans("Hide assigned column", [], ZenDesk::DOMAIN_NAME) => "assigned hide",
Translator::getInstance()->trans("Hide requested column", [], ZenDesk::DOMAIN_NAME) => "requested hide",
Translator::getInstance()->trans("Hide nothing", [], ZenDesk::DOMAIN_NAME) => "nothing hide"
],
'label' => Translator::getInstance()->trans("Hidden column", [], ZenDesk::DOMAIN_NAME),
'required' => true,
'label_attr' => [
'for' => 'ticket_type',
'help' => Translator::getInstance()->trans(
"hide a column (only work with ticket type : all)",
[],
ZenDesk::DOMAIN_NAME
)
],
'data' => ZenDesk::getConfigValue('zen_desk_hide_column')
]
)
;
}
}
5 changes: 5 additions & 0 deletions I18n/fr_FR.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
'Assignee not Found' => 'Assigné non Trouvé',
'Created At' => 'Date de création',
'Go to zendesk admin panel, Search API Zendesk -> Add a token API' => 'Aller sur le panneau administrateur, Rechercher API Zendesk -> Ajouter un token API',
'Hidden column' => 'Masquer une Colonne',
'Hide assigned column' => 'Masquer la colonne des Assignés',
'Hide nothing' => 'Ne Rien Masquer',
'Hide requested column' => 'Masquer la colonne des Demandeurs',
'ID' => 'ID',
'Organization not Found' => 'Organisation non Trouvé',
'Read-Only' => 'Lecture seulement',
Expand All @@ -35,6 +39,7 @@
'comment_reply' => 'réponse',
'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)',
'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
2 changes: 1 addition & 1 deletion I18n/frontOffice/default/fr_FR.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

return array(
'Create a new Zendesk ticket' => 'Créer un nouveau ticket Zendesk',
'My ZenDesk Tickets' => 'Mes Tickets ZenDesk',
'My ZenDesk Tickets' => 'Mon suivi SAV',
'ADD A COMMENT' => 'RÉDIGER UN COMMENTAIRE',
'Open' => 'Ouvert',
'Open Ticket comments' => 'Ouvrir les commentaires',
Expand Down
7 changes: 5 additions & 2 deletions Service/ZenDeskTicketsDataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public function getDefineColumnsDefinition($type): array
{
$i = -1;

$ticketType = ZenDesk::getConfigValue("zen_desk_ticket_type");
$hiddenColumn = ZenDesk::getConfigValue("zen_desk_hide_column");

$definitions = [];

$definitions[] =
Expand All @@ -105,7 +108,7 @@ public function getDefineColumnsDefinition($type): array
'title' => Translator::getInstance()->trans('Subject', [], ZenDesk::DOMAIN_NAME)
];

if (ZenDesk::getConfigValue("zen_desk_ticket_type") !== "requested")
if ($ticketType === "assigned" || $ticketType === "all" && $hiddenColumn !== "requested hide")
{
$definitions[] =
[
Expand All @@ -117,7 +120,7 @@ public function getDefineColumnsDefinition($type): array
;
}

if (ZenDesk::getConfigValue("zen_desk_ticket_type") !== "assigned")
if ($ticketType === "requested" || $ticketType === "all" && $hiddenColumn !== "assigned hide")
{
$definitions[] =
[
Expand Down
7 changes: 5 additions & 2 deletions Service/ZendeskService.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ public function jsonFormat(\stdClass $ticket): array
$createdAt = new DateTime($ticket->created_at);
$updateAt = new DateTime($ticket->updated_at);

if (ZenDesk::getConfigValue("zen_desk_ticket_type") === "requested")
$ticketType = ZenDesk::getConfigValue("zen_desk_ticket_type");
$hiddenColumn = ZenDesk::getConfigValue("zen_desk_hide_column");

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

if (ZenDesk::getConfigValue("zen_desk_ticket_type") === "assigned")
if ($ticketType === "assigned" || $ticketType === "all" && $hiddenColumn === "assigned hide")
{
return
[
Expand Down
1 change: 1 addition & 0 deletions ZenDesk.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function postActivation(ConnectionInterface $con = null): void
{
self::setConfigValue('zen_desk_user_rules', 'false');
self::setConfigValue('zen_desk_ticket_type', 'assigned');
self::setConfigValue('zen_desk_hide_column', 'nothing hide');
}

/**
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 @@ -122,6 +122,7 @@
<div class="col-md-6">
{render_form_field field='user_rules'}
{render_form_field field='ticket_type'}
{render_form_field field='column_hide'}
<button type="submit" class="btn btn-success" >{intl l="Save Parameters" d="zendesk.bo.default"}</button>
</div>
</form>
Expand Down

0 comments on commit dec35b6

Please sign in to comment.