[SOLVED] Add new Attribute to Ticket
Moderator: crythias
[SOLVED] Add new Attribute to Ticket
Hi all,
I'm thinking about how to add a new attribute to the ticket object.
My purpose comes because our client needs to fill a field in the customer interface, customer could read/write and agent only read.
As that's not the OTRS purpose, I know it has to be done by myself and code it.
So my question is, which is the best way to achieve that?
I'm taking a look to the ticket.pm, and I think I have to code here all my entries for the new attribute (get/set). Add the column to the database. Show the field in the CustomerTicketZoom.pm, and then store it when clicking submit.
Can anyone say me if these are the right steps or if I have forgotten any of them?
Thanks a lot in advance, that's a rellay hard task for me!
I'm thinking about how to add a new attribute to the ticket object.
My purpose comes because our client needs to fill a field in the customer interface, customer could read/write and agent only read.
As that's not the OTRS purpose, I know it has to be done by myself and code it.
So my question is, which is the best way to achieve that?
I'm taking a look to the ticket.pm, and I think I have to code here all my entries for the new attribute (get/set). Add the column to the database. Show the field in the CustomerTicketZoom.pm, and then store it when clicking submit.
Can anyone say me if these are the right steps or if I have forgotten any of them?
Thanks a lot in advance, that's a rellay hard task for me!
Last edited by rafaqf on 12 Dec 2012, 14:55, edited 1 time in total.
OTRS 3.0.11 and KIX4OTRS on Linux
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Add new Attribute to Ticket
Dynamic fields would be the easy way to do this, although Dynamic fields would not be Agent ReadOnly and Customer R/W, (customer can write on submit, though) but the reverse.
Agents could be prevented (why?) from modifying the Dynamic Field via ACL.
It doesn't generally make sense for a Customer to change a *Ticket* Dynamic Field, though it might be possible via followup, or article Dynamic Field.
Agents could be prevented (why?) from modifying the Dynamic Field via ACL.
It doesn't generally make sense for a Customer to change a *Ticket* Dynamic Field, though it might be possible via followup, or article Dynamic Field.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: Add new Attribute to Ticket
Thanks a lot for your answer.crythias wrote:Dynamic fields would be the easy way to do this, although Dynamic fields would not be Agent ReadOnly and Customer R/W, (customer can write on submit, though) but the reverse.
Agents could be prevented (why?) from modifying the Dynamic Field via ACL.
It doesn't generally make sense for a Customer to change a *Ticket* Dynamic Field, though it might be possible via followup, or article Dynamic Field.
I'm using OTRS 3.0.11, is it also possible with TicketFreeText?
OTRS 3.0.11 and KIX4OTRS on Linux
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Add new Attribute to Ticket
yes.rafaqf wrote:I'm using OTRS 3.0.11, is it also possible with TicketFreeText?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: Add new Attribute to Ticket
Ok, I have created the article free text.crythias wrote:yes.
Now, how needs to be the <input> in the dtl file CustomerTicketZoom for the customer to write on it? Which parameters do I need?
I've been copying lines from the AgentTicketEmail and AgentTicketZoom so that it would show the label and the field from ArticleFreeKey and ArticleFreeText, and also to check if the submit was storing something in the database, but nothing changed and nothing's showed. I've checked also like you said that the parameter is in the request after clicking submit (it is), but I guess it doesn't contain the right parameter.
What can I be doing wrong??
I've tried something like that:
<span style="width: 270px;">
<label id="LabelArticleFreeText1">Partner Referenz ID: </label>
<input type="text" name="ArticleFreeKey1" class="ArticleFreeText" id="ArticleFreeText1" maxlength="32"></input>
</span>
Thanks a lot.
Rafa
OTRS 3.0.11 and KIX4OTRS on Linux
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Add new Attribute to Ticket
You probably have to enable the field in SysConfig for the screens you wish to show the field(s).
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: Add new Attribute to Ticket
Yes, I had the number 2 activated instead of the number 1.crythias wrote:You probably have to enable the field in SysConfig for the screens you wish to show the field(s).
I can see the value if it is inserted by the agent, but how should be now the request so that it is inserted in the database with the new value? id="ArticleFreeText"? name="a_freetext" like the column name in the data base?
Thanks a lot for your help!
OTRS 3.0.11 and KIX4OTRS on Linux
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Add new Attribute to Ticket
Then it's in the database.rafaqf wrote:I can see the value if it is inserted by the agent,
What do you want to accomplish?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: Add new Attribute to Ticket
Now I need the new value inserted by the customer to be stored in database. I'm inserting the value in the agent interface to check the value, but the agents will not insert any data, it's just me now testing.crythias wrote:Then it's in the database.rafaqf wrote:I can see the value if it is inserted by the agent,
What do you want to accomplish?
If I look the request in the browser, I see that every parameter on it has a name, like CustomerSessionID, ArticleID, FormID... So I guess that I'll need to give my input field a name or id or class so that the request gets into the action in the CustomerTicketZoom.pm and stores the new value in database, am I wrong?
Thanks.
OTRS 3.0.11 and KIX4OTRS on Linux
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Add new Attribute to Ticket
Ticket::Frontend::CustomerTicketMessage###ArticleFreeText
Add new entry
Article free text options shown in the ticket message screen of the customer interface. Possible settings: 0 = Disabled, 1 = Enabled, 2 = Enabled and required. NOTE. If you want to display these fields also in the ticket zoom of the customer interface, you have to enable them in CustomerTicketZoom###AttributesView.
Add new entry
Article free text options shown in the ticket message screen of the customer interface. Possible settings: 0 = Disabled, 1 = Enabled, 2 = Enabled and required. NOTE. If you want to display these fields also in the ticket zoom of the customer interface, you have to enable them in CustomerTicketZoom###AttributesView.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: Add new Attribute to Ticket
I've tried that, but it doesn't work for me.crythias wrote:Ticket::Frontend::CustomerTicketMessage###ArticleFreeText
Add new entry
Article free text options shown in the ticket message screen of the customer interface. Possible settings: 0 = Disabled, 1 = Enabled, 2 = Enabled and required. NOTE. If you want to display these fields also in the ticket zoom of the customer interface, you have to enable them in CustomerTicketZoom###AttributesView.
I'm able right now to see the field, with the ArticleFreeKey1 and (if it has) the ArticleFreeText1. The only problem is that although the new value inserted by the customer is in the request after clickin' "Submit", the new value is not inserted into the database.
Taking a look at it, I've seen that if that Article field (a_freetext1 in the article's table) is filled when the ticket is created, and then I submit from the CustomerTicketZoom interface (where I really want to fill it, my customers can't create new tickets) only the first entry has a value in both fields, the Key and the Value, and the rest of the times (the rest of the times that the customer has clicked "Submit") the entries are NULL, so nothing is being stored from the Customer interface. Image attached.
I attach where is my field too, and here my code in the CustomerTicketZoom.dtl file:
Code: Select all
<!-- dtl:block:ArticleFreeText -->
<div>
<label for="ArticleFreeText">$QData{"Key", "11"}:</label>
<input type="text" name="ArticleFreeText1" style="width: 189px;"></input>
</div>
<div class="Clear"></div>
<!-- dtl:block:ArticleFreeText -->
[...]
------WebKitFormBoundaryNkUoEe7OT7QL6EQL
Content-Disposition: form-data; name="ArticleState"
true
------WebKitFormBoundaryNkUoEe7OT7QL6EQL
Content-Disposition: form-data; name="ArticleFreeText1" --> Maybe that's wrong??
67786543250786307/90708
------WebKitFormBoundaryNkUoEe7OT7QL6EQL
Content-Disposition: form-data; name="Subject"
Re: NewOneComeOn!
[...]
or from the CustomerTicketZoom.pm, that has no method to set the new ArticleFreeText, but to get.
Code: Select all
# show article free text
for my $Count ( 1 .. 3 ) {
next if !$Article{ 'ArticleFreeText' . $Count };
next if !$Self->{Config}->{AttributesView}->{ 'ArticleFreeText' . $Count };
# KIX4OTRS-capeIT
if ( $Self->{ConfigObject}->Get('ArticleFreeKey::LanguageTranslation') ) {
$Article{ 'ArticleFreeKey' . $Count } =
$Self->{LayoutObject}->{LanguageObject}
->Get( $Article{ 'ArticleFreeKey' . $Count } );
}
if ( $Self->{ConfigObject}->Get('ArticleFreeText::LanguageTranslation') ) {
$Article{ 'ArticleFreeText' . $Count } =
$Self->{LayoutObject}->{LanguageObject}
->Get( $Article{ 'ArticleFreeText' . $Count } );
}
# EO KIX4OTRS-capeIT
$Self->{LayoutObject}->Block(
Name => 'ArticleFreeText',
Data => {
Key => $Article{ 'ArticleFreeKey' . $Count },
Value => $Article{ 'ArticleFreeText' . $Count },
},
);
}
Thanks a lot, we are closer!
You do not have the required permissions to view the files attached to this post.
OTRS 3.0.11 and KIX4OTRS on Linux
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Add new Attribute to Ticket
If so, it's a bug.rafaqf wrote:The only problem is that although the new value inserted by the customer is in the request after clickin' "Submit", the new value is not inserted into the database.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: Add new Attribute to Ticket
Ok, that was the last thing I wanted to happen.crythias wrote:If so, it's a bug.rafaqf wrote:The only problem is that although the new value inserted by the customer is in the request after clickin' "Submit", the new value is not inserted into the database.
I'm going to change the ArticleFreeText and try to use a TicketFreeText and see what happens.
OTRS 3.0.11 and KIX4OTRS on Linux
Re: Add new Attribute to Ticket
Nothing, the same result, nothing stored in the Database from the Customer Interface.crythias wrote:If so, it's a bug.rafaqf wrote:The only problem is that although the new value inserted by the customer is in the request after clickin' "Submit", the new value is not inserted into the database.
Any help will be appreciated.
Thanks.
OTRS 3.0.11 and KIX4OTRS on Linux
[SOLVED] Add new Attribute to Ticket
Ok, I got it!crythias wrote:If so, it's a bug.
finally I added into the CustomerTicketZoom.pm the TicketFreeTextSet method from Ticket.pm, changed some parameters and it works! Now it's getting the parameter from the request. So I guess it would have also worked with the ArticleFreeText, but actually it's better for us to do it with the TicketFreeText.
Here goes what I have added to CustomerTicketZoom.pm:
Code: Select all
for my $Count ( 1 .. 16 ) {
my $Key = $GetParam{'TicketFreeKey' . $Count};
my $Text = $GetParam{'TicketFreeText' . $Count};
if( $Ticket{TicketFreeText16} ) {
$Self->{TicketObject}->TicketFreeTextSet(
TicketID => $Self->{TicketID},
Key => $Self->{ParamObject}->GetParam( Param => 'TicketFreeKey' . $Count ),
Value => $Self->{ParamObject}->GetParam( Param => 'TicketFreeText' . $Count ),
Counter => $Count,
UserID => $Self->{ConfigObject}->Get('CustomerPanelUserID'),
);
}
}
OTRS 3.0.11 and KIX4OTRS on Linux
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: [SOLVED] Add new Attribute to Ticket
Don't forget in TicketFreeText (sorry, I forgot) you need both a Key and a Value... You can't just store the TicketFreeText Value.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: [SOLVED] Add new Attribute to Ticket
Yes, both are in the requestcrythias wrote:Don't forget in TicketFreeText (sorry, I forgot) you need both a Key and a Value... You can't just store the TicketFreeText Value.

Thanks!
OTRS 3.0.11 and KIX4OTRS on Linux