OTRS CVS - Manual
Prev | Chapter 10. Customer (min. OTRS 1.1) | Next

# Customize Customer Self Registration

It's possible to customize the self registration of new customers via the customer.pl. So you can add more optional or required fields (like address, location, ...).

In our example we want to add a required "address" field.

## Template

Edit your "Kernel/Output/HTML/Standard/CustomerCreateAccount.dtl" and add your wanted fields. We want an "address" field, so add:

        [...]
        <tr>
          <td>$Text{"Address"}: </td>
          <td> <input type="text" name="Address" value="$Data{"UserAddress"}" size="35" maxlength="50"></td>
        </tr>
        [...]

## Customer Map

You need also to add an "address" entry to you customer source map so add to your Kernel/Config.pm the "CustomerUser" (customer source map) from Kernel/Config/Defaults.pm and add the "address" option. Then the "CustomerUser" config option should look like that:

        [Kernel/Config.pm]
        $Self->{CustomerUser} = {
            Name => 'Intenal Customers',
            Module => 'Kernel::System::CustomerUser::DB',
            Params => {
                Table => 'customer_user',
            },
            Map => [
                # note: Login, Email and CustomerID needed!
                # var, frontend, storage, shown, required, storage-type, link
                [ 'UserSalutation', 'Salutation', 'salutation', 1, 0, 'var' ],
                [ 'UserFirstname', 'Firstname', 'first_name', 1, 1, 'var' ],
                [ 'UserLastname', 'Lastname', 'last_name', 1, 1, 'var' ],
                # our new option
                [ 'UserAddress', 'Address', 'address', 1, 1, 'var' ],
                [ 'UserLogin', 'Login', 'login', 1, 1, 'var' ],
                [ 'UserPassword', 'Password', 'pw', 0, 1, 'var' ],
                [ 'UserEmail', 'Email', 'email', 1, 1, 'var' ],
                [ 'UserCustomerID', 'CustomerID', 'customer_id', 1, 1, 'var' ],
                [ 'UserComment', 'Phone', 'comment', 1, 0, 'var' ],
                [ 'ValidID', 'Valid', 'valid_id', 0, 1, 'int' ],
            ],
            Key => 'login',
            CustomerID => 'customer_id',
        };
        [...]

## Modify Customer Table

We also need to add a new column to our "customer_user" table.

    mysql> ALTER TABLE customer_user ADD address VARCHAR (200);
    Query OK, 0 rows affected (0.21 sec)
    Records: 0  Duplicates: 0  Warnings: 0

    mysql>

That's all, restart your webserver (if you use mod_perl), go to your http://otrs.example.com/otrs/customer.pl page and test it.

Prev | Home | Next
Customer Auth Backend | Up | Permissions