[otrs-cvs] otrs/Kernel/Modules AgentTicketProcess.pm,1.47,1.48
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/otrs/Kernel/Modules
In directory lancelot:/tmp/cvs-serv22157/Kernel/Modules
Modified Files:
AgentTicketProcess.pm
Log Message:
- 2013-02-15 Fixed bug#9164 - ProcessManagement: Default values of assigned hidden activity dialogs not considered.
Author: cr
Index: AgentTicketProcess.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AgentTicketProcess.pm,v
retrieving revision 1.47
retrieving revision 1.48
diff -2 -u -d -r1.47 -r1.48
--- AgentTicketProcess.pm 15 Feb 2013 03:41:12 -0000 1.47
+++ AgentTicketProcess.pm 15 Feb 2013 17:10:33 -0000 1.48
@@ -3889,4 +3889,9 @@
if ( !$TicketParam{ $Self->{NameToID}->{$Needed} } ) {
+
+ # if a required field has no value call _CheckField as filed is hidden
+ # (No Display param = Display => 0) and no DefaultValue, to use global default as
+ # fallback. One reason for this to happen is that ActivityDialog DefaultValue tried
+ # to set before, was not valid.
my $Result = $Self->_CheckField(
Field => $Self->{NameToID}->{$Needed},
@@ -3907,5 +3912,9 @@
$TicketParam{UserID} = $Self->{UserID};
- $TicketParam{OwnerID} = $Param{GetParam}{OwnerID} || 1;
+
+ if ( !$TicketParam{OwnerID} ) {
+
+ $TicketParam{OwnerID} = $Param{GetParam}{OwnerID} || 1;
+ }
# if StartActivityDialog does not provide a ticket title set a default value
@@ -4417,16 +4426,32 @@
=item _CheckField()
-checks all the possible ticket fields (required, correct value...) and
-returns the ID (if possible) value of the field, if valid and checks are successfull
+checks all the possible ticket fields and returns the ID (if possible) value of the field, if valid
+and checks are successfull
+
+if Display param is set to 0 or not given, it uses ActivityDialog field default value for all fields
+or global default value as fallback only for certain fields
+
+if Display param is set to 1 or 2 it uses the value from the web request
my $PriorityID = $AgentTicketProcessObject->_CheckField(
- Priority => '3 normal',
+ Field => 'PriorityID',
+ Display => 1, # optional, 0 or 1 or 2
+ DefaultValue => '3 normal', # ActivityDialog field default value (it uses global
+ # default value as fall back for mandatory fields
+ # (Queue, Sate, Lock and Priority)
);
- $Priority = 1;
+
+Returns:
+ $PriorityID = 1; # if PriorityID is set to 1 in the web request
my $PriorityID = $AgentTicketProcessObject->_CheckField(
- Priority => 'unknownpriority1234',
+ Field => 'PriorityID',
+ Display => 0,
+ DefaultValue => '3 normal',
);
- $PriorityID = undef;
+
+Returns:
+ $PriorityID = 3; # since ActivityDialog default value is '3 normal' and
+ # field is hidden
=cut
@@ -4453,10 +4478,10 @@
if ( !$Param{Display} ) {
- # Check if a DefaultValue ist given
+ # Check if a DefaultValue is given
if ( $Param{DefaultValue} ) {
# check if the given field param is valid
$Value = $Self->_LookupValue(
- Field => $Param{Field},
+ Field => $FieldWithoutID,
Value => $Param{DefaultValue},
);
@@ -4529,5 +4554,4 @@
}
else {
-
$Value = $Self->_LookupValue(
Field => $Param{Field},
@@ -4596,11 +4620,26 @@
my $FunctionName;
- # sadly we need an exception for Owner(ID) and Responsible(ID), because the Ticket*Set subs
- # need NewUserID as param
- if ( scalar grep { $Self->{NameToID}{ $Param{Field} } eq $_ } qw( OwnerID ResponsibleID ) ) {
+ # owner(ID) and responsible(ID) lookup needs UserID as parameter
+ if ( scalar grep { $Param{Field} eq $_ } qw( OwnerID ResponsibleID ) ) {
$LookupFieldName = 'UserID';
$ObjectName = 'UserObject';
$FunctionName = 'UserLookup';
}
+
+ # owner and responsible lookup needs UserLogin as parameter
+ elsif ( scalar grep { $Param{Field} eq $_ } qw( Owner Responsible ) ) {
+ $LookupFieldName = 'UserLogin';
+ $ObjectName = 'UserObject';
+ $FunctionName = 'UserLookup';
+ }
+
+ # service and SLA lookup needs Name as parameter (While ServiceID an SLAID uses standard)
+ elsif ( scalar grep { $Param{Field} eq $_ } qw( Service SLA ) ) {
+ $LookupFieldName = 'Name';
+ $ObjectName = $FieldWithoutID . 'Object';
+ $FunctionName = $FieldWithoutID . 'Lookup';
+ }
+
+ # other fields can use standard parameter names as Priority or PriorityID
else {
$LookupFieldName = $Param{Field};
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log