Commit 9b79ed02cc560a2ed9d31b8d390658b0164535e9
Exists in
master
Ajustes para trabalhar em modo sem queuepanel
Showing
6 changed files
with
26 additions
and
98 deletions
Show diff stats
Kernel/Config/Files/NewTicketWizard.xml
@@ -434,9 +434,9 @@ | @@ -434,9 +434,9 @@ | ||
434 | 434 | ||
435 | <ConfigItem Name="Ticket::Frontend::Customer::NewTicketWizard###ShowQueue" | 435 | <ConfigItem Name="Ticket::Frontend::Customer::NewTicketWizard###ShowQueue" |
436 | Required="0" Valid="1"> | 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 | <Description Lang="pt_BR"> | 438 | <Description Lang="pt_BR"> |
439 | - Exibe o campo fila se verdadeiro | 439 | + Quando falso, a fila deve ter sido selecionada antes (parametro) |
440 | </Description> | 440 | </Description> |
441 | <Group>Ticket</Group> | 441 | <Group>Ticket</Group> |
442 | <SubGroup>Frontend::Customer::NewTicketWizard</SubGroup> | 442 | <SubGroup>Frontend::Customer::NewTicketWizard</SubGroup> |
Kernel/Modules/NewTicketWizard.pm
@@ -127,6 +127,7 @@ sub Run { | @@ -127,6 +127,7 @@ sub Run { | ||
127 | my $_ConfigTicketWizard = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard"); | 127 | my $_ConfigTicketWizard = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard"); |
128 | my $_ShowQueue = $_ConfigTicketWizard->{"ShowQueue"}; | 128 | my $_ShowQueue = $_ConfigTicketWizard->{"ShowQueue"}; |
129 | if ( !$_ShowQueue ) { | 129 | if ( !$_ShowQueue ) { |
130 | + $Self->Debug("Sem fila e show queue != 1"); | ||
130 | return $Self->{LayoutObject}->Redirect( OP => "Action=QueuesPanel" ); | 131 | return $Self->{LayoutObject}->Redirect( OP => "Action=QueuesPanel" ); |
131 | } | 132 | } |
132 | } | 133 | } |
@@ -144,7 +145,6 @@ sub Run { | @@ -144,7 +145,6 @@ sub Run { | ||
144 | 145 | ||
145 | # Build service chooser | 146 | # Build service chooser |
146 | $Data{ServiceStrg} = $Self->BuildServices(); | 147 | $Data{ServiceStrg} = $Self->BuildServices(); |
147 | - $Self->BuildQueue( Data => \%Data ); | ||
148 | 148 | ||
149 | $Self->{Config} = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard"); | 149 | $Self->{Config} = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard"); |
150 | my $msgChooseService = $Self->{Config}->{"MessageChooseService"}; | 150 | my $msgChooseService = $Self->{Config}->{"MessageChooseService"}; |
@@ -207,85 +207,6 @@ sub Run { | @@ -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 | sub GetFormJSON { | 210 | sub GetFormJSON { |
290 | my ( $Self, %Param ) = @_; | 211 | my ( $Self, %Param ) = @_; |
291 | my %serviceForm; | 212 | my %serviceForm; |
@@ -406,6 +327,10 @@ sub CreateTicket { | @@ -406,6 +327,10 @@ sub CreateTicket { | ||
406 | my %Data = (); | 327 | my %Data = (); |
407 | 328 | ||
408 | # Queue | 329 | # Queue |
330 | + my $queueFixed = 0; | ||
331 | + if ($Data{QueueID}) { | ||
332 | + $queueFixed = 1; | ||
333 | + } | ||
409 | my ( $Queue, $QueueID ) = $Self->GetQueueID(%Param); | 334 | my ( $Queue, $QueueID ) = $Self->GetQueueID(%Param); |
410 | $Data{QueueID} = $QueueID; | 335 | $Data{QueueID} = $QueueID; |
411 | 336 | ||
@@ -495,6 +420,9 @@ sub CreateTicket { | @@ -495,6 +420,9 @@ sub CreateTicket { | ||
495 | $Data{TicketNumber} = $Self->{TicketObject}->TicketNumberLookup( TicketID => $TicketID ); | 420 | $Data{TicketNumber} = $Self->{TicketObject}->TicketNumberLookup( TicketID => $TicketID ); |
496 | 421 | ||
497 | # build output | 422 | # build output |
423 | + if (! $queueFixed) { | ||
424 | + delete $Data{QueueID} | ||
425 | + } | ||
498 | my $Output = $Self->{LayoutObject}->CustomerHeader( Title => "Ticket created" ); | 426 | my $Output = $Self->{LayoutObject}->CustomerHeader( Title => "Ticket created" ); |
499 | $Output .= $Self->{LayoutObject}->CustomerNavigationBar(); | 427 | $Output .= $Self->{LayoutObject}->CustomerNavigationBar(); |
500 | $Output .= $Self->{LayoutObject}->Output( | 428 | $Output .= $Self->{LayoutObject}->Output( |
@@ -510,7 +438,7 @@ sub Debug { | @@ -510,7 +438,7 @@ sub Debug { | ||
510 | my $Self = shift; | 438 | my $Self = shift; |
511 | my $msg = shift; | 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 | 1; | 444 | 1; |
Kernel/Modules/NewTicketWizardPublic.pm
@@ -288,18 +288,20 @@ sub GetQueueID() { | @@ -288,18 +288,20 @@ sub GetQueueID() { | ||
288 | 288 | ||
289 | my %QueueListID = $Self->{QueueObject}->QueueList( Valid => 1 ); | 289 | my %QueueListID = $Self->{QueueObject}->QueueList( Valid => 1 ); |
290 | my %QueueList = reverse $Self->{QueueObject}->QueueList( Valid => 1 ); | 290 | my %QueueList = reverse $Self->{QueueObject}->QueueList( Valid => 1 ); |
291 | - my $QueueID = $QueueList{$QueueDefault}; | 291 | + $QueueID = $QueueList{$QueueDefault}; |
292 | my $Queue = $QueueListID{$QueueID}; | 292 | my $Queue = $QueueListID{$QueueID}; |
293 | 293 | ||
294 | + ### $Self->Debug(Dumper(\%QueueList)); | ||
295 | + | ||
294 | if ( $QueuePrefix && $QueueField ) { | 296 | if ( $QueuePrefix && $QueueField ) { |
295 | my $QueueSelected = $Self->{ParamObject}->GetParam( Param => $QueueField ); | 297 | my $QueueSelected = $Self->{ParamObject}->GetParam( Param => $QueueField ); |
296 | my $QueueName = "$QueuePrefix $QueueSelected"; | 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 | if ( $QueueList{$QueueName} ) { | 301 | if ( $QueueList{$QueueName} ) { |
300 | $QueueID = $QueueList{$QueueName}; | 302 | $QueueID = $QueueList{$QueueName}; |
301 | $Queue = $QueueName; | 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,6 +353,10 @@ sub CreateTicket { | ||
351 | my %Data = (); | 353 | my %Data = (); |
352 | 354 | ||
353 | # Queue | 355 | # Queue |
356 | + my $queueFixed = 0; | ||
357 | + if ($Data{QueueID}) { | ||
358 | + $queueFixed = 1; | ||
359 | + } | ||
354 | my ( $Queue, $QueueID ) = $Self->GetQueueID(%Param); | 360 | my ( $Queue, $QueueID ) = $Self->GetQueueID(%Param); |
355 | $Data{QueueID} = $QueueID; | 361 | $Data{QueueID} = $QueueID; |
356 | 362 | ||
@@ -441,6 +447,9 @@ sub CreateTicket { | @@ -441,6 +447,9 @@ sub CreateTicket { | ||
441 | $Data{TicketNumber} = $Self->{TicketObject}->TicketNumberLookup( TicketID => $TicketID ); | 447 | $Data{TicketNumber} = $Self->{TicketObject}->TicketNumberLookup( TicketID => $TicketID ); |
442 | 448 | ||
443 | # build output | 449 | # build output |
450 | + if (! $queueFixed) { | ||
451 | + delete $Data{QueueID} | ||
452 | + } | ||
444 | my $Output = $Self->{LayoutObject}->CustomerHeader( Title => "Ticket created" ); | 453 | my $Output = $Self->{LayoutObject}->CustomerHeader( Title => "Ticket created" ); |
445 | $Output .= $Self->{LayoutObject}->Output( | 454 | $Output .= $Self->{LayoutObject}->Output( |
446 | Data => \%Data, | 455 | Data => \%Data, |
@@ -455,7 +464,7 @@ sub Debug { | @@ -455,7 +464,7 @@ sub Debug { | ||
455 | my $Self = shift; | 464 | my $Self = shift; |
456 | my $msg = shift; | 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 | 1; | 470 | 1; |
Kernel/Output/HTML/Standard/NewTicketWizard.dtl
@@ -12,15 +12,6 @@ $Data{"MsgChooseService"} | @@ -12,15 +12,6 @@ $Data{"MsgChooseService"} | ||
12 | <div style="margin-top: 10px"> | 12 | <div style="margin-top: 10px"> |
13 | <form class="Field"> | 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 | <div class="alpaca-controlfield-label"> | 15 | <div class="alpaca-controlfield-label"> |
25 | $Text{"Service"}: | 16 | $Text{"Service"}: |
26 | </div> | 17 | </div> |
Kernel/System/TicketWizard.pm
@@ -180,7 +180,7 @@ sub ReplaceOTRSDynamicFields { | @@ -180,7 +180,7 @@ sub ReplaceOTRSDynamicFields { | ||
180 | 180 | ||
181 | sub Debug { | 181 | sub Debug { |
182 | my ( $id, $value ) = @_; | 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 | sub GetDynamicFieldValues { | 186 | sub GetDynamicFieldValues { |
NewTicketWizard.sopm
1 | <?xml version="1.0" encoding="utf-8" ?> | 1 | <?xml version="1.0" encoding="utf-8" ?> |
2 | <otrs_package version="1.0"> | 2 | <otrs_package version="1.0"> |
3 | <Name>NewTicketWizard</Name> | 3 | <Name>NewTicketWizard</Name> |
4 | - <Version>1.3.0</Version> | 4 | + <Version>1.3.3</Version> |
5 | <Framework>3.x.x</Framework> | 5 | <Framework>3.x.x</Framework> |
6 | <Vendor>SeTIC</Vendor> | 6 | <Vendor>SeTIC</Vendor> |
7 | <URL>http://www.setic.ufsc.br</URL> | 7 | <URL>http://www.setic.ufsc.br</URL> |