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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...