Eventum:Customer API

Eventum Menu: Home - Documentation - FAQ - Help

This is a work in progress...

The most useful information for now is located here.


Out-of-the-box, Eventum will meet many of your business needs.

Contents

[edit] Overview

I found the example customer API is a bit intimidating. Hopefully this will help clear up how customer integration can be set up to meet your need.

[edit] Database Connection

Eventum uses the Pear Database Abstraction Layer [Pear::DB] for its database connections. I will use Pear::DB in my examples to keep the code consistent with the rest of the code base.

[edit] Pear::DB

Pear::DB Package Documentation

class CRM_Customer_Backend extends Abstract_Customer_Backend
{
  
 // The database handler can only be accessed from inside this class.
 private $dbh;                       			
    
 function connect()
 {
  
   // Database connection information
   $dsn = array(
     'phptype'  => "mysql",
     'hostspec' => "localhost",
     'database' => "mydb",
     'username' => "myuser",
     'password' => "mypass"
   );
   
   // Connect to the database
   $this->dbh = DB::connect($dsn);
   
   // Confirm connection to the database -or- Error  
   if(PEAR::isError($this->dbh)) {
    die("Database Connection Error in Customer API.");
   }
    
   // Set mySQL character set to UTF-8
   $this->dbh->query("SET NAMES utf8");
 }
}

[edit] Running a Query

function getAssocList()
{
 
 // Define the array
 $assoc = array();
 
 // Run the database query
 $res = $this->dbh->query("SELECT id, name FROM accounts");
 
 // Insert the query results into the array
 while($res->fetchInto($account, DB_FETCHMODE_ASSOC)) {
  $assoc[$account['id']] = $account['name'];
 }
 
 // Release the database query
 $res->free();
 
 // Return the array
 return $assoc;
}

[edit] Customer Data

Eventum provides a mechanism to use customer records from a different source. This is accomplished by creating a customized 'Customer Integration Backend' to use.

Oddly, the example provided uses a statically defined array. This leaves it up to you to design a database and connection method.

[edit] The Backend

[edit] Getting Started

Paragraph based on workflow page, needs cleanup

First, review the example customer implementation:

 include/customer/class.example.php

This example extends the Abstract_Customer_Backend class defined in:

 include/customer/class.abstract_customer_backend.php

All methods of the Abstract_Customer_Backend class available for customization are defined in this file. For example,

if you want to customize Eventum's behaviour when closing an issue, you will be adding your own code to the handleIssueClosed() function when you extend the class. You will do this in a new file, so do not edit class.abstract_customer_backend.php.

Note that while a copy of class.example.php can be used as a basis for your own customizations, it does contain functions that affect the behaviour of Eventum, so you should remove any functions you are not using, to prevent unexpected results.

[edit] class.example.php

path_to_eventum/include/customer/class.example.php

[edit] class.abstract_customer_backend.php

path_to_eventum/include/customer/class.abstract_customer_backend.php

Use ../include/customer/class.example.php as a template for creating your own.

[edit] Paths

Files that are used reside in the following directories:

[edit] Files

path_to_eventum/templates/customer/example/report_form_fields.tpl.html

/templates/customer/example/customer_info.tpl.html

[edit] Notes

With any type of software, customization will be needed to meet the specific needs of your business.
Out-of-the-box, Eventum will meet many of your business needs. But with any type business software, customization to will be needed to address the specifics of your business processes. The 'Customer API' if one of the tools available to modify the system to your needs.

Thanks:

Retrieved from "http://forge.mysql.com/wiki/Eventum:Customer_API"

This page has been accessed 2,146 times. This page was last modified 01:09, 24 June 2009.

Find

Browse
MySQLForge
Main Page
Current events
Recent changes
Random page
Help
Edit
Edit this page
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Special pages
New pages
File list
Statistics
Bug reports
More...