Commit 9b79ed02cc560a2ed9d31b8d390658b0164535e9

Authored by Rodrigo Gonçalves
2 parents 826ee3d1 fc96bff1
Exists in master

Ajustes para trabalhar em modo sem queuepanel

Kernel/Config/Files/NewTicketWizard.xml
... ... @@ -434,9 +434,9 @@
434 434  
435 435 <ConfigItem Name="Ticket::Frontend::Customer::NewTicketWizard###ShowQueue"
436 436 Required="0" Valid="1">
437   - <Description Lang="en">When specified, shows the queue field.</Description>
  437 + <Description Lang="en">When false, forces the queue to be pre-selected.</Description>
438 438 <Description Lang="pt_BR">
439   - Exibe o campo fila se verdadeiro
  439 + Quando falso, a fila deve ter sido selecionada antes (parametro)
440 440 </Description>
441 441 <Group>Ticket</Group>
442 442 <SubGroup>Frontend::Customer::NewTicketWizard</SubGroup>
... ...
Kernel/Modules/NewTicketWizard.pm
... ... @@ -127,6 +127,7 @@ sub Run {
127 127 my $_ConfigTicketWizard = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard");
128 128 my $_ShowQueue = $_ConfigTicketWizard->{"ShowQueue"};
129 129 if ( !$_ShowQueue ) {
  130 + $Self->Debug("Sem fila e show queue != 1");
130 131 return $Self->{LayoutObject}->Redirect( OP => "Action=QueuesPanel" );
131 132 }
132 133 }
... ... @@ -144,7 +145,6 @@ sub Run {
144 145  
145 146 # Build service chooser
146 147 $Data{ServiceStrg} = $Self->BuildServices();
147   - $Self->BuildQueue( Data => \%Data );
148 148  
149 149 $Self->{Config} = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard");
150 150 my $msgChooseService = $Self->{Config}->{"MessageChooseService"};
... ... @@ -207,85 +207,6 @@ sub Run {
207 207 }
208 208 }
209 209  
210   -sub BuildQueue {
211   - my ( $Self, %Param ) = @_;
212   - my %Data = ();
213   - my @QueueCombo = ();
214   -
215   - # Check if must show queue
216   - my $ConfigTicketWizard = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard");
217   - my $ShowQueue = $ConfigTicketWizard->{"ShowQueue"};
218   - my $BaseQueueName = "";
219   - my $BaseQueueID = $Self->{ParamObject}->GetParam( Param => "BaseQueueID" );
220   -
221   - if ( !$ShowQueue eq '1' ) {
222   - return;
223   - }
224   - elsif ($BaseQueueID) {
225   -
226   - my %QueueBase = $Self->{QueueObject}->QueueGet( ID => $BaseQueueID );
227   - $BaseQueueName = $QueueBase{"Name"};
228   -
229   - my %Queues = $Self->{QueueObject}->QueueList( Valid => 1 );
230   -
231   - for my $queueID ( keys %Queues ) {
232   - if ( index( $Queues{$queueID}, $BaseQueueName . "::" ) >= 0 ) {
233   - my %queue = ();
234   - $queue{Value} = $Queues{$queueID};
235   - $queue{Key} = $queueID;
236   - $queue{Disabled} = 0;
237   - push @QueueCombo, \%queue;
238   - }
239   - }
240   -
241   - @QueueCombo = sort { $a->{Value} . "::" cmp $b->{Value} . "::" } @QueueCombo;
242   - }
243   - elsif ( $Self->{ParamObject}->GetParam( Param => "QueueID" ) ) {
244   -
245   - my %Queue = $Self->{QueueObject}->QueueGet( ID => $Self->{ParamObject}->GetParam( Param => "QueueID" ) );
246   - my $QueueName = $Queue{"Name"};
247   -
248   - my @QueueParts = split( "::", $QueueName );
249   - splice( @QueueParts, -1 );
250   - $BaseQueueName = join( "::", @QueueParts );
251   - $Self->Debug($BaseQueueName);
252   - my %QueueBase = $Self->{QueueObject}->QueueGet( Name => $BaseQueueName );
253   - my $BaseQueueID = $QueueBase{"ID"};
254   -
255   - my %Queues = $Self->{QueueObject}->QueueList( Valid => 1 );
256   -
257   - for my $queueID ( keys %Queues ) {
258   - if ( index( $Queues{$queueID}, $BaseQueueName . "::" ) >= 0 ) {
259   - my %queue = ();
260   - $queue{Value} = $Queues{$queueID};
261   - $queue{Key} = $queueID;
262   - $queue{Disabled} = 0;
263   - push @QueueCombo, \%queue;
264   - }
265   - }
266   -
267   - @QueueCombo = sort { $a->{Value} . "::" cmp $b->{Value} . "::" } @QueueCombo;
268   -
269   - }
270   - $Data{QueueStrg} = $Self->{LayoutObject}->BuildSelection(
271   - Data => \@QueueCombo,
272   - Name => 'QueueID',
273   - SelectedID => $Self->{ParamObject}->GetParam( Param => "QueueID" ),
274   - Class => "Validate_Required " . ( $Param{Errors}->{QueueIDInvalid} || '' ),
275   - PossibleNone => 1,
276   - TreeView => 1,
277   - Sort => 'TreeView',
278   - Translation => 0,
279   - Max => 200
280   - );
281   -
282   - $Self->{LayoutObject}->Block(
283   - Name => 'queue',
284   - Data => {%Data}
285   - );
286   -
287   -}
288   -
289 210 sub GetFormJSON {
290 211 my ( $Self, %Param ) = @_;
291 212 my %serviceForm;
... ... @@ -406,6 +327,10 @@ sub CreateTicket {
406 327 my %Data = ();
407 328  
408 329 # Queue
  330 + my $queueFixed = 0;
  331 + if ($Data{QueueID}) {
  332 + $queueFixed = 1;
  333 + }
409 334 my ( $Queue, $QueueID ) = $Self->GetQueueID(%Param);
410 335 $Data{QueueID} = $QueueID;
411 336  
... ... @@ -495,6 +420,9 @@ sub CreateTicket {
495 420 $Data{TicketNumber} = $Self->{TicketObject}->TicketNumberLookup( TicketID => $TicketID );
496 421  
497 422 # build output
  423 + if (! $queueFixed) {
  424 + delete $Data{QueueID}
  425 + }
498 426 my $Output = $Self->{LayoutObject}->CustomerHeader( Title => "Ticket created" );
499 427 $Output .= $Self->{LayoutObject}->CustomerNavigationBar();
500 428 $Output .= $Self->{LayoutObject}->Output(
... ... @@ -510,7 +438,7 @@ sub Debug {
510 438 my $Self = shift;
511 439 my $msg = shift;
512 440  
513   - #print STDERR "\n\nDEBUG => \n$msg\n\n";
  441 + print STDERR "\n\nDEBUG => \n$msg\n\n";
514 442 }
515 443  
516 444 1;
... ...
Kernel/Modules/NewTicketWizardPublic.pm
... ... @@ -288,18 +288,20 @@ sub GetQueueID() {
288 288  
289 289 my %QueueListID = $Self->{QueueObject}->QueueList( Valid => 1 );
290 290 my %QueueList = reverse $Self->{QueueObject}->QueueList( Valid => 1 );
291   - my $QueueID = $QueueList{$QueueDefault};
  291 + $QueueID = $QueueList{$QueueDefault};
292 292 my $Queue = $QueueListID{$QueueID};
293 293  
  294 + ### $Self->Debug(Dumper(\%QueueList));
  295 +
294 296 if ( $QueuePrefix && $QueueField ) {
295 297 my $QueueSelected = $Self->{ParamObject}->GetParam( Param => $QueueField );
296 298 my $QueueName = "$QueuePrefix $QueueSelected";
297   - $Self->Debug( "Searching queue for - $QueuePrefix ($QueueField) - [$QueueName]!" );
  299 + ###$Self->Debug( "Searching queue for - $QueuePrefix ($QueueField) - [$QueueName]!" );
298 300  
299 301 if ( $QueueList{$QueueName} ) {
300 302 $QueueID = $QueueList{$QueueName};
301 303 $Queue = $QueueName;
302   - $Self->Debug( "Custom queue found - $QueueName ($QueueID)!" );
  304 + ###$Self->Debug( "Custom queue found - $QueueName ($QueueID)!" );
303 305 }
304 306  
305 307 }
... ... @@ -351,6 +353,10 @@ sub CreateTicket {
351 353 my %Data = ();
352 354  
353 355 # Queue
  356 + my $queueFixed = 0;
  357 + if ($Data{QueueID}) {
  358 + $queueFixed = 1;
  359 + }
354 360 my ( $Queue, $QueueID ) = $Self->GetQueueID(%Param);
355 361 $Data{QueueID} = $QueueID;
356 362  
... ... @@ -441,6 +447,9 @@ sub CreateTicket {
441 447 $Data{TicketNumber} = $Self->{TicketObject}->TicketNumberLookup( TicketID => $TicketID );
442 448  
443 449 # build output
  450 + if (! $queueFixed) {
  451 + delete $Data{QueueID}
  452 + }
444 453 my $Output = $Self->{LayoutObject}->CustomerHeader( Title => "Ticket created" );
445 454 $Output .= $Self->{LayoutObject}->Output(
446 455 Data => \%Data,
... ... @@ -455,7 +464,7 @@ sub Debug {
455 464 my $Self = shift;
456 465 my $msg = shift;
457 466  
458   - #print STDERR "\n\nDEBUG => \n$msg\n\n";
  467 + print STDERR "\n\nDEBUG => $msg\n";
459 468 }
460 469  
461 470 1;
... ...
Kernel/Output/HTML/Standard/NewTicketWizard.dtl
... ... @@ -12,15 +12,6 @@ $Data{&quot;MsgChooseService&quot;}
12 12 <div style="margin-top: 10px">
13 13 <form class="Field">
14 14  
15   - <!-- dtl:block:queue -->
16   - <div class="alpaca-field" >
17   - <div class="alpaca-controlfield-label">
18   - $Text{"Queue"}:
19   - </div>
20   - $Data{"QueueStrg"}
21   - </div>
22   - <!-- dtl:block:queue -->
23   -
24 15 <div class="alpaca-controlfield-label">
25 16 $Text{"Service"}:
26 17 </div>
... ...
Kernel/System/TicketWizard.pm
... ... @@ -180,7 +180,7 @@ sub ReplaceOTRSDynamicFields {
180 180  
181 181 sub Debug {
182 182 my ( $id, $value ) = @_;
183   - print STDERR "\n\n $id =" . Dumper($value) . "\n";
  183 + ###print STDERR "\n\n $id =" . Dumper($value) . "\n";
184 184 }
185 185  
186 186 sub GetDynamicFieldValues {
... ...
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.3.0</Version>
  4 + <Version>1.3.3</Version>
5 5 <Framework>3.x.x</Framework>
6 6 <Vendor>SeTIC</Vendor>
7 7 <URL>http://www.setic.ufsc.br</URL>
... ...