Jump to content

Issues with provisioning module


MatteoWN

Recommended Posts

Hi everyone,

We've been developing our module for our own VPS Control panel, but I having a little bit of issues (To WHMCS guys, please make a more detailed documentation!)

 

Here's the situation:

 

Configuration Function:

 

function WNCloud_ConfigOptions() {
   return array (
       // Choose Node button
       "node" => array(
         "FriendlyName" => "Node",
           "Type" => "dropdown",
           "Options" => "nodo-02",
           "Description" => "Decide on which node create the VPS",
           "Default" => "nodo-02",
       ),
       // Choose Template button
       "template" => array(
           "FriendlyName" => "Server Template",
           "Type" => "dropdown",
           "Options" => getTemplates(),
           "Description" => "Define which template should be installed by default",
           "Default" => "800",
       ),
   );
}

 

Crate Account Function:

 

function WNCloud_CreateAccount(array $params) {
   global $db;
   try {
       $oid = incrementalHash();
       $status = 'SETUP_WAIT';
       $p = '0';
       $sql = $db->prepare('INSERT INTO daemon (order_id, template_id, user, status, pass, root_pw) VALUES (:oid, :t, :user, :status, :pass, :pw)');
       $sql->bindParam(':oid', $oid);
       $sql->bindParam(':t', $params['configoption2']);
       $sql->bindParam(':user', $params['clientsdetails']['email']);
       $sql->bindParam(':status', $status);
       $sql->bindParam(':pass', $p);
       $sql->bindParam(':pw', $params['customfields']['password']);
       $sql->execute();
   } catch (Exception $e) {
       logModuleCall(
       'WNCloud',
       __FUNCTION__,
       $params,
       $e->getMessage(),
       $e->getTraceAsString()
       );

       return $e->getMessage();
   }

   return 'success';
}

 

 

Other functions just like incrementalHash() and getTemplates() are working just fine! but the creation function just loops over and over when I click on the "Create" button from within WHMCS. Am I using the $params array wrong?

 

Regards

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