Jump to content

Bug or what ?


FH-Vlad

Recommended Posts

Hi guys,

I am working on server module for integration with CCP. So far so good ... everything works as it should except one thing - saving back custom fields using internal api call. Here are the details ...

 

PHP code to call api:

 

$values3['clientid'] = $params['clientsdetails']['userid'];

$values3["customfields"] = base64_encode( serialize( array( "CCP_username"=>$newuser ) ) );

$result3 = localAPI( "updateclient", $values3 , WHMCS_ADMIN );

 

Right after that I had the content of arrays emailed to me. Here they are:

 

Values

(

[clientid] => 11

[customfields] => YToxOntzOjEyOiJDQ1BfdXNlcm5hbWUiO3M6MTU6InZsYWRpbWlyLTExLTcxNCI7fQ==

)

 

Result

(

[result] => success

[clientid] => 11

)

 

If you decode customfields, you'll get: "a:1:{s:12:"CCP_username";s:15:"vladimir-11-714";}"

 

So ... the api call went through without error. But when I check user 11 in WHMCS admin panel, the custom field "CCP_username" is empty. I have looked into the database to see what happened.

 

Here's the "CCP_username" in tblcustomfields dump:

 

...

(12,'client',0,'CCP_username','text','CCP Username','','','on','','on','on',0)

...

 

And here's what was generated in tblcustomfieldsvalues after that api call:

 

...

(0,11,'vladimir-11-714')

...

 

Now ... shouldn't that be (12,11,'vladimir-11-714') ? Obviously, something is not right ... either I am doing something wrong or there's a bug. WHMCS had been updated sometime late December to 5.1.2.

 

Any comment ?

Link to comment
Share on other sites

It is the way it's supposed to be used, look at the example for the Add Order command and you will see it's the same:

 

http://docs.whmcs.com/API:Add_Order

 

However, I do agree that it's a stupid method to use as you would have know the unique ID of the field to update it and there is no call to actually map the ID to a friendly name.

Link to comment
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated