Jump to content
  • 0

get all client details - further declarations necessary?


Question

Posted

I'm working on a provisioning module that uses a Rest API, connection already works...
I would like to pass all client details (address, zip, city, phone etc.) to the panel via API, is it sufficient as listed below or do all client variables have to be declared again separately?
as an example:

"first_name"=> $client->first_name,

    public function addService(
        $package,
        array $vars = null,
        $parent_package = null,
        $parent_service = null,
        $status = 'pending'
    ) {
        $row = $this->getModuleRow();

        if (!$row) {
            $this->Input->setErrors(
                ['module_row' => ['missing' => Language::_('kh.!error.module_row.missing', true)]]
            );

            return;
        }

// ...
// my question refers to this
    $data = array(
       "username"=> $username,
       "email"=> $client->email,
       "password"=> $this->generatePassword(),
       "id_hosting_plan"=> $package->meta->template,
       "is_suspended"=> false,
       "suspend_on"=> null,
       "delete_on"=> null,
       "send_login_credentials"=> false,
       "create_system_domain"=> false,
       'contact_data'=>[
       "first_name"=> $client->first_name,
       "last_name"=> $client->last_name,
       "company"=> $client->company,
       "telephone"=> $client->phone,
       "address"=> $client->address1,
       "city"=> $client->city,
       "zip"=> $client->zip,
       "state"=> $client->state,
       "country"=> $client->country,
       "client_id"=> $client->client_id
       ]
    );

// ...

    public function getClientAddFields($package, $vars = null)
    {
        Loader::loadHelpers($this, ['Html']);

        $fields = new ModuleFields();

        // Create domain label
        $domain = $fields->label(Language::_('kh.service_field.domain', true), 'kh_domain');
        // Create domain field and attach to domain label
        $domain->attach(
            $fields->fieldText(
                'kh_domain',
                (isset($vars->kh_domain) ? $vars->kh_domain : ($vars->domain ?? null)),
                ['id' => 'kh_domain']
            )
        );
        // Set the label as a field
        $fields->setField($domain);

        return $fields;
    }

 

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...