Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getCurrencyID($companyID)
- {
- $this->client = new xmlrpc_client($this->services.'object');
- $this->msg = new xmlrpcmsg('execute');
- /*
- * THE FOLLOWING CODE SHOULD WORK, BUT IT DOESNT
- */
- //~ $key = array(new xmlrpcval('currency_id', 'string'), );
- //~
- //~ $this->msg->addParam(new xmlrpcval($this->database, "string"));
- //~ $this->msg->addParam(new xmlrpcval($this->id, "int"));
- //~ $this->msg->addParam(new xmlrpcval($this->user, "string"));
- //~ $this->msg->addParam(new xmlrpcval("res.company","string"));
- //~ $this->msg->addParam(new xmlrpcval("read", "string"));
- //~ $this->msg->addParam(new xmlrpcval(array($companyID), "array"));
- //~ $this->msg->addParam(new xmlrpcval($key, "array"));
- /*
- * THE FOLLOWING CODE DOES WORK, BUT IT's NOT WHAT WE WANT
- */
- $args = array(
- new xmlrpcval(array(new xmlrpcval("name" , "string"), //Table name
- new xmlrpcval("=","string"), //Operator
- new xmlrpcval("CRC","string")), //Search value
- "array"),
- );
- $this->msg->addParam(new xmlrpcval($this->database, "string"));
- $this->msg->addParam(new xmlrpcval($this->id, "int"));
- $this->msg->addParam(new xmlrpcval($this->password, "string"));
- $this->msg->addParam(new xmlrpcval("res.currency","string"));
- $this->msg->addParam(new xmlrpcval("search", "string"));
- $this->msg->addParam(new xmlrpcval($args, "array"));
- $this->res = &$this->client->send($this->msg);
- echo "<h1>Get Currency ID</h1><pre>";
- var_dump ($this->res);
- echo "</pre>";
- if(!$this->res->faultCode())
- {
- $res_value = $this->res->value()->scalarval();
- $res_value_first = $res_value[0]->scalarval();
- $currencyID = $res_value_first["currency_id"]->scalarval();
- if(count($currencyID) > 0)
- {
- //Retrieves the xmlrpcval with the currency_id
- return $currencyID[0];
- }
- else
- {
- return -1;
- }
- }
- else
- {
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement