New textarea in the Company Registration

English! place to talk about development, programming and coding
Post Reply
bendenn
Znuny newbie
Posts: 35
Joined: 25 May 2012, 11:09
Znuny Version: 3.1.6
Real Name: Ben

New textarea in the Company Registration

Post by bendenn »

hello community,
i want to set a new textarea in the Customer Companies Registration.
Image
The textarea input to be displayed in the Ticket Information.
Image
Is it possible to do this with dynamic fields?
How can i realize this?
greetz ben
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: New textarea in the Company Registration

Post by reneeb »

Currently DynamicFields are available only for tickets and articles. So you have to change the database table for the customer company, the modules that gets the information out of it and the templates that shows that information.
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
bendenn
Znuny newbie
Posts: 35
Joined: 25 May 2012, 11:09
Znuny Version: 3.1.6
Real Name: Ben

Re: New textarea in the Company Registration

Post by bendenn »

Thanks for the information.
Im trying it.
bendenn
Znuny newbie
Posts: 35
Joined: 25 May 2012, 11:09
Znuny Version: 3.1.6
Real Name: Ben

Re: New textarea in the Company Registration

Post by bendenn »

Until now I have.
a rich textarea field in the AdminCustomerCompany.dtl

Code: Select all

<textarea id="$QData{"SOP"}" class="RichText" name="SOP" value="$Env{"Action"}">$QData{"Content"}</textarea>
$Include{"CustomerRichTextEditor"}
The Textarea input into the database is running but showing in the input field SOP

Image

how do I get the input, displayed in the TextArea?
bendenn
Znuny newbie
Posts: 35
Joined: 25 May 2012, 11:09
Znuny Version: 3.1.6
Real Name: Ben

Re: New textarea in the Company Registration

Post by bendenn »

I guess that's the part in the AdminCustomerCompany.pm

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';
                }
and this possibly the part in the CustomerCompany.pm

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";
    }
how can i do the same for the textarea?
bendenn
Znuny newbie
Posts: 35
Joined: 25 May 2012, 11:09
Znuny Version: 3.1.6
Real Name: Ben

Re: New textarea in the Company Registration

Post by bendenn »

Habe es geschafft :)
kann nur leider nicht wirklich viel dazu sagen, es fehlt mir einfach an background Wissen.
Hier der Codeausschnitt... die Textarea sogar als RichTextEditor;)

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">	
Huwiseg
Znuny newbie
Posts: 61
Joined: 19 Jun 2013, 11:12
Znuny Version: 3.2.4

Re: New textarea in the Company Registration

Post by Huwiseg »

Ich setze mal hier an da ich das gleiche Problem hatte, anstatt eines Inputs sollte ein Dropdown da sein, das habe ich so weit auch hinbekommen und die Daten werden bei einer Änderung auch gespeichert, allerdings taucht das Dropdown ganz oben auf, ausserhalb des Formulars, es soll aber das Input ersetzen (neben SLA-Period).

Wie bekommt man das nun hin?

Eingebaut in AdminCustomerCompany.dtl

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">
Screenshot der Ansicht
slaperiodfail.PNG
You do not have the required permissions to view the files attached to this post.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: New textarea in the Company Registration

Post by crythias »

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.

While you're here, you can change labels and order of field placement by way of their position in Map.

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',
#            },
        }, 
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
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: New textarea in the Company Registration

Post by reneeb »

Huwiseg wrote: Wie bekommt man das nun hin?

Eingebaut in AdminCustomerCompany.dtl

Code: 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">

Das select muss *innerhalb* des "fieldset" stehen. Schau Dir am besten an, wie die anderen Felder definiert sind...
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Huwiseg
Znuny newbie
Posts: 61
Joined: 19 Jun 2013, 11:12
Znuny Version: 3.2.4

Re: New textarea in the Company Registration

Post by Huwiseg »

crythias 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.
Thats what i have already done. You cann see it at the Screenshot namend SLA-Period and SLA-Units

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',
#            },
        }, 

That was, what i needed, now i got a nice Dropdown.

Thank you very much, i didn't found something about this.
Post Reply