xmlrpc webERP API

View: New views
5 Messages — Rating Filter:   Alert me  

xmlrpc webERP API

by Andres Amaya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there, I've been playing with the weberp xmlrpc and the api, and i
think it has lots of potencial, i just started creating a webERP API
Connector, its a class that includes all the functions for connecting
with webERP i want this to be as simply as possible.

With this we can use the class and the xmlrpc library on another
software to communicate with webERP, but i think it could be amazing if
we can add to the API some Sales Orders functionality so we can create
real time communication between 2 or more webERP's, imagine you want to
create a  purchase order to a supplier also using webERP, with this you
can create the purchase order, verify in real time if the supplier has
that item in inventory, and send via the api the order to the supplier,
he then will authorize the order and automatically on the suppliers erp
appear as a sales order.

Here is my connector class source code:

<?php

/*
 * Bowikaxu Realhost - bowikaxu@...
 * webERP API Connector
 *
 * This class uses webERP API to be used as a simple class, and be able to
 * communicate with another webERP.
 * This class might work as a connector to webERP, but still needs
little modifications.
 *
 * With this class you can do:
 * $fiends_erp = new
xmlrpc_API('www.myfriend.com','/erp/api/api_xml-rpc.php',80,'http11','user','pass');
 * $friends_erp->api_GetCurrencyList();
 *
 */

/*
 * Class Variables
 * @ $domain - api server domain ex. www.domain.com
 * @ $domain_path - api server path to xmlrpc ex.
/erp/my_erp/api/api_xml-rpc.php
 * @ $domain_port - 80 'default 80 (http) 443 FOR https
 * @ $domain_protocol - protocol 'default: http - http11 FOR HTTP1.1
http FOR HTTP 1.0 https FOR HTTPS
 * @ $username - username to be used on function calls
 * @ $password - password to be used on fucntion calls
 *
 */

Class xmlrpc_API {

// just as an example
var $domain = 'www.weberp.org';
var $domain_path = '/weberp/api/api_xml-rpc.php';
var $domain_port = 80;
var $domain_protocol = 'http11';
var $username = 'demo';
var $password = 'weberp';

function xmlrpc_API($domain, $path, $port=80, $protocol='http', $user,
$pass){

// this function needs some validation and maybe username and password
verification
$this->domain = $domain;
$this->domain_path = $path;
$this->domain_port = $port;
$this->domain_protocol = $protocol;
$this->username = $user;
$this->password = $pass;

}

function getInfo(){

$info = array();

$info[0] = $this->domain;
$info[1] = $this->domain_path;
$info[2] = $this->domain_port;
$info[3] = $this->domain_protocol;
$info[4] = $this->username;
$info[5] = $this->password;

return $info;

}

/**
 * This function takes an associative array containing the details of a
customer to
 to be inserted, where the keys of the array are the field names in the
table debtorsmaster.
 * @param array $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_InsertCustomer ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_InsertCustomer');
$p1 =& php_xmlrpc_encode($p1);
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function takes an associative array containing the details of a
customer to
 to be updated, where the keys of the array are the field names in the
table debtorsmaster.
 * @param array $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_ModifyCustomer ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_ModifyCustomer');
$p1 =& php_xmlrpc_encode($p1);
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the customer
 whose account number is passed to it.
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetCustomer ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetCustomer');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing the account numbers of
those customers
 that meet the criteria given. Any field in debtorsmaster can be search on.
 * @param string $p1
 * @param string $p2
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_SearchCustomers ($p1, $p2, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_SearchCustomers');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($p2, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p3);
$p4 =& new xmlrpcval($this>password, 'string');
$msg->addparam($p4);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing a list of all currencies
setup on webERP
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetCurrencyList ($debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetCurrencyList');
$p1 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the currency
 sent as a parameter
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetCurrencyDetails ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetCurrencyDetails');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing a list of all sales types
setup on webERP
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetSalesTypeList ($debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetSalesTypeList');
$p1 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the sales type
 sent as a parameter
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetSalesTypeDetails ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetSalesTypeDetails');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing a list of all hold reason
codes setup on webERP
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetHoldReasonList ($debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetHoldReasonList');
$p1 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the hold reason
 sent as a parameter
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetHoldReasonDetails ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetHoldReasonDetails');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing a list of all payment terms
setup on webERP
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetPaymentTermsList ($debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetPaymentTermsList');
$p1 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the payment terms
 sent as a parameter
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetPaymentTermsDetails ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetPaymentTermsDetails');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function takes an associative array containing the details of a
stock item to
 to be inserted, where the keys of the array are the field names in the
table stockmaster.
 * @param array $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_InsertStockItem ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_InsertStockItem');
$p1 =& php_xmlrpc_encode($p1);
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function takes an associative array containing the details of a
stock item to
 to be updated, where the keys of the array are the field names in the
table stockmaster.
 * @param array $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_ModifyStockItem ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_ModifyStockItem');
$p1 =& php_xmlrpc_encode($p1);
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the item
 whose stockid is passed to it.
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetStockItem ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetStockItem');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing the account numbers of
those items
 that meet the criteria given. Any field in stockmaster can be search on.
 * @param string $p1
 * @param string $p2
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_SearchStockItems ($p1, $p2, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_SearchStockItems');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($p2, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p3);
$p4 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p4);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns the quantity of stock on hand a the location given
 * @param string $p1
 * @param string $p2
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetStockBalance ($p1, $p2, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetStockBalance');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($p2, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p3);
$p4 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p4);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}
}

?>

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Web-erp-developers mailing list
Web-erp-developers@...
https://lists.sourceforge.net/lists/listinfo/web-erp-developers

Re: xmlrpc webERP API

by Laban Johnson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Glad to see I'm not the only one with interest in this presently. Thank you Andres I will experiment with your class.

On Fri, Jul 4, 2008 at 10:20 AM, Andres Amaya <andres.amaya@...> wrote:
Hi there, I've been playing with the weberp xmlrpc and the api, and i
think it has lots of potencial, i just started creating a webERP API
Connector, its a class that includes all the functions for connecting
with webERP i want this to be as simply as possible.

With this we can use the class and the xmlrpc library on another
software to communicate with webERP, but i think it could be amazing if
we can add to the API some Sales Orders functionality so we can create
real time communication between 2 or more webERP's, imagine you want to
create a  purchase order to a supplier also using webERP, with this you
can create the purchase order, verify in real time if the supplier has
that item in inventory, and send via the api the order to the supplier,
he then will authorize the order and automatically on the suppliers erp
appear as a sales order.

Here is my connector class source code:

<?php

/*
 * Bowikaxu Realhost - bowikaxu@...
 * webERP API Connector
 *
 * This class uses webERP API to be used as a simple class, and be able to
 * communicate with another webERP.
 * This class might work as a connector to webERP, but still needs
little modifications.
 *
 * With this class you can do:
 * $fiends_erp = new
xmlrpc_API('www.myfriend.com','/erp/api/api_xml-rpc.php',80,'http11','user','pass');
 * $friends_erp->api_GetCurrencyList();
 *
 */

/*
 * Class Variables
 * @ $domain - api server domain ex. www.domain.com
 * @ $domain_path - api server path to xmlrpc ex.
/erp/my_erp/api/api_xml-rpc.php
 * @ $domain_port - 80 'default 80 (http) 443 FOR https
 * @ $domain_protocol - protocol 'default: http - http11 FOR HTTP1.1
http FOR HTTP 1.0 https FOR HTTPS
 * @ $username - username to be used on function calls
 * @ $password - password to be used on fucntion calls
 *
 */

Class xmlrpc_API {

// just as an example
var $domain = 'www.weberp.org';
var $domain_path = '/weberp/api/api_xml-rpc.php';
var $domain_port = 80;
var $domain_protocol = 'http11';
var $username = 'demo';
var $password = 'weberp';

function xmlrpc_API($domain, $path, $port=80, $protocol='http', $user,
$pass){

// this function needs some validation and maybe username and password
verification
$this->domain = $domain;
$this->domain_path = $path;
$this->domain_port = $port;
$this->domain_protocol = $protocol;
$this->username = $user;
$this->password = $pass;

}

function getInfo(){

$info = array();

$info[0] = $this->domain;
$info[1] = $this->domain_path;
$info[2] = $this->domain_port;
$info[3] = $this->domain_protocol;
$info[4] = $this->username;
$info[5] = $this->password;

return $info;

}

/**
 * This function takes an associative array containing the details of a
customer to
 to be inserted, where the keys of the array are the field names in the
table debtorsmaster.
 * @param array $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_InsertCustomer ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_InsertCustomer');
$p1 =& php_xmlrpc_encode($p1);
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function takes an associative array containing the details of a
customer to
 to be updated, where the keys of the array are the field names in the
table debtorsmaster.
 * @param array $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_ModifyCustomer ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_ModifyCustomer');
$p1 =& php_xmlrpc_encode($p1);
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the customer
 whose account number is passed to it.
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetCustomer ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetCustomer');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing the account numbers of
those customers
 that meet the criteria given. Any field in debtorsmaster can be search on.
 * @param string $p1
 * @param string $p2
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_SearchCustomers ($p1, $p2, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_SearchCustomers');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($p2, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p3);
$p4 =& new xmlrpcval($this>password, 'string');
$msg->addparam($p4);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing a list of all currencies
setup on webERP
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetCurrencyList ($debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetCurrencyList');
$p1 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the currency
 sent as a parameter
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetCurrencyDetails ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetCurrencyDetails');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing a list of all sales types
setup on webERP
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetSalesTypeList ($debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetSalesTypeList');
$p1 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the sales type
 sent as a parameter
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetSalesTypeDetails ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetSalesTypeDetails');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing a list of all hold reason
codes setup on webERP
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetHoldReasonList ($debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetHoldReasonList');
$p1 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the hold reason
 sent as a parameter
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetHoldReasonDetails ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetHoldReasonDetails');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing a list of all payment terms
setup on webERP
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetPaymentTermsList ($debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetPaymentTermsList');
$p1 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the payment terms
 sent as a parameter
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetPaymentTermsDetails ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetPaymentTermsDetails');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function takes an associative array containing the details of a
stock item to
 to be inserted, where the keys of the array are the field names in the
table stockmaster.
 * @param array $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_InsertStockItem ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_InsertStockItem');
$p1 =& php_xmlrpc_encode($p1);
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function takes an associative array containing the details of a
stock item to
 to be updated, where the keys of the array are the field names in the
table stockmaster.
 * @param array $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_ModifyStockItem ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_ModifyStockItem');
$p1 =& php_xmlrpc_encode($p1);
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the item
 whose stockid is passed to it.
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetStockItem ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetStockItem');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing the account numbers of
those items
 that meet the criteria given. Any field in stockmaster can be search on.
 * @param string $p1
 * @param string $p2
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_SearchStockItems ($p1, $p2, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_SearchStockItems');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($p2, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p3);
$p4 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p4);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns the quantity of stock on hand a the location given
 * @param string $p1
 * @param string $p2
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetStockBalance ($p1, $p2, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetStockBalance');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($p2, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p3);
$p4 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p4);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}
}

?>

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Web-erp-developers mailing list
Web-erp-developers@...
https://lists.sourceforge.net/lists/listinfo/web-erp-developers



--
Laban Johnson
Founder & CEO,
The Laban Johnson Group
laban@...
832-738-1009 (cell)
888-841-4282 (fax)

Confidentiality Notice: This message is intended exclusively for the individual or entity to which it is addressed.  This communication may contain information that is proprietary, privileged or confidential or otherwise legally exempt from disclosure.  If you are not the named addressee, you are not authorized to read, print, retain, copy or disseminate this message or any part of it.  If you have received this message in error, please notify the sender immediately by e-mail and delete all copies of the message.
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Web-erp-developers mailing list
Web-erp-developers@...
https://lists.sourceforge.net/lists/listinfo/web-erp-developers

Re: [webERP-users] xmlrpc webERP API

by Tim Schofield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Andres,

I love your work, its great. I am working on the api whenever I get
the chance, and ultimately hope to cover all of webERP I have recently
started to add in the stock functionality to the api, and hope to have
that competed very soon.

So that we can work together on this can you see any areas where the
api can be improved?

Thanks
Tim


2008/7/4 Andres Amaya <andres.amaya@...>:

> Hi there, I've been playing with the weberp xmlrpc and the api, and i
> think it has lots of potencial, i just started creating a webERP API
> Connector, its a class that includes all the functions for connecting
> with webERP i want this to be as simply as possible.
>
> With this we can use the class and the xmlrpc library on another
> software to communicate with webERP, but i think it could be amazing if
> we can add to the API some Sales Orders functionality so we can create
> real time communication between 2 or more webERP's, imagine you want to
> create a  purchase order to a supplier also using webERP, with this you
> can create the purchase order, verify in real time if the supplier has
> that item in inventory, and send via the api the order to the supplier,
> he then will authorize the order and automatically on the suppliers erp
> appear as a sales order.
>
> Here is my connector class source code:
>
> <?php
>
> /*
>  * Bowikaxu Realhost - bowikaxu@...
>  * webERP API Connector
>  *
>  * This class uses webERP API to be used as a simple class, and be able to
>  * communicate with another webERP.
>  * This class might work as a connector to webERP, but still needs
> little modifications.
>  *
>  * With this class you can do:
>  * $fiends_erp = new
> xmlrpc_API('www.myfriend.com','/erp/api/api_xml-rpc.php',80,'http11','user','pass');
>  * $friends_erp->api_GetCurrencyList();
>  *
>  */
>
> /*
>  * Class Variables
>  * @ $domain - api server domain ex. www.domain.com
>  * @ $domain_path - api server path to xmlrpc ex.
> /erp/my_erp/api/api_xml-rpc.php
>  * @ $domain_port - 80 'default 80 (http) 443 FOR https
>  * @ $domain_protocol - protocol 'default: http - http11 FOR HTTP1.1
> http FOR HTTP 1.0 https FOR HTTPS
>  * @ $username - username to be used on function calls
>  * @ $password - password to be used on fucntion calls
>  *
>  */
>
> Class xmlrpc_API {
>
> // just as an example
> var $domain = 'www.weberp.org';
> var $domain_path = '/weberp/api/api_xml-rpc.php';
> var $domain_port = 80;
> var $domain_protocol = 'http11';
> var $username = 'demo';
> var $password = 'weberp';
>
> function xmlrpc_API($domain, $path, $port=80, $protocol='http', $user,
> $pass){
>
> // this function needs some validation and maybe username and password
> verification
> $this->domain = $domain;
> $this->domain_path = $path;
> $this->domain_port = $port;
> $this->domain_protocol = $protocol;
> $this->username = $user;
> $this->password = $pass;
>
> }
>
> function getInfo(){
>
> $info = array();
>
> $info[0] = $this->domain;
> $info[1] = $this->domain_path;
> $info[2] = $this->domain_port;
> $info[3] = $this->domain_protocol;
> $info[4] = $this->username;
> $info[5] = $this->password;
>
> return $info;
>
> }
>
> /**
>  * This function takes an associative array containing the details of a
> customer to
>  to be inserted, where the keys of the array are the field names in the
> table debtorsmaster.
>  * @param array $p1
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_InsertCustomer ($p1, $debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_InsertCustomer');
> $p1 =& php_xmlrpc_encode($p1);
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p2);
> $p3 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p3);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function takes an associative array containing the details of a
> customer to
>  to be updated, where the keys of the array are the field names in the
> table debtorsmaster.
>  * @param array $p1
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_ModifyCustomer ($p1, $debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_ModifyCustomer');
> $p1 =& php_xmlrpc_encode($p1);
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p2);
> $p3 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p3);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function returns an associative array containing the details of
> the customer
>  whose account number is passed to it.
>  * @param string $p1
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_GetCustomer ($p1, $debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_GetCustomer');
> $p1 =& new xmlrpcval($p1, 'string');
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p2);
> $p3 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p3);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function returns an array containing the account numbers of
> those customers
>  that meet the criteria given. Any field in debtorsmaster can be search on.
>  * @param string $p1
>  * @param string $p2
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_SearchCustomers ($p1, $p2, $debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_SearchCustomers');
> $p1 =& new xmlrpcval($p1, 'string');
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($p2, 'string');
> $msg->addparam($p2);
> $p3 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p3);
> $p4 =& new xmlrpcval($this>password, 'string');
> $msg->addparam($p4);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function returns an array containing a list of all currencies
> setup on webERP
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_GetCurrencyList ($debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_GetCurrencyList');
> $p1 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p2);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function returns an associative array containing the details of
> the currency
>  sent as a parameter
>  * @param string $p1
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_GetCurrencyDetails ($p1, $debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_GetCurrencyDetails');
> $p1 =& new xmlrpcval($p1, 'string');
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p2);
> $p3 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p3);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function returns an array containing a list of all sales types
> setup on webERP
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_GetSalesTypeList ($debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_GetSalesTypeList');
> $p1 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p2);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function returns an associative array containing the details of
> the sales type
>  sent as a parameter
>  * @param string $p1
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_GetSalesTypeDetails ($p1, $debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_GetSalesTypeDetails');
> $p1 =& new xmlrpcval($p1, 'string');
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p2);
> $p3 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p3);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function returns an array containing a list of all hold reason
> codes setup on webERP
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_GetHoldReasonList ($debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_GetHoldReasonList');
> $p1 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p2);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function returns an associative array containing the details of
> the hold reason
>  sent as a parameter
>  * @param string $p1
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_GetHoldReasonDetails ($p1, $debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_GetHoldReasonDetails');
> $p1 =& new xmlrpcval($p1, 'string');
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p2);
> $p3 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p3);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function returns an array containing a list of all payment terms
> setup on webERP
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_GetPaymentTermsList ($debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_GetPaymentTermsList');
> $p1 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p2);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function returns an associative array containing the details of
> the payment terms
>  sent as a parameter
>  * @param string $p1
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_GetPaymentTermsDetails ($p1, $debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_GetPaymentTermsDetails');
> $p1 =& new xmlrpcval($p1, 'string');
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p2);
> $p3 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p3);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function takes an associative array containing the details of a
> stock item to
>  to be inserted, where the keys of the array are the field names in the
> table stockmaster.
>  * @param array $p1
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_InsertStockItem ($p1, $debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_InsertStockItem');
> $p1 =& php_xmlrpc_encode($p1);
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p2);
> $p3 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p3);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function takes an associative array containing the details of a
> stock item to
>  to be updated, where the keys of the array are the field names in the
> table stockmaster.
>  * @param array $p1
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_ModifyStockItem ($p1, $debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_ModifyStockItem');
> $p1 =& php_xmlrpc_encode($p1);
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p2);
> $p3 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p3);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function returns an associative array containing the details of
> the item
>  whose stockid is passed to it.
>  * @param string $p1
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_GetStockItem ($p1, $debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_GetStockItem');
> $p1 =& new xmlrpcval($p1, 'string');
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p2);
> $p3 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p3);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function returns an array containing the account numbers of
> those items
>  that meet the criteria given. Any field in stockmaster can be search on.
>  * @param string $p1
>  * @param string $p2
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_SearchStockItems ($p1, $p2, $debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_SearchStockItems');
> $p1 =& new xmlrpcval($p1, 'string');
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($p2, 'string');
> $msg->addparam($p2);
> $p3 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p3);
> $p4 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p4);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
>
> /**
>  * This function returns the quantity of stock on hand a the location given
>  * @param string $p1
>  * @param string $p2
>  * @param int $debug when 1 (or 2) will enable debugging of the
> underlying xmlrpc call (defaults to 0)
>  * @return array (or an xmlrpcresp obj instance if call fails)
>  */
> function api_GetStockBalance ($p1, $p2, $debug=0) {
> $client =& new xmlrpc_client($this->domain_path, $this->domain,
> $this->domain_port);
> $client->return_type = 'xmlrpcvals';
> $client->setDebug($debug);
> $msg =& new xmlrpcmsg('weberp.xmlrpc_GetStockBalance');
> $p1 =& new xmlrpcval($p1, 'string');
> $msg->addparam($p1);
> $p2 =& new xmlrpcval($p2, 'string');
> $msg->addparam($p2);
> $p3 =& new xmlrpcval($this->username, 'string');
> $msg->addparam($p3);
> $p4 =& new xmlrpcval($this->password, 'string');
> $msg->addparam($p4);
> $res =& $client->send($msg, 0, $this->domain_protocol);
> if ($res->faultcode()) return $res; else return
> php_xmlrpc_decode($res->value());
> }
> }
>
> ?>
>
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________
> web-ERP-users mailing list
> web-ERP-users@...
> https://lists.sourceforge.net/lists/listinfo/web-erp-users
>

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Web-erp-developers mailing list
Web-erp-developers@...
https://lists.sourceforge.net/lists/listinfo/web-erp-developers

Re: xmlrpc webERP API

by Laban Johnson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The connector looks good but where do I download the xmlrpc and the API? They don't seem to yet be packaged in WebERP?



On Fri, Jul 4, 2008 at 10:20 AM, Andres Amaya <andres.amaya@...> wrote:
Hi there, I've been playing with the weberp xmlrpc and the api, and i
think it has lots of potencial, i just started creating a webERP API
Connector, its a class that includes all the functions for connecting
with webERP i want this to be as simply as possible.

With this we can use the class and the xmlrpc library on another
software to communicate with webERP, but i think it could be amazing if
we can add to the API some Sales Orders functionality so we can create
real time communication between 2 or more webERP's, imagine you want to
create a  purchase order to a supplier also using webERP, with this you
can create the purchase order, verify in real time if the supplier has
that item in inventory, and send via the api the order to the supplier,
he then will authorize the order and automatically on the suppliers erp
appear as a sales order.

Here is my connector class source code:

<?php

/*
 * Bowikaxu Realhost - bowikaxu@...
 * webERP API Connector
 *
 * This class uses webERP API to be used as a simple class, and be able to
 * communicate with another webERP.
 * This class might work as a connector to webERP, but still needs
little modifications.
 *
 * With this class you can do:
 * $fiends_erp = new
xmlrpc_API('www.myfriend.com','/erp/api/api_xml-rpc.php',80,'http11','user','pass');
 * $friends_erp->api_GetCurrencyList();
 *
 */

/*
 * Class Variables
 * @ $domain - api server domain ex. www.domain.com
 * @ $domain_path - api server path to xmlrpc ex.
/erp/my_erp/api/api_xml-rpc.php
 * @ $domain_port - 80 'default 80 (http) 443 FOR https
 * @ $domain_protocol - protocol 'default: http - http11 FOR HTTP1.1
http FOR HTTP 1.0 https FOR HTTPS
 * @ $username - username to be used on function calls
 * @ $password - password to be used on fucntion calls
 *
 */

Class xmlrpc_API {

// just as an example
var $domain = 'www.weberp.org';
var $domain_path = '/weberp/api/api_xml-rpc.php';
var $domain_port = 80;
var $domain_protocol = 'http11';
var $username = 'demo';
var $password = 'weberp';

function xmlrpc_API($domain, $path, $port=80, $protocol='http', $user,
$pass){

// this function needs some validation and maybe username and password
verification
$this->domain = $domain;
$this->domain_path = $path;
$this->domain_port = $port;
$this->domain_protocol = $protocol;
$this->username = $user;
$this->password = $pass;

}

function getInfo(){

$info = array();

$info[0] = $this->domain;
$info[1] = $this->domain_path;
$info[2] = $this->domain_port;
$info[3] = $this->domain_protocol;
$info[4] = $this->username;
$info[5] = $this->password;

return $info;

}

/**
 * This function takes an associative array containing the details of a
customer to
 to be inserted, where the keys of the array are the field names in the
table debtorsmaster.
 * @param array $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_InsertCustomer ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_InsertCustomer');
$p1 =& php_xmlrpc_encode($p1);
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function takes an associative array containing the details of a
customer to
 to be updated, where the keys of the array are the field names in the
table debtorsmaster.
 * @param array $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_ModifyCustomer ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_ModifyCustomer');
$p1 =& php_xmlrpc_encode($p1);
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the customer
 whose account number is passed to it.
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetCustomer ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetCustomer');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing the account numbers of
those customers
 that meet the criteria given. Any field in debtorsmaster can be search on.
 * @param string $p1
 * @param string $p2
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_SearchCustomers ($p1, $p2, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_SearchCustomers');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($p2, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p3);
$p4 =& new xmlrpcval($this>password, 'string');
$msg->addparam($p4);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing a list of all currencies
setup on webERP
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetCurrencyList ($debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetCurrencyList');
$p1 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the currency
 sent as a parameter
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetCurrencyDetails ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetCurrencyDetails');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing a list of all sales types
setup on webERP
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetSalesTypeList ($debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetSalesTypeList');
$p1 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the sales type
 sent as a parameter
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetSalesTypeDetails ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetSalesTypeDetails');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing a list of all hold reason
codes setup on webERP
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetHoldReasonList ($debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetHoldReasonList');
$p1 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the hold reason
 sent as a parameter
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetHoldReasonDetails ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetHoldReasonDetails');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing a list of all payment terms
setup on webERP
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetPaymentTermsList ($debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetPaymentTermsList');
$p1 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the payment terms
 sent as a parameter
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetPaymentTermsDetails ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetPaymentTermsDetails');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function takes an associative array containing the details of a
stock item to
 to be inserted, where the keys of the array are the field names in the
table stockmaster.
 * @param array $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_InsertStockItem ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_InsertStockItem');
$p1 =& php_xmlrpc_encode($p1);
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function takes an associative array containing the details of a
stock item to
 to be updated, where the keys of the array are the field names in the
table stockmaster.
 * @param array $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_ModifyStockItem ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_ModifyStockItem');
$p1 =& php_xmlrpc_encode($p1);
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an associative array containing the details of
the item
 whose stockid is passed to it.
 * @param string $p1
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetStockItem ($p1, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetStockItem');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p3);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns an array containing the account numbers of
those items
 that meet the criteria given. Any field in stockmaster can be search on.
 * @param string $p1
 * @param string $p2
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_SearchStockItems ($p1, $p2, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_SearchStockItems');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($p2, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p3);
$p4 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p4);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}

/**
 * This function returns the quantity of stock on hand a the location given
 * @param string $p1
 * @param string $p2
 * @param int $debug when 1 (or 2) will enable debugging of the
underlying xmlrpc call (defaults to 0)
 * @return array (or an xmlrpcresp obj instance if call fails)
 */
function api_GetStockBalance ($p1, $p2, $debug=0) {
$client =& new xmlrpc_client($this->domain_path, $this->domain,
$this->domain_port);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('weberp.xmlrpc_GetStockBalance');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($p2, 'string');
$msg->addparam($p2);
$p3 =& new xmlrpcval($this->username, 'string');
$msg->addparam($p3);
$p4 =& new xmlrpcval($this->password, 'string');
$msg->addparam($p4);
$res =& $client->send($msg, 0, $this->domain_protocol);
if ($res->faultcode()) return $res; else return
php_xmlrpc_decode($res->value());
}
}

?>

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Web-erp-developers mailing list
Web-erp-developers@...
https://lists.sourceforge.net/lists/listinfo/web-erp-developers



-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Web-e