i want to set a new textarea in the Customer Companies Registration.
The textarea input to be displayed in the Ticket Information.
Is it possible to do this with dynamic fields?
How can i realize this?
greetz ben
Code: Select all
<textarea id="$QData{"SOP"}" class="RichText" name="SOP" value="$Env{"Action"}">$QData{"Content"}</textarea>
$Include{"CustomerRichTextEditor"}
Code: Select all
for my $Entry ( @{ $Self->{ConfigObject}->Get('CustomerCompany')->{Map} } ) {
if ( $Entry->[0] ) {
my $Block = 'Input';
# build selections or input fields
if ( $Self->{ConfigObject}->Get('CustomerCompany')->{Selections}->{ $Entry->[0] } ) {
my $OptionRequired = '';
if ( $Entry->[4] ) {
$OptionRequired = 'Validate_Required';
}
Code: Select all
sub CustomerCompanyGet {
my ( $Self, %Param ) = @_;
# check needed stuff
if ( !$Param{CustomerID} ) {
$Self->{LogObject}->Log( Priority => 'error', Message => "Need CustomerID!" );
return;
}
# build select
my $SQL = "SELECT ";
for my $Entry ( @{ $Self->{CustomerCompanyMap} } ) {
$SQL .= " $Entry->[2], ";
}
$SQL .= $Self->{CustomerCompanyKey};
if ( !$Self->{ForeignDB} ) {
$SQL .= ", change_time, create_time";
}
Code: Select all
<!-- dtl:block:HeaderEdit -->
</div>
<div class="Content">
<form action="$Env{"CGIHandle"}" class="Validate" method="post">
<input type="hidden" name="Action" value="$Env{"Action"}"/>
<input type="hidden" name="Subaction" value="$QData{"Action"}Action"/>
<input type="hidden" name="Nav" value="$QData{"Nav"}"/>
<input type="hidden" name="CustomerCompanyID" value="$QData{"CustomerID"}"/>
<textarea id="$QData{"SOP"}" class="RichText" name="SOP" value="$Env{"Action"}">$QData{"SOP"}</textarea>
$Include{"CustomerRichTextEditor"}
<fieldset class="TableLike">
Code: Select all
<div class="Content">
<form action="$Env{"CGIHandle"}" class="Validate" method="post">
<input type="hidden" name="Action" value="$Env{"Action"}"/>
<input type="hidden" name="Subaction" value="$QData{"Action"}Action"/>
<input type="hidden" name="Nav" value="$QData{"Nav"}"/>
<input type="hidden" name="CustomerCompanyID" value="$QData{"CustomerID"}"/>
<select id="SLAPeriod" name="SLAPeriod" size="1" value="$QData{"SLAPeriod"}">
<option value="0">keine</option>
<option value="1">1 Monat</option>
<option value="3">3 Monate</option>
</select>
<fieldset class="TableLike">
Code: Select all
Selections => {
# CustomerCompanyCountry => {
# 'Germany' => 'Germany',
# 'Spain' => 'Spain',
# },
},
Huwiseg wrote: Wie bekommt man das nun hin?
Eingebaut in AdminCustomerCompany.dtlCode: Select all
<input type="hidden" name="CustomerCompanyID" value="$QData{"CustomerID"}"/> <select id="SLAPeriod" name="SLAPeriod" size="1" value="$QData{"SLAPeriod"}"> <option value="0">keine</option> <option value="1">1 Monat</option> <option value="3">3 Monate</option> </select> <fieldset class="TableLike">
Thats what i have already done. You cann see it at the Screenshot namend SLA-Period and SLA-Unitscrythias wrote:All, the proper and easiest way to do what you want is to:
1) Extend/ALTER the schema of the customer_company table to hold the field you wish. I suggest you prepend my_ to the field name (ie, my_fieldname) so anything OTRS does with alter doesn't affect it. Also, this clearly indicates a custom field.
2) Copy $Self->{CustomerCompany} = {...} to Config.pm from Defaults.pm and add a line in the Map that reflects the new field.
That's it. It'll show up, store, survive updates, won't change the .dtl, ... it'll just work.
Also, if you have a static dropdown list that you'd like to apply to a field, you may add a "Selections" entry to the CustomerCompany, like CustomerUser (uncomment, of course):
Code: Select all
Selections => { # CustomerCompanyCountry => { # 'Germany' => 'Germany', # 'Spain' => 'Spain', # }, },