Response modify with state but not seen

English! place to talk about development, programming and coding
Post Reply
arktik
Znuny newbie
Posts: 54
Joined: 29 Jul 2010, 11:24
Znuny Version: 3.3.4

Response modify with state but not seen

Post by arktik »

Hi @all,

I will add the state to the response. At the moment, I have add the ticket_state_id field to the datatabase table and the output in the overview Table from response.
What I will is, that I can only save one state to one response.


My problem at the moment is, that I don't see the state namens in the DropDown Box from the state table.
I have used the following developer link for help http://dev.otrs.org/3.0/Kernel/System/State.html, but I don't know who is my fail.

Here are the code snippes:

AdminResponse.pm

Code: Select all

$Self->{StateObject}	    = Kernel::System::State->new(%Param);   //add the State classes to the Response

[i]#add after: SelectedAttachments => \@SelectedAttachment,[/i]
SelectedState => \@SelectedState,

#Erweiterung Antworten start
    my %StatusData = $Self->{StateObject}->StateTypeList();
	
    $Param{StatusOption} = $Self->{LayoutObject}->BuildSelection(
        Data         => \%StatusData,
        Name	     => 'State',
        SelectedID   => $Param{Name},
    );
#Erweiterung Antworten ende
AdminResponse.dtl

Code: Select all

<label for="IDs">$Text{"Status"}:</label>
<div class="Field">$Data{"StatusOption"}</div>
In the Attachment you can see what I mean with no result of states in the DropDown Box
You do not have the required permissions to view the files attached to this post.
OTRS 3.3.4 Produktiv
OTRS 3.3.4 Dev und Test
renee
Znuny expert
Posts: 241
Joined: 06 Feb 2009, 11:15
Znuny Version: 3.0.x
Company: Perl-Services.de
Contact:

Re: Response modify with state but not seen

Post by renee »

If you want a dropdown that shows the States, you should use StateList() instead of StateTypeList(). And if you look at the logfile, you'll see 'Need UserID' messages as StateTypeList() requires a value for UserID:

Code: Select all

$Self->{StateObject}->StateTypeList( UserID => 1 ); 
The StateList() method needs this parameter, too.
Need a Perl/OTRS developer? You can contact me at info@perl-services.de
arktik
Znuny newbie
Posts: 54
Joined: 29 Jul 2010, 11:24
Znuny Version: 3.3.4

Re: Response modify with state but not seen

Post by arktik »

Thanks renee, at the moment in the response overview I see my defined states dynamic from the database.

But when I edit one of the response in this template definition, I see the name "Status" but no dropdown or any other value. I have used the StateList method for that, but now there are many errors in the log of the Apache.

Okay I see 'Need User ID' but I set it as follow:

Code: Select all

my %StatusList = $Self->{StateObject}->StateList();
$Param{StatusOption} = $Self->{LayoutObject}->BuildSelection(
Data          => \%StatusList,
UserID       => 1,
Name        => 'StateID',
SelectedID => $Param{StateID},
);
I now from the error log that I need the parameter Name and UserID. What I set for the parameter UserID for test is,

Code: Select all

UserID     => $Self->{UserID},  #parameter set for overview
UserID     => 1, # set in edit
But I see always the error 'Need UserID'. Why?
OTRS 3.3.4 Produktiv
OTRS 3.3.4 Dev und Test
renee
Znuny expert
Posts: 241
Joined: 06 Feb 2009, 11:15
Znuny Version: 3.0.x
Company: Perl-Services.de
Contact:

Re: Response modify with state but not seen

Post by renee »

It's a mandatory parameter to StateList() *not* BuildSelection().
Need a Perl/OTRS developer? You can contact me at info@perl-services.de
arktik
Znuny newbie
Posts: 54
Joined: 29 Jul 2010, 11:24
Znuny Version: 3.3.4

Re: Response modify with state but not seen

Post by arktik »

Sorry renee, I don't know why I always see the state ID but no dropdown.

Thats my code:

Code: Select all

	 my %StatusList = $Self->{StateObject}->StateList( UserID => $Self->{UserID} );
	 my %StatusListReverse = reverse %StatusList;
    $Param{StatusOption} = $Self->{LayoutObject}->BuildSelection(
         Data         => \%StatusList,
		 Name		  => 'StateID',
  	     SelectedID   => $Param{StateID} || $StatusListReverse{StateID},
    );
and what I see if I edit a respone is the ID.

I think the BuildSelection creates a dropdown box, because this is used by the attachment and by the Valid dropdown.
OTRS 3.3.4 Produktiv
OTRS 3.3.4 Dev und Test
renee
Znuny expert
Posts: 241
Joined: 06 Feb 2009, 11:15
Znuny Version: 3.0.x
Company: Perl-Services.de
Contact:

Re: Response modify with state but not seen

Post by renee »

Can you show a screenshot?
Need a Perl/OTRS developer? You can contact me at info@perl-services.de
arktik
Znuny newbie
Posts: 54
Joined: 29 Jul 2010, 11:24
Znuny Version: 3.3.4

Re: Response modify with state but not seen

Post by arktik »

Sorry renee that was my false. If I use the wrong variable so the output could not show a dropdown.

But at the moment I have an Problem what I don't know.

I see the state dropdown with the correct state by an edit. But if I will save a change in the body text for the response there come the erro need Response

Code: Select all

ERROR: OTRS-CGI-10 Perl: 5.10.1 OS: linux Time: Wed Aug  3 06:13:57 2011

 Message: Need Response!

 Traceback (6915): 
   Module: Kernel::System::StandardResponse::StandardResponseUpdate (v1.1.2.1) Line: 264
   Module: Kernel::Modules::AdminResponse::Run (v1.52) Line: 127
   Module: Kernel::System::Web::InterfaceAgent::Run (v1.58.2.1) Line: 853
   Module: ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_index_2epl::handler (unknown version) Line: 46
   Module: (eval) (v1.89.2.1) Line: 204
   Module: ModPerl::RegistryCooker::run (v1.89.2.1) Line: 204
   Module: ModPerl::RegistryCooker::default_handler (v1.89.2.1) Line: 170
   Module: ModPerl::Registry::handler (v1.99) Line: 31
I don't know what the programm will, because I have never set in the if that the State must be set.
And if that error comes, the standard text for the answer is cleared.
You do not have the required permissions to view the files attached to this post.
OTRS 3.3.4 Produktiv
OTRS 3.3.4 Dev und Test
renee
Znuny expert
Posts: 241
Joined: 06 Feb 2009, 11:15
Znuny Version: 3.0.x
Company: Perl-Services.de
Contact:

Re: Response modify with state but not seen

Post by renee »

In Line 106 of AdminResponse.pm you changed the code from

Code: Select all

        for my $Parameter (qw(ID Name Comment ValidID Response)) {
to

Code: Select all

        for my $Parameter (qw(ID Name Comment ValidID Response, StateID)) {
The comma after Response should be removed!
Need a Perl/OTRS developer? You can contact me at info@perl-services.de
arktik
Znuny newbie
Posts: 54
Joined: 29 Jul 2010, 11:24
Znuny Version: 3.3.4

Re: Response modify with state but not seen

Post by arktik »

Hi renee,

thank u very much. I haven't seen this comma. After I delete it it works at time. I also add it to the create option for an response.

So my way now is to find a way on wich I can give this state from the response to the AgentTicketCompose. After that I think this should work perfekt.

I must say the dev documentation helps me a lot and of course the forum and you.
OTRS 3.3.4 Produktiv
OTRS 3.3.4 Dev und Test
arktik
Znuny newbie
Posts: 54
Joined: 29 Jul 2010, 11:24
Znuny Version: 3.3.4

Re: Response modify with state but not seen

Post by arktik »

Hi @all,

I have completed the Modifcation to set the state for a response and select this in the reply respone from a ticket.

Okay in the error.log from the Apache I see these errors

Code: Select all

[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine new redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 73.
[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine StandardResponseAdd redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 108.
[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine StandardResponseGet redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 167.
[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine StandardResponseDelete redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 213.
[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine StandardResponseUpdate redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 258.
[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine StandardResponseLookup redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 300.
[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine StandardResponseList redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 365.
[Thu Aug  4 01:27:36 2011] AgentTicketCompose.pm: Subroutine new redefined at /opt/otrs//Kernel/Modules/AgentTicketCompose.pm line 30.
[Thu Aug  4 01:27:36 2011] AgentTicketCompose.pm: Subroutine Run redefined at /opt/otrs//Kernel/Modules/AgentTicketCompose.pm line 68.
[Thu Aug  4 01:27:36 2011] AgentTicketCompose.pm: Subroutine _GetNextStates redefined at /opt/otrs//Kernel/Modules/AgentTicketCompose.pm line 1159.
[Thu Aug  4 01:27:36 2011] AgentTicketCompose.pm: Subroutine _Mask redefined at /opt/otrs//Kernel/Modules/AgentTicketCompose.pm line 1171.
[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine new redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 73.
[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine StandardResponseAdd redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 108.
[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine StandardResponseGet redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 167.
[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine StandardResponseDelete redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 213.
[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine StandardResponseUpdate redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 258.
[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine StandardResponseLookup redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 300.
[Thu Aug  4 01:27:36 2011] StandardResponse.pm: Subroutine StandardResponseList redefined at /opt/otrs//Kernel/System/StandardResponse.pm line 365.
but I think I have forgotten something or on the wrong place.
OTRS 3.3.4 Produktiv
OTRS 3.3.4 Dev und Test
renee
Znuny expert
Posts: 241
Joined: 06 Feb 2009, 11:15
Znuny Version: 3.0.x
Company: Perl-Services.de
Contact:

Re: Response modify with state but not seen

Post by renee »

That's not really an error. It seems that your webserver has both the old code and the new code in memory... A webserver restart should help.
Need a Perl/OTRS developer? You can contact me at info@perl-services.de
arktik
Znuny newbie
Posts: 54
Joined: 29 Jul 2010, 11:24
Znuny Version: 3.3.4

Re: Response modify with state but not seen

Post by arktik »

Thanks rene, I have reboot the system an the erros never come.

I Pack my changes for the Response state and upload it to the Patches and Modules so that other people can use it.
OTRS 3.3.4 Produktiv
OTRS 3.3.4 Dev und Test
renee
Znuny expert
Posts: 241
Joined: 06 Feb 2009, 11:15
Znuny Version: 3.0.x
Company: Perl-Services.de
Contact:

Re: Response modify with state but not seen

Post by renee »

If you could create an OPM file you could also upload it to OPAR (http://opar.perl-services.de). If you need help to create such an OPM file, don't hesitate to ask me...
Need a Perl/OTRS developer? You can contact me at info@perl-services.de
arktik
Znuny newbie
Posts: 54
Joined: 29 Jul 2010, 11:24
Znuny Version: 3.3.4

Re: Response modify with state but not seen

Post by arktik »

Hi rene,

I don't know how I create an OPM file. could you please help me or give me an faq how I create this.
Because my option is an diff file with the line and code for installation. I know this from the phpbb forum to install mods or Patches to the phpBB3.
OTRS 3.3.4 Produktiv
OTRS 3.3.4 Dev und Test
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Response modify with state but not seen

Post by jojo »

You'll find some description for package building here: http://doc.otrs.org/developer/2.4/en/html/ch15.html

(Don't mind that it is in 2.4 docu as it works also in newer versions)
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
Post Reply