Jump to content
  • 0

Creating a module


tiagocaus

Question

Good afternoon.
I have a car rental system. I am creating a module to control sales through WHMCS.

I need two of your help.

1º) How to make the field USERNAME receive the first name of the register?

2º) In the custom field, called CHAVE , how do I automatically generate an MD5 number?

 

image.jpeg.a3ba3e391f280d46568e24aa42938285.jpeg

 

Thank you.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

@tiagocaus sorry it's a bit late of a reply, but you can do this with a hook on service created (using the auto release module) or order created. If you are writing your own module, you could edit the custom field value using Salmon:

// Assign the data store to a variable for shorter example
$customFieldDataStore = $service->customFieldStore();

// Fetch the custom field
$customFieldValue = $customFieldDataStore->getCustomFieldValue($customFieldDataStore->getFieldByName('Chave'));

// From which you can then set a new value
$customFieldValue->value = md5(microtime());

// And save it
$customFieldValue->save();

More docs: https://github.com/grizzlyware/salmon-whmcs/wiki/Custom-fields

Hope this helps! 🙂

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

  • 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