Commit f2dd7d80d33f4820e08c60b3207e1b4f8ee3dda9

Authored by Rodrigo Gonçalves
1 parent d0db2964
Exists in master

Publicacao de manutencoes em progresso.

Kernel/Language/pt_BR_NewTicketWizard.pm
... ... @@ -16,7 +16,8 @@ use warnings;
16 16 sub Data {
17 17 my $Self = shift;
18 18  
19   -
  19 + $Self->{Translation}->{'The following maintenances are in progress'} = 'As seguintes manutenções estão ocorrendo';
  20 + $Self->{Translation}->{'Started at: '} = 'Iniciada em:';
20 21 $Self->{Translation}->{'Queues panel'} = 'Novo chamado';
21 22 $Self->{Translation}->{'Your ticket has been registered with the number: '} = 'Seu chamado foi registrado com sucesso! O número é: ';
22 23 $Self->{Translation}->{'New ticket wizard'} = 'Assistente de novo chamado';
... ...
Kernel/Modules/NewTicketWizard.pm
... ... @@ -23,6 +23,9 @@ use Kernel::System::DynamicField::Backend;
23 23 require Kernel::System::QueueService;
24 24 use Kernel::System::VariableCheck qw(:all);
25 25 use Data::Dumper;
  26 +use Kernel::System::Maintenance;
  27 +use Kernel::System::DateUtils;
  28 +
26 29  
27 30 sub new {
28 31 my ( $Type, %Param ) = @_;
... ... @@ -53,6 +56,8 @@ sub new {
53 56 $Self->{ServiceObject} = Kernel::System::Service->new(%Param);
54 57 $Self->{QueueObject} = Kernel::System::Queue->new(%Param);
55 58 $Self->{QueueServiceObject} = Kernel::System::QueueService->new(%Param);
  59 + $Self->{MaintenanceObject} = Kernel::System::Maintenance->new(%Param);
  60 + $Self->{DateUtilsObject} = Kernel::System::DateUtils->new(%Param);
56 61  
57 62 return $Self;
58 63 }
... ... @@ -113,15 +118,17 @@ sub Run {
113 118 my ( $Self, %Param ) = @_;
114 119 my %Data = ();
115 120  
116   - if ($Self->{ParamObject}->GetParam(Param => "QueueID")) {
117   - $Data{QueueID} = $Self->{ParamObject}->GetParam(Param => "QueueID");
118   - } else {
  121 + if ( $Self->{ParamObject}->GetParam( Param => "QueueID" ) ) {
  122 + $Data{QueueID} = $Self->{ParamObject}->GetParam( Param => "QueueID" );
  123 + }
  124 + else {
  125 +
119 126 # Check if must show queue
120   - my $_ConfigTicketWizard = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard");
121   - my $_ShowQueue = $_ConfigTicketWizard->{"ShowQueue"};
122   - if (! $_ShowQueue) {
123   - return $Self->{LayoutObject}->Redirect( OP => "Action=QueuesPanel" );
124   - }
  127 + my $_ConfigTicketWizard = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard");
  128 + my $_ShowQueue = $_ConfigTicketWizard->{"ShowQueue"};
  129 + if ( !$_ShowQueue ) {
  130 + return $Self->{LayoutObject}->Redirect( OP => "Action=QueuesPanel" );
  131 + }
125 132 }
126 133  
127 134 if ( $Self->{ParamObject}->GetParam( Param => "Subaction" ) eq "GetServices" ) {
... ... @@ -141,17 +148,15 @@ sub Run {
141 148  
142 149 $Self->{Config} = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard");
143 150 my $msgChooseService = $Self->{Config}->{"MessageChooseService"};
144   -
145   - if ($Self->{ParamObject}->GetParam( Param => "QueueID" ) ) {
146   - my %queueData = $Self->{QueueObject}->QueueGet(ID => $Self->{ParamObject}->GetParam( Param => "QueueID" ));
147   - my $queueName = $queueData{Name};
  151 +
  152 + if ( $Self->{ParamObject}->GetParam( Param => "QueueID" ) ) {
  153 + my %queueData = $Self->{QueueObject}->QueueGet( ID => $Self->{ParamObject}->GetParam( Param => "QueueID" ) );
  154 + my $queueName = $queueData{Name};
148 155 $msgChooseService =~ s/PLACE\_NAME/$queueName/g;
149 156 }
150   -
151   -
  157 +
152 158 $Data{MsgChooseService} = $msgChooseService;
153   -
154   -
  159 +
155 160 if ( $Self->{ParamObject}->GetParam( Param => "Subaction" ) ) {
156 161 if ( $Self->{ParamObject}->GetParam( Param => "Subaction" ) eq "CreateTicket" ) {
157 162 return $Self->CreateTicket();
... ... @@ -171,6 +176,27 @@ sub Run {
171 176 $Self->{LayoutObject}
172 177 ->CustomerHeader( Title => $Self->{LayoutObject}->{LanguageObject}->Get("New ticket wizard") );
173 178  
  179 + # maintenances
  180 + my @maintenances = $Self->{MaintenanceObject}->ListCurrentMaintenances();
  181 +
  182 + if (@maintenances) {
  183 + $Self->{LayoutObject}->Block( Name => 'MaintenancesPanel', );
  184 +
  185 + for my $maintenanceHash (@maintenances) {
  186 + my %maintenance = %{$maintenanceHash};
  187 +
  188 + $Self->{LayoutObject}->Block(
  189 + Name => 'MaintenanceLine',
  190 + Data => {
  191 + Message => $maintenance{'Description'},
  192 + StartDate => $Self->{DateUtilsObject}->BrazilianDate(
  193 + Timestamp => $Self->{DateUtilsObject}->FromSQL( StringDate => $maintenance{StartDate} )
  194 + ),
  195 + }
  196 + );
  197 + }
  198 + }
  199 +
174 200 $Output .= $Self->{LayoutObject}->CustomerNavigationBar();
175 201 $Output .= $Self->{LayoutObject}->Output(
176 202 Data => \%Data,
... ... @@ -190,16 +216,13 @@ sub BuildQueue {
190 216 my $ConfigTicketWizard = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard");
191 217 my $ShowQueue = $ConfigTicketWizard->{"ShowQueue"};
192 218 my $BaseQueueName = "";
193   - my $BaseQueueID = $Self->{ParamObject}->GetParam(Param => "BaseQueueID");
194   -
195   -
196   -
  219 + my $BaseQueueID = $Self->{ParamObject}->GetParam( Param => "BaseQueueID" );
  220 +
197 221 if ( !$ShowQueue eq '1' ) {
198 222 return;
199 223 }
200 224 elsif ($BaseQueueID) {
201   -
202   -
  225 +
203 226 my %QueueBase = $Self->{QueueObject}->QueueGet( ID => $BaseQueueID );
204 227 $BaseQueueName = $QueueBase{"Name"};
205 228  
... ... @@ -216,18 +239,19 @@ sub BuildQueue {
216 239 }
217 240  
218 241 @QueueCombo = sort { $a->{Value} . "::" cmp $b->{Value} . "::" } @QueueCombo;
219   - } elsif ($Self->{ParamObject}->GetParam(Param => "QueueID")){
220   -
221   - my %Queue = $Self->{QueueObject}->QueueGet( ID => $Self->{ParamObject}->GetParam(Param => "QueueID") );
  242 + }
  243 + elsif ( $Self->{ParamObject}->GetParam( Param => "QueueID" ) ) {
  244 +
  245 + my %Queue = $Self->{QueueObject}->QueueGet( ID => $Self->{ParamObject}->GetParam( Param => "QueueID" ) );
222 246 my $QueueName = $Queue{"Name"};
223   -
224   - my @QueueParts = split("::", $QueueName);
225   - splice(@QueueParts, -1);
226   - $BaseQueueName = join("::", @QueueParts);
  247 +
  248 + my @QueueParts = split( "::", $QueueName );
  249 + splice( @QueueParts, -1 );
  250 + $BaseQueueName = join( "::", @QueueParts );
227 251 $Self->Debug($BaseQueueName);
228   - my %QueueBase = $Self->{QueueObject}->QueueGet( Name => $BaseQueueName );
229   - my $BaseQueueID = $QueueBase{"ID"};
230   -
  252 + my %QueueBase = $Self->{QueueObject}->QueueGet( Name => $BaseQueueName );
  253 + my $BaseQueueID = $QueueBase{"ID"};
  254 +
231 255 my %Queues = $Self->{QueueObject}->QueueList( Valid => 1 );
232 256  
233 257 for my $queueID ( keys %Queues ) {
... ... @@ -241,12 +265,12 @@ sub BuildQueue {
241 265 }
242 266  
243 267 @QueueCombo = sort { $a->{Value} . "::" cmp $b->{Value} . "::" } @QueueCombo;
244   -
  268 +
245 269 }
246 270 $Data{QueueStrg} = $Self->{LayoutObject}->BuildSelection(
247 271 Data => \@QueueCombo,
248 272 Name => 'QueueID',
249   - SelectedID => $Self->{ParamObject}->GetParam(Param => "QueueID"),
  273 + SelectedID => $Self->{ParamObject}->GetParam( Param => "QueueID" ),
250 274 Class => "Validate_Required " . ( $Param{Errors}->{QueueIDInvalid} || '' ),
251 275 PossibleNone => 1,
252 276 TreeView => 1,
... ... @@ -270,8 +294,8 @@ sub GetFormJSON {
270 294 %serviceForm = $Self->{ServiceFormObject}->GetServiceForm( ServiceID => $Param{ServiceID} );
271 295 }
272 296  
273   - my $QueueID = $Self->{ParamObject}->GetParam(Param => "QueueID");
274   -
  297 + my $QueueID = $Self->{ParamObject}->GetParam( Param => "QueueID" );
  298 +
275 299 my ( $schema, $fields, $introduction ) = $Self->GetForm( ServiceForm => \%serviceForm, QueueID => $QueueID );
276 300  
277 301 print STDERR "[{" . $schema . "}, {" . $fields . "}, \"" . $introduction . "\"]";
... ... @@ -318,11 +342,11 @@ sub GetForm {
318 342 $fields =~ s/CF_FORM/$fieldsForm/g;
319 343 }
320 344 }
321   -
322   - if ($Param{"QueueID"}) {
  345 +
  346 + if ( $Param{"QueueID"} ) {
323 347 $schema = $schema . ",\n\"QueueID\": {\n\"type\": \"string\",\n\"default\": \"" . $Param{"QueueID"} . "\"}";
324 348 $fields = $fields . ",\n\"QueueID\": {\n\"type\": \"hidden\"\n}";
325   - print STDERR "schema = \n\n" . $schema . "\n\n fields = \n\n" . $fields;
  349 + print STDERR "schema = \n\n" . $schema . "\n\n fields = \n\n" . $fields;
326 350  
327 351 }
328 352  
... ... @@ -331,17 +355,17 @@ sub GetForm {
331 355  
332 356 sub GetQueueID() {
333 357 my ( $Self, %Param ) = @_;
334   -
  358 +
335 359 # Check if queueID was sent
336   - my $QueueID = $Self->{ParamObject}->GetParam(Param => "QueueID");
  360 + my $QueueID = $Self->{ParamObject}->GetParam( Param => "QueueID" );
337 361 print STDERR "\n\nBSUCANDO $QueueID FILA\n\n";
338   -
  362 +
339 363 if ($QueueID) {
340 364 print STDERR "\n\nRecebida fila $QueueID\n\n";
341   - my %Queue = $Self->{QueueObject}->QueueGet(ID => $QueueID);
342   - return ($Queue{"Name"}, $QueueID);
  365 + my %Queue = $Self->{QueueObject}->QueueGet( ID => $QueueID );
  366 + return ( $Queue{"Name"}, $QueueID );
343 367 }
344   -
  368 +
345 369 # Gets default Queue
346 370 my $ConfigTicket = $Self->{ConfigObject}->Get("Ticket::Frontend::CustomerTicketMessage");
347 371 my $ConfigTicketWizard = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard");
... ... @@ -357,8 +381,8 @@ sub GetQueueID() {
357 381  
358 382 my %QueueListID = $Self->{QueueObject}->QueueList( Valid => 1 );
359 383 my %QueueList = reverse $Self->{QueueObject}->QueueList( Valid => 1 );
360   - $QueueID = $QueueList{$QueueDefault};
361   - my $Queue = $QueueListID{$QueueID};
  384 + $QueueID = $QueueList{$QueueDefault};
  385 + my $Queue = $QueueListID{$QueueID};
362 386  
363 387 if ( $QueuePrefix && $QueueField ) {
364 388 my $QueueSelected = $Self->{ParamObject}->GetParam( Param => $QueueField );
... ... @@ -489,5 +513,4 @@ sub Debug {
489 513 print STDERR "\n\nDEBUG => \n$msg\n\n";
490 514 }
491 515  
492   -
493 516 1;
... ...
Kernel/Modules/NewTicketWizardPublic.pm
... ... @@ -11,6 +11,7 @@ package Kernel::Modules::NewTicketWizardPublic;
11 11 use strict;
12 12 use warnings;
13 13  
  14 +use Kernel::System::DateUtils;
14 15 use Kernel::System::ServiceForm;
15 16 use Kernel::System::TicketWizard;
16 17 use Kernel::System::CustomerUser;
... ... @@ -23,6 +24,8 @@ use Kernel::System::DynamicField::Backend;
23 24 require Kernel::System::QueueService;
24 25 use Kernel::System::VariableCheck qw(:all);
25 26 use Data::Dumper;
  27 +use Kernel::System::Maintenance;
  28 +use Kernel::System::DateUtils;
26 29  
27 30 sub new {
28 31 my ( $Type, %Param ) = @_;
... ... @@ -57,6 +60,8 @@ sub new {
57 60 $Self->{ServiceFormObject} = Kernel::System::ServiceForm->new(%Param);
58 61 $Self->{ServiceObject} = Kernel::System::Service->new(%Param);
59 62 $Self->{QueueServiceObject} = Kernel::System::QueueService->new(%Param);
  63 + $Self->{MaintenanceObject} = Kernel::System::Maintenance->new(%Param);
  64 + $Self->{DateUtilsObject} = Kernel::System::DateUtils->new(%Param);
60 65  
61 66 return $Self;
62 67 }
... ... @@ -159,6 +164,27 @@ sub Run {
159 164 my $Output =
160 165 $Self->{LayoutObject}
161 166 ->CustomerHeader( Title => $Self->{LayoutObject}->{LanguageObject}->Get("New ticket wizard") );
  167 +
  168 + # maintenances
  169 + my @maintenances = $Self->{MaintenanceObject}->ListCurrentMaintenances();
  170 +
  171 + if (@maintenances) {
  172 + $Self->{LayoutObject}->Block(
  173 + Name => 'MaintenancesPanel',
  174 + );
  175 +
  176 + for my $maintenanceHash (@maintenances) {
  177 + my %maintenance = %{$maintenanceHash};
  178 +
  179 + $Self->{LayoutObject}->Block(
  180 + Name => 'MaintenanceLine',
  181 + Data => {
  182 + Message => $maintenance{'Description'},
  183 + StartDate => $Self->{DateUtilsObject}->BrazilianDate(Timestamp => $Self->{DateUtilsObject}->FromSQL(StringDate => $maintenance{StartDate})),
  184 + });
  185 + }
  186 + }
  187 +
162 188  
163 189 $Output .= $Self->{LayoutObject}->Output(
164 190 Data => \%Data,
... ...
Kernel/Output/HTML/Standard/NewTicketWizard.dtl
... ... @@ -32,7 +32,20 @@ $Data{"MsgChooseService"}
32 32 <div id="serviceDescription" style="margin: 5px; padding: 10px; width: 80%; border-style:solid; border-width: 1px; display: none"></div>
33 33 </div>
34 34 </div>
35   -<div id="formTicket" style="padding-left: 15px; "></div>
  35 +<div id="formTicket" style="padding-left: 15px; ">
  36 +
  37 +<!-- dtl:block:MaintenancesPanel -->
  38 +<span style="font-weight: bold; color: red">$Text{"The following maintenances are in progress"}</span>
  39 +<br/>
  40 +<br/>
  41 +<ol style="margin-left: 20px; padding: 10px; list-style-type:circle">
  42 +<!-- dtl:block:MaintenanceLine -->
  43 +<li>$Data{"Message"} ($Text{"Started at: "} $Data{"StartDate"})</li>
  44 +<!-- dtl:block:MaintenanceLine -->
  45 +</ol>
  46 +<!-- dtl:block:MaintenancesPanel -->
  47 +
  48 +</div>
36 49  
37 50 <!-- dtl:js_on_document_complete -->
38 51 <script type="text/javascript">
... ...
Kernel/Output/HTML/Standard/NewTicketWizardPublic.dtl
... ... @@ -21,7 +21,20 @@ $Data{&quot;MsgChooseService&quot;}
21 21 <div id="serviceDescription" style="margin: 5px; padding: 10px; width: 80%; border-style:solid; border-width: 1px; display: none"></div>
22 22 </div>
23 23 </div>
24   -<div id="formTicket" style="padding-left: 15px; "></div>
  24 +<div id="formTicket" style="padding-left: 15px; ">
  25 +
  26 +<!-- dtl:block:MaintenancesPanel -->
  27 +<span style="font-weight: bold; color: red">$Text{"The following maintenances are in progress"}</span>
  28 +<br/>
  29 +<br/>
  30 +<ol style="margin-left: 20px; padding: 10px; list-style-type:circle">
  31 +<!-- dtl:block:MaintenanceLine -->
  32 +<li>$Data{"Message"} ($Text{"Started at: "} $Data{"StartDate"})</li>
  33 +<!-- dtl:block:MaintenanceLine -->
  34 +</ol>
  35 +<!-- dtl:block:MaintenancesPanel -->
  36 +
  37 +</div>
25 38  
26 39 <!-- dtl:js_on_document_complete -->
27 40 <script type="text/javascript">
... ...
NewTicketWizard.sopm
1 1 <?xml version="1.0" encoding="utf-8" ?>
2 2 <otrs_package version="1.0">
3 3 <Name>NewTicketWizard</Name>
4   - <Version>1.2.8</Version>
  4 + <Version>1.2.9</Version>
5 5 <Framework>3.x.x</Framework>
6 6 <Vendor>SeTIC</Vendor>
7 7 <URL>http://www.setic.ufsc.br</URL>
... ... @@ -17,6 +17,7 @@
17 17 Versão 1.1.3 - Link para abrir segundo chamado na tela de finalização da abertura
18 18 Versão 1.1.4 - Aumento na fonte do botao de enviar
19 19 Versão 1.2.6 - Painel de navegação de filas
  20 + Versão 1.2.9 - Publicacao de manutencoes em progresso
20 21  
21 22 </Description>
22 23 <IntroInstall Type="post" Lang="pt-br" Title="Obrigado">Módulo instalado com sucesso!</IntroInstall>
... ...