Sie sind auf Seite 1von 11

Online Developer/User Group

The Mystical SugarBean Part 1 General Development Overview


Copyright 2006 SugarCRM, Inc. All rights reserved.

Functional Architecture
Deployment Options:

11/05/06

Copyright 2006 SugarCRM, Inc. All rights reserved.

UI Layer

Simple controller in index.php


Validates and manages sessions Validates and encodes posted information Authenticates users Controls actions Loads detail records Creates wrapper shell around the UI Includes the appropriate file for the right module  (action=filename, module=directory)

11/05/06

Copyright 2006 SugarCRM, Inc. All rights reserved.

SOAP API

Manages SOAP based Sessions Allows Search, Retrieve, Edit, Delete. Allows Retrieving all modified records since a given date Used for Integrations
Plug-in for Microsoft Outlook Wireless Client Application Portal Application Sync projects (Funambol) Offline Client Sync

11/05/06

Copyright 2006 SugarCRM, Inc. All rights reserved.

Functional Architecture
Deployment Options:

11/05/06

Copyright 2006 SugarCRM, Inc. All rights reserved.

Data Layer SugarBean

Business Object (Contact, Account, ) High level API for manipulating business data Abstracts away a lot of the common code from the specific modules Designed to be Sub-classed to Support Additional Methods of Retrieving Data
SOAP or EJB From Upcoming Data Layer

11/05/06

Copyright 2006 SugarCRM, Inc. All rights reserved.

Data Layer DBHelper/DBManager

Low Level database API Provides database method signature abstraction Allows for easier porting to different databases Provides for some query construction These will be growing to support more database abstraction and more database functionality

11/05/06

Copyright 2006 SugarCRM, Inc. All rights reserved.

Online Developer/User Group

The Mystical SugarBean Part 2 Custom Business Logic Hooks


Copyright 2006 SugarCRM, Inc. All rights reserved.

Business Logic Hooks

Add Custom Business Logic to the Application


Upgrade Safe Separated Code Extensions that do not risk your main code

Where is it going
Workflow in 4.0 in Professional and Enterprise Versions Deeper event triggers for external business processes Help process and handle custom data formats

Hook Events in 3.5.0


before_save Before the bean is saved after_retrieve After a bean is retrieved before_delete Before a bean is deleted after_delete After a bean is deleted before_restore Before a bean is restored after_restore After a bean is restored

11/05/06

Copyright 2006 SugarCRM, Inc. All rights reserved.

Business Logic Hooks

The custom logic file is located under custom/modules/[CURRENT_MODULE]/logic_hooks.php.


The details for format are in SugarBean.php function call_custom_logic The file should only contain the specified information and should be completely replaceable

Create a before_save hook


$hook_array['before_save'][] = Array(1, 'notify', 'custom/modules/Leads/test12.php', 'TestClass', 'lead_before_save_1'); Hooks are processed in the order in which they are defined.

The right hand side array defines


processing index (for sorting before exporting the array) Reserved for future use. php file to include php class the method is in php method to call

Hook method signature: function NAME(&$bean, $event, $arguments)


$bean - $this bean passed in by reference. $event - The string for the current event (i.e. before_save) $arguments - An array of arguments that are specific to the event.

11/05/06

Copyright 2006 SugarCRM, Inc. All rights reserved.

10

Online Developer/User Group

The Mystical SugarBean Q&A

Copyright 2006 SugarCRM, Inc. All rights reserved.

Das könnte Ihnen auch gefallen