Updating clients with SOAP

Discussion in 'General' started by pyte, May 31, 2022.

  1. pyte

    pyte Well-Known Member HowtoForge Supporter

    i'm still trying to add all my customers (500+) to a single reseller. I already have a script running to update the customer information
    automatically, if there are changes. I've tried to assign the reseller with the following scirpt, but no matter what i dosen't seem to work.

    function client_to_reseller($clientid) {
    $reseller_id 466;
    $client_record $GLOBALS['client']->client_get($GLOBALS['session_id'], $clientid);
    print_r($client_record); //* DEBUG
    $client_record['password'] = '';
    $client_record['notes'] = 'EditedByScript';
    $affected_rows $GLOBALS['client']->client_update($GLOBALS['session_id'], $clientid$reseller_id$client_record);
    "Number of records that have been changed in the database: ".$affected_rows."<br>";
    Even with the following parameters set too, there seems to be no effect:
    $client_record['sys_groupid'] = '467';                                                                                                                                                            $client_record['sys_userid'] = '467';                                                                                                                                                              $client_record['parent_client_id'] = '466';
    My Reseller within ISPConfig has the ID 466 and sys_userid and sys_groupid are '467' in the database after assigning a reseller to that user.
    Changing the values directly within the Database works, but i don't think thats the right way of doing so and i'd like to implement it within my script.

    UPDATE client
    SET parent_client_id = '466', sys_groupid= '467', sys_userid= '467'
    WHERE client_id = 270;
    After doing this directly within the database, the client is correctly assigned to the reseller within ispconfig.
    What am i doing wrong with the SOAP Script?

Share This Page