Jump to content

Does Blesta Have A Opennebula Billing Module Or Could One Be Made?


timnboys

Recommended Posts

No I don't use the json config file I put it in the module class itself.

here is the function:

/**
	 * Returns the key used to identify the primary field from the set of module row meta fields.
	 * This value can be any of the module row meta fields.
	 *
	 * @return string The key used to identify the primary field from the set of module row meta fields
	 */
	public function moduleRowMetaKey() {
		return "server_key";
	}

I don't know if it has existed before in my dev blesta db(and I have changed alot since then) so what do you think it is?

as I cannot pin it down to any function besides the one above when trying to edit/add a package with the module. 

 

 

what you have in addModuleRow() ?

 

normally you should have server_key field saved in database .

Link to comment
Share on other sites

what you have in addModuleRow() ?

 

normally you should have server_key field saved in database .

/**
	 * Adds the module row on the remote server. Sets Input errors on failure,
	 * preventing the row from being added.
	 *
	 * @param array $vars An array of module info to add
	 * @return array A numerically indexed array of meta fields for the module row containing:
	 * 	- key The key for this meta field
	 * 	- value The value for this key
	 * 	- encrypted Whether or not this field should be encrypted (default 0, not encrypted)
	 */
	public function addModuleRow(array &$vars) {
		$meta_fields = array("oneauthstring","one_xmlrpc","hostname");
		$encrypted_fields = array("oneauthstring","one_xmlrpc","hostname");
		
		$this->Input->setRules($this->getRowRules($vars));
		
		// Validate module row
		if ($this->Input->validates($vars)) {

			// Build the meta data for this row
			$meta = array();
			foreach ($vars as $key => $value) {
				
				if (in_array($key, $meta_fields)) {
					$meta[] = array(
						'key' => $key,
						'value' => $value,
						'encrypted' => in_array($key, $encrypted_fields) ? 1 : 0
					);
				}
			}
			
			return $meta;
		}
	}

I have the above in my addmodulerow function.

Link to comment
Share on other sites

/**
	 * Adds the module row on the remote server. Sets Input errors on failure,
	 * preventing the row from being added.
	 *
	 * @param array $vars An array of module info to add
	 * @return array A numerically indexed array of meta fields for the module row containing:
	 * 	- key The key for this meta field
	 * 	- value The value for this key
	 * 	- encrypted Whether or not this field should be encrypted (default 0, not encrypted)
	 */
	public function addModuleRow(array &$vars) {
		$meta_fields = array("oneauthstring","one_xmlrpc","hostname");
		$encrypted_fields = array("oneauthstring","one_xmlrpc","hostname");
		
		$this->Input->setRules($this->getRowRules($vars));
		
		// Validate module row
		if ($this->Input->validates($vars)) {

			// Build the meta data for this row
			$meta = array();
			foreach ($vars as $key => $value) {
				
				if (in_array($key, $meta_fields)) {
					$meta[] = array(
						'key' => $key,
						'value' => $value,
						'encrypted' => in_array($key, $encrypted_fields) ? 1 : 0
					);
				}
			}
			
			return $meta;
		}
	}

I have the above in my addmodulerow function.

 

 

try changing

public function moduleRowMetaKey() {
  return "server_key";
}

to

public function moduleRowMetaKey() {
  return "hostname";
}
Link to comment
Share on other sites

Just FYI, the method moduleRowMetaKey must return a valid module row meta key used in your module. Your module only defines these values:

$meta_fields = array("oneauthstring","one_xmlrpc","hostname");

i.e. "oneauthstring", "one_xmlrpc", and "hostname"

 

Since "server_key" is not one of these values, it is the cause of the error you encountered.

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.

Loading...
×
×
  • Create New...