Blog

How-To

OpenERP PHP Connector

OpenERP is a great Open Source ERP System. The structure of Client-Server and talking by XML-RPC make it powerful to integrate with other systems. There are a lot of things done and in progress.

But we announce a new way to work with OpenERP and any other PHP applications. We build a PHP Connector you can include as library. The idea is not new, you can find a similar project for Ruby or Java.

How it works in PHP?

include 'openerp.class.php';
 
// connection parameter
$parameter = new OpenERPParameter();
$parameter->user = "USERNAME";
$parameter->password = "PW";
$parameter->dbname = "DB";
$parameter->url = "SERVER";
$parameter->port = "8069";
$parameter->protokoll = "http";
 
// create connector
$openerp = new OpenERPConnector( $parameter );
 
// create a new model for the ressource "res.partner"
$partner = new OpenERPModel( $openerp, "res.partner" );
// get all partners
$search = $partner->search('id', '>=', '0');
foreach( $search as $p ){
   // $p is from type OpenERPModelInstance
   // - has magic get and set method
   // - auto loads relation as models
   // - save() to store changes to OpenERP
 
   // print partner name
   echo $p->name ."\n";
   // print the related receivable account
   echo "related receivable account: " $p->property_account_receivable->name .": ". $p->property_account_receivable->amount ."\n\n";
}

The Library is independent from any module you install on OpenERP, it  dynamically loads all available attributes. You can use it in any PHP Application you want to connect with OpenERP. It is a CMS like Joomla, WordPress, Typo3, etc or as a Shop-System like Magento, Oxid, OS-Commerce, Presta, etc. or any other PHP Application you use in your company like Groupware, Webmail, Projekt and Tasktracking system.

We have build a first Plugin using our library for MantisBT to store the working hours in OpenERP directly on the Task-View.

Are you interested to use this library? Please contact us via sales@initos.com.  At the moment we are looking for partner and projects to improve our work and share cost and work. Later we will make it as Open Source public available.

zurück zur Übersicht