modules/InboundEmail/InboundEmail.php

Show: inherited
Table of Contents

Functions

functionthis_callback(  $str ) : void

Parameters
Name Type Description
$str

\InboundEmail

Package:

SugarBean is the base class for all business objects in Sugar. It implements the primary functionality needed for manipulating business objects: create, retrieve, update, delete. It allows for searching and retrieving list of records.

It allows for retrieving related objects (e.g. contacts related to a specific account).

In the current implementation, there can only be one bean per folder. Naming convention has the bean name be the same as the module and folder name. All bean names should be singular (e.g. Contact). The primary table name for a bean should be plural (e.g. contacts).

Parent(s)
\SugarBean

Properties

Propertypublic  $InboundEmailCacheFile= ''InboundEmail.cache.php''
Default value'InboundEmail.cache.php'Details
Type
n/a
Propertypublic  $InboundEmailCachePath= ''
Details
Type
n/a
Propertypublic  $acltype= ''module''
inheritedInherited from: \SugarBean::$$acltype
Default value'module'Details
Type
n/a
Inherited_from
\SugarBean::$$acltype  
Propertypublic  $additional_column_fields= 'array()'
inheritedInherited from: \SugarBean::$$additional_column_fields
Default valuearray()Details
Type
n/a
Inherited_from
\SugarBean::$$additional_column_fields  
Propertypublic  $additional_meta_fields= 'array()'
inheritedInherited from: \SugarBean::$$additional_meta_fields
Default valuearray()Details
Type
n/a
Inherited_from
\SugarBean::$$additional_meta_fields  
Propertypublic  $attachmentCount= '0'
Default value0Details
Type
n/a
Propertypublic  $autoImport= ''
Details
Type
n/a
Propertypublic  $ca= ''
Details
Type
n/a
Propertypublic  $column_fields= ''
Details
Type
n/a
Propertypublic  $compoundMessageId= ''
Details
Type
n/a
Propertypublic  $conn= ''
Details
Type
n/a
Propertypublic  $created_by= ''
Details
Type
n/a
Propertypublic  $created_by_name= ''
Details
Type
n/a
Propertypublic  $currentCache= ''
Details
Type
n/a
Propertypublic  $current_notify_user= ''
inheritedInherited from: \SugarBean::$$current_notify_user
Details
Type
n/a
Inherited_from
\SugarBean::$$current_notify_user  
Propertypublic  $custom_fields= ''
inheritedInherited from: \SugarBean::$$custom_fields
Details
Type
n/a
Inherited_from
\SugarBean::$$custom_fields  
Propertypublic  $date_entered= ''
Details
Type
n/a
Propertypublic  $date_modified= ''
Details
Type
n/a
Propertypublic\DBManager  $db= ''

A pointer to the database object

Details
Type
\DBManager
Propertypublic  $dbManager= ''
Details
Type
n/a
Propertypublic  $defaultDirection= '"DESC"'
Default value"DESC"Details
Type
n/a
Propertypublic  $defaultEmailNumAutoreplies24Hours= '10'
Default value10Details
Type
n/a
Propertypublic  $defaultSort= ''date''
Default value'date'Details
Type
n/a
Propertypublic  $delete_seen= ''
Details
Type
n/a
PropertypublicBOOL  $deleted= ''

true if this bean has been deleted, false otherwise.

Details
Type
BOOL
Propertypublic  $disable_custom_fields= 'false'
inheritedInherited from: \SugarBean::$$disable_custom_fields
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarBean::$$disable_custom_fields  
PropertypublicBOOL  $disable_row_level_security= 'true'

Pro Only -- When all data of a specifiy module is publically available, row level security can be turned off. This should only be used for modules that do not need row level security.

-- default false
Default valuetrueDetails
Type
BOOL
PropertypublicBOOL  $disable_vardefs= 'false'
inherited

Disble vardefs. This should be set to true only for beans that do not have varders. Tracker is an example

-- default falseInherited from: \SugarBean::$$disable_vardefs
Default valuefalseDetails
Type
BOOL
Inherited_from
\SugarBean::$$disable_vardefs  
PropertypublicBOOL  $duplicates_found= 'false'
inherited

When running a query on related items using the method: retrieve_by_string_fields this value will be set to true if more than one item matches the search criteria.

Inherited from: \SugarBean::$$duplicates_found
Default valuefalseDetails
Type
BOOL
Inherited_from
\SugarBean::$$duplicates_found  
Propertypublic  $email= ''
Details
Type
n/a
Propertypublic  $email_password= ''
Details
Type
n/a
Propertypublic  $email_user= ''
Details
Type
n/a
Propertypublic  $fetched_row= 'false'
inheritedInherited from: \SugarBean::$$fetched_row
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarBean::$$fetched_row  
Propertypublic  $field_defs= ''
Details
Type
n/a
Propertypublic  $field_name_map= ''
inheritedInherited from: \SugarBean::$$field_name_map
Details
Type
n/a
Inherited_from
\SugarBean::$$field_name_map  
Propertypublic  $force_load_details= 'false'
inheritedInherited from: \SugarBean::$$force_load_details
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarBean::$$force_load_details  
Propertypublic  $global_personal_string= ''
Details
Type
n/a
Propertypublic  $group_id= ''
Details
Type
n/a
Propertypublic  $groupfolder_id= ''
Details
Type
n/a
Propertypublic  $hrSort= 'array( 0 => 'flagged', 1 => 'status', 2 => 'from', 3 => 'subj', 4 => 'date', )'
Default valuearray( 0 => 'flagged', 1 => 'status', 2 => 'from', 3 => 'subj', 4 => 'date', )Details
Type
n/a
Propertypublic  $hrSortLocal= 'array( 'flagged' => 'flagged', 'status' => 'answered', 'from' => 'fromaddr', 'subject' => 'subject', 'date' => 'senddate', )'
Default valuearray( 'flagged' => 'flagged', 'status' => 'answered', 'from' => 'fromaddr', 'subject' => 'subject', 'date' => 'senddate', )Details
Type
n/a
Propertypublic  $iconAnswered= '"A"'
Default value"A"Details
Type
n/a
Propertypublic  $iconDeleted= '"del"'
Default value"del"Details
Type
n/a
Propertypublic  $iconDraft= '"D"'
Default value"D"Details
Type
n/a
Propertypublic  $iconFlagged= '"F"'
Default value"F"Details
Type
n/a
Propertypublic  $id= ''
Details
Type
n/a
Propertypublic  $imagePrefix= ''
Details
Type
n/a
Propertypublic  $imageTypes= 'array("JPG", "JPEG", "GIF", "PNG")'
Default valuearray("JPG", "JPEG", "GIF", "PNG")Details
Type
n/a
Propertypublicarray  $imap_types= 'array( 0 => 'text', 1 => 'multipart', 2 => 'message', 3 => 'application', 4 => 'audio', 5 => 'image', 6 => 'video', )'

Primary body types for a part of a mail structure (imap_fetchstructure returned object)

Default valuearray( 0 => 'text', 1 => 'multipart', 2 => 'message', 3 => 'application', 4 => 'audio', 5 => 'image', 6 => 'video', )Details
Type
array
Propertypublic  $importable= 'false'
inherited

Set to true in the child beans if the module supports importing

Inherited from: \SugarBean::$$importable
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarBean::$$importable  
Propertypublic  $in_import= 'false'
inherited

Set to true in <modules>/Import/views/view.step4.php if a module is being imported

Inherited from: \SugarBean::$$in_import
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarBean::$$in_import  
Propertypublic  $in_workflow= 'false'
inherited

Set to true if the bean is being dealt with in a workflow

Inherited from: \SugarBean::$$in_workflow
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarBean::$$in_workflow  
Propertypublic  $inlineImages= 'array()'
Default valuearray()Details
Type
n/a
Propertypublic  $isAutoImport= 'false'
Default valuefalseDetails
Type
n/a
Propertypublic  $is_personal= ''
Details
Type
n/a
Propertyprotected  $is_updated_dependent_fields= 'false'
inherited

set to true if dependent fields updated

Inherited from: \SugarBean::$$is_updated_dependent_fields
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarBean::$$is_updated_dependent_fields  
Propertypublic  $keyForUsersDefaultIEAccount= ''defaultIEAccount''
Default value'defaultIEAccount'Details
Type
n/a
Propertypublic  $layout_def= ''
inheritedInherited from: \SugarBean::$$layout_def
Details
Type
n/a
Inherited_from
\SugarBean::$$layout_def  
Propertypublic  $list_fields= 'array()'
inheritedInherited from: \SugarBean::$$list_fields
Default valuearray()Details
Type
n/a
Inherited_from
\SugarBean::$$list_fields  
Propertypublic  $listview_inner_join= 'array()'
inherited

Used to pass inner join string to ListView Data.

Inherited from: \SugarBean::$$listview_inner_join
Default valuearray()Details
Type
n/a
Inherited_from
\SugarBean::$$listview_inner_join  
Propertyprotectedarray  $loaded_relationships= 'array()'
inherited

A way to keep track of the loaded relationships so when we clone the object we can unset them.

Inherited from: \SugarBean::$$loaded_relationships
Default valuearray()Details
Type
array
Inherited_from
\SugarBean::$$loaded_relationships  
Propertypublic  $mailbox= ''
Details
Type
n/a
Propertypublic  $mailbox_type= ''
Details
Type
n/a
Propertypublic  $mailbox_type_name= ''
Details
Type
n/a
Propertypublic  $mailboxarray= ''
Details
Type
n/a
Propertypublic  $maxEmailNumAutoreplies24Hours= '10'
Default value10Details
Type
n/a
Propertyprotectedint  $max_logic_depth= '10'
inherited

How deep logic hooks can go

Inherited from: \SugarBean::$$max_logic_depth
Default value10Details
Type
int
Inherited_from
\SugarBean::$$max_logic_depth  
Propertypublic  $modified_by_name= ''
Details
Type
n/a
Propertypublic  $modified_user_id= ''
Details
Type
n/a
PropertypublicString  $module_dir= ''InboundEmail''

The name of the module folder for this type of bean.

Default value'InboundEmail'Details
Type
String
Propertypublic  $module_name= ''''
inheritedInherited from: \SugarBean::$$module_name
Default value''Details
Type
n/a
Inherited_from
\SugarBean::$$module_name  
Propertypublic  $name= ''
Details
Type
n/a
PropertypublicString  $new_assigned_user_name= ''
inherited

holds the full name of the user that an item is assigned to. Only used if notifications are turned on and going to be sent out.

Inherited from: \SugarBean::$$new_assigned_user_name
Details
Type
String
Inherited_from
\SugarBean::$$new_assigned_user_name  
Propertypublic  $new_schema= 'true'
Default valuetrueDetails
Type
n/a
PropertypublicBOOL  $new_with_id= 'false'
inherited

When createing a bean, you can specify a value in the id column as long as that value is unique. During save, if the system finds an id, it assumes it is an update. Setting new_with_id to true will make sure the system performs an insert instead of an update.

-- default falseInherited from: \SugarBean::$$new_with_id
Default valuefalseDetails
Type
BOOL
Inherited_from
\SugarBean::$$new_with_id  
Propertypublic  $number_formatting_done= 'false'
inheritedInherited from: \SugarBean::$$number_formatting_done
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarBean::$$number_formatting_done  
PropertypublicString  $object_name= ''InboundEmail''

This is the singular name of the bean. (i.e. Contact).

Default value'InboundEmail'Details
Type
String
Propertypublic  $optimistic_lock= 'false'
inheritedInherited from: \SugarBean::$$optimistic_lock
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarBean::$$optimistic_lock  
Propertypublic  $order_by= ''
Details
Type
n/a
Propertypublic  $outboundInstance= ''
Details
Type
n/a
Propertypublic  $pop3socket= ''
Details
Type
n/a
Propertypublic  $port= ''
Details
Type
n/a
Propertypublic  $process_field_encrypted= 'false'
inheritedInherited from: \SugarBean::$$process_field_encrypted
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarBean::$$process_field_encrypted  
PropertypublicBOOL  $process_save_dates= 'true'

Whether to process date/time fields for storage in the database in GMT

Default valuetrueDetails
Type
BOOL
PropertypublicArray  $processed_dates_times= 'array()'
inherited

An array of booleans. This array is cleared out when data is loaded.

of booleansInherited from: \SugarBean::$$processed_dates_times

As date/times are converted, a "1" is placed under the key, the field is converted.

Default valuearray()Details
Type
Array
Inherited_from
\SugarBean::$$processed_dates_times  
Propertypublic  $protocol= ''
Details
Type
n/a
Propertypublic  $purifier= ''
Details
Type
n/a
Propertypublic  $rel_handler= ''
inheritedInherited from: \SugarBean::$$rel_handler
Details
Type
n/a
Inherited_from
\SugarBean::$$rel_handler  
Propertypublic  $relationship_fields= 'array()'
inheritedInherited from: \SugarBean::$$relationship_fields
Default valuearray()Details
Type
n/a
Inherited_from
\SugarBean::$$relationship_fields  
Propertypublic  $required_fields= 'array('name' => 'name', 'server_url' => 'server_url', 'mailbox' => 'mailbox', 'user' => 'user', 'port' => 'port', )'
Default valuearray('name' => 'name', 'server_url' => 'server_url', 'mailbox' => 'mailbox', 'user' => 'user', 'port' => 'port', )Details
Type
n/a
PropertypublicBOOL  $save_from_post= 'true'
inherited

This signals to the bean that it is being saved in a mass mode.

Inherited from: \SugarBean::$$save_from_post

Examples of this kind of save are import and mass update. We turn off notificaitons of this is the case to make things more efficient.

Default valuetrueDetails
Type
BOOL
Inherited_from
\SugarBean::$$save_from_post  
Propertypublic  $serverConnectString= ''
Details
Type
n/a
Propertypublic  $server_url= ''
Details
Type
n/a
Propertypublic  $service= ''
Details
Type
n/a
Propertypublic\unknown_type  $set_created_by= 'true'
inherited

This allows for seed data to be created without using the current uesr to set the id.

Inherited from: \SugarBean::$$set_created_by

This should be replaced by altering the current user before the call to save.

Default valuetrueDetails
Type
\unknown_type
Inherited_from
\SugarBean::$$set_created_by  
Propertypublic  $smarty= ''
Details
Type
n/a
Propertypublic  $special_notification= 'false'
inherited

Set to true in the child beans if the module use the special notification template

Inherited from: \SugarBean::$$special_notification
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarBean::$$special_notification  
Propertypublic  $ssl= ''
Details
Type
n/a
Propertypublic  $status= ''
Details
Type
n/a
Propertypublic  $stored_options= ''
Details
Type
n/a
PropertypublicString  $table_name= ''inbound_email''

The database table where records of this Bean are stored.

Default value'inbound_email'Details
Type
String
Propertypublic  $team_set_id= ''
inheritedInherited from: \SugarBean::$$team_set_id
Details
Type
n/a
Inherited_from
\SugarBean::$$team_set_id  
Propertypublic  $tempAttachment= 'array()'
Default valuearray()Details
Type
n/a
Propertypublic  $template_id= ''
Details
Type
n/a
Propertypublic  $tls= ''
Details
Type
n/a
Propertypublic  $tracker_visibility= 'true'
inherited

By default it will be true but if any module is to be kept non visible to tracker, then its value needs to be overriden in that particular module to false.

Inherited from: \SugarBean::$$tracker_visibility
Default valuetrueDetails
Type
n/a
Inherited_from
\SugarBean::$$tracker_visibility  
Propertypublic  $transferEncoding= 'array(0 => '7BIT', 1 => '8BIT', 2 => 'BINARY', 3 => 'BASE64', 4 => 'QUOTED-PRINTABLE', 5 => 'OTHER' )'
Default valuearray(0 => '7BIT', 1 => '8BIT', 2 => 'BINARY', 3 => 'BASE64', 4 => 'QUOTED-PRINTABLE', 5 => 'OTHER' )Details
Type
n/a
Propertypublic  $ungreedy_count= 'false'
inherited

Set this to true if you query contains a sub-select and bean is converting both select statements into count queries.

Inherited from: \SugarBean::$$ungreedy_count
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarBean::$$ungreedy_count  
Propertypublic  $unsafeChars= 'array("&", "!", "'", '"', '\\', '/', '<', '>', '|', '$',)'
Default valuearray("&", "!", "'", '"', '\\', '/', '<', '>', '|', '$',)Details
Type
n/a
PropertypublicBOOL  $update_date_entered= 'false'
inherited

Setting this to true allows for updates to overwrite the date_entered

Inherited from: \SugarBean::$$update_date_entered
Default valuefalseDetails
Type
BOOL
Inherited_from
\SugarBean::$$update_date_entered  
PropertypublicBOOL  $update_date_modified= 'true'
inherited

Should the date modified column of the bean be updated during save? This is used for admin level functionality that should not be updating the date modified. This is only used by sync to allow for updates to be replicated in a way that will not cause them to be replicated back.

Inherited from: \SugarBean::$$update_date_modified
Default valuetrueDetails
Type
BOOL
Inherited_from
\SugarBean::$$update_date_modified  
PropertypublicBOOL  $update_modified_by= 'true'
inherited

Should the modified by column of the bean be updated during save? This is used for admin level functionality that should not be updating the modified by column. This is only used by sync to allow for updates to be replicated in a way that will not cause them to be replicated back.

Inherited from: \SugarBean::$$update_modified_by
Default valuetrueDetails
Type
BOOL
Inherited_from
\SugarBean::$$update_modified_by  
Propertypublic  $vardef_handler= ''
inheritedInherited from: \SugarBean::$$vardef_handler
Details
Type
n/a
Inherited_from
\SugarBean::$$vardef_handler  

Methods

methodpublicACLAccess( \$view $view, \$is_owner $is_owner = 'not_set' ) : void
inherited

Check whether the user has access to a particular view for the current bean/module

Inherited from: \SugarBean::ACLAccess()
Parameters
Name Type Description
$view \$view

string required, the view to determine access for i.e. DetailView, ListView...

$is_owner \$is_owner

bool optional, this is part of the ACL check if the current user is an owner they will receive different access

methodpublicACLFilterFields(  $view = 'detail' ) : void
inherited

Inherited from: \SugarBean::ACLFilterFields()
Parameters
Name Type Description
$view
methodpublicInboundEmail( ) : void

Sole constructor

methodpublicSugarBean( ) : void
inherited

Constructor for the bean, it performs following tasks:

Inherited from: \SugarBean::SugarBean()
  1. Initalized a database connections
  2. Load the vardefs for the module implemeting the class. cache the entries if needed
  3. Setup row-level security preference All implementing classes must call this constructor using the parent::SugarBean() class.
methodpublic__clone( ) : void
inherited

Handle the following when a SugarBean object is cloned

Inherited from: \SugarBean::__clone()

Currently all this does it unset any relationships that were created prior to cloning the object

Details
Api
 
methodprivate_checkOptimisticLocking(  $action,  $isUpdate ) : void
inherited

Moved from save() method, functionality is the same, but this is intended to handle Optimistic locking functionality.

Inherited from: \SugarBean::_checkOptimisticLocking()
Parameters
Name Type Description
$action
$isUpdate
methodpublic_get_num_rows_in_query( string $query, boolean $is_count_query = false ) : int
inherited

Returns the number of rows that the given SQL query should produce

Inherited from: \SugarBean::_get_num_rows_in_query()

Internal function, do not override.

Parameters
Name Type Description
$query string

valid select query

$is_count_query boolean

Optional, Default false, set to true if passed query is a count query.

Returns
Type Description
int count of rows found
methodprivate_loadCachedArray( \$module_dir $module_dir, \$module $module, \$key $key ) : void
inherited

This function is designed to cache references to field arrays that were previously stored in the bean files and have since been moved to separate files. Was previously in include/CacheHandler.php

Inherited from: \SugarBean::_loadCachedArray()
Parameters
Name Type Description
$module_dir \$module_dir

string the module directory

$module \$module

string the name of the module

$key \$key

string the type of field array we are referencing, i.e. list_fields, column_fields, required_fields

methodprivate_sendNotifications(  $check_notify ) : void
inherited

Send assignment notifications and invites for meetings and calls

Inherited from: \SugarBean::_sendNotifications()
Parameters
Name Type Description
$check_notify
methodpublicaddBreadCrumbOffset( string $bc, string $offset ) : string

Givin an existing breadcrumb add a cooresponding offset

Parameters
Name Type Description
$bc string
$offset string
Returns
Type Description
string
methodpublicadd_address_streets( string $street_field ) : void
inherited

Combined the contents of street field 2 thru 4 into the main field

Inherited from: \SugarBean::add_address_streets()
Parameters
Name Type Description
$street_field string
methodpublicadd_list_count_joins( string $query, string $where ) : void
inherited

Add any required joins to the list count query. The joins are required if there is a field in the $where clause that needs to be joined.

Inherited from: \SugarBean::add_list_count_joins()
Parameters
Name Type Description
$query string
$where string

Internal Function, do Not override.

methodpublicadd_team_security_where_clause(  $query,  $table_alias = '',  $join_type = 'INNER',  $force_admin = false,  $join_teams = false ) : void
inherited

Add a join to the query to enforce the data returned will only be for teams to which this user has membership

Inherited from: \SugarBean::add_team_security_where_clause()

Internal function, do not override.

Parameters
Name Type Description
$query
$table_alias
$join_type
$force_admin
$join_teams
methodpublicafterImportSave( ) : void
inherited

Called during the import process after a bean save, to handle any needed post-save logic when importing a record

Inherited from: \SugarBean::afterImportSave()
methodpublicassign_display_fields(  $currentModule ) : void
inherited

Inherited from: \SugarBean::assign_display_fields()
Parameters
Name Type Description
$currentModule
methodpublicbean_implements(  $interface ) : void
inherited

Inherited from: \SugarBean::bean_implements()
Parameters
Name Type Description
$interface
methodpublicbeforeImportSave( ) : void
inherited

Called during the import process before a bean save, to handle any needed pre-save logic when importing a record

Inherited from: \SugarBean::beforeImportSave()
methodpublicbuildBreadCrumbs( \$parts $parts, \$subtype $subtype, \$breadcrumb $breadcrumb = '0' ) : void

Builds up the "breadcrumb" trail that imap_fetchbody() uses to return parts of an email message, including attachments and inline images

Parameters
Name Type Description
$parts \$parts

array of objects

$subtype \$subtype

what type of trail to return? HTML? Plain? binaries?

$breadcrumb \$breadcrumb

text trail to build up

methodpublicbuildBreadCrumbsHTML( array $parts, int $breadcrumb = '0', array $stackedBreadcrumbs = array() ) : array

Similar to buildBreadCrumbs() but returns an ordered array containing all parts of the message that would be considered "HTML" or Richtext (embedded images, formatting, etc.).

Parameters
Name Type Description
$parts array

parts Array of parts of a message

$breadcrumb int

breadcrumb Passed integer value to start breadcrumb trail

$stackedBreadcrumbs array

stackedBreadcrumbs Persistent trail of breadcrumbs

Returns
Type Description
array Ordered array of parts to retrieve via imap_fetchbody()
methodpublicbuild_generic_where_clause(  $value ) : void
inherited

Override this function to build a where clause based on the search criteria set into bean .

Inherited from: \SugarBean::build_generic_where_clause()
Parameters
Name Type Description
$value
Details
Abstract
 
methodpublicbuild_related_in( string $query ) : void
inherited

Constructs an comma separated list of ids from passed query results.

Inherited from: \SugarBean::build_related_in()
Parameters
Name Type Description
$query string

@query query to be executed.

methodpublicbuild_related_list( string $query, object $template, int $row_offset = 0, int $limit = -1 ) : array
inherited

This function is used to execute the query and create an array template objects from the resulting ids from the query.

Inherited from: \SugarBean::build_related_list()

It is currently used for building sub-panel arrays.

Parameters
Name Type Description
$query string
  • the query that should be executed to build the list
$template object
  • The object that should be used to copy the records.
$row_offset int

Optional, default 0

$limit int

Optional, default -1

Returns
Type Description
array
methodpublicbuild_related_list2( string $query, object $template, array $field_list ) : array
inherited

Optionally copies values from fetched row into the bean.

Inherited from: \SugarBean::build_related_list2()

Internal function, do not override.

Parameters
Name Type Description
$query string
  • the query that should be executed to build the list
$template object
  • The object that should be used to copy the records
$field_list array

List of fields.

Returns
Type Description
array
methodpublicbuild_related_list_where( string $query, object $template,  $where = '',  $in = '',  $order_by,  $limit = '',  $row_offset = 0 ) : void
inherited

This function is used to execute the query and create an array template objects from the resulting ids from the query.

Inherited from: \SugarBean::build_related_list_where()

It is currently used for building sub-panel arrays. It supports an additional where clause that is executed as a filter on the results

Parameters
Name Type Description
$query string
  • the query that should be executed to build the list
$template object
  • The object that should be used to copy the records.
$where
$in
$order_by
$limit
$row_offset
methodprotectedbuild_sub_queries_for_union(  $subpanel_list,  $subpanel_def,  $parentbean,  $order_by ) : void
staticinherited

Inherited from: \SugarBean::build_sub_queries_for_union()
Parameters
Name Type Description
$subpanel_list
$subpanel_def
$parentbean
$order_by
methodpubliccall_custom_logic(  $event,  $arguments = null ) : void
inherited

Trigger custom logic for this module that is defined for the provided hook The custom logic file is located under custom/modules/[CURRENT_MODULE]/logic_hooks.php.

Inherited from: \SugarBean::call_custom_logic()

That file should define the $hook_version that should be used. It should also define the $hook_array. The $hook_array will be a two dimensional array the first dimension is the name of the event, the second dimension is the information needed to fire the hook. Each entry in the top level array should be defined on a single line to make it easier to automatically replace this file. There should be no contents of this file that are not replacable.

$hook_array['before_save'][] = Array(1, testtype, 'custom/modules/Leads/test12.php', 'TestClass', 'lead_before_save_1'); This sample line creates a before_save hook. The hooks are procesed in the order in which they are added to the array. The second dimension is an array of: processing index (for sorting before exporting the array) A logic type hook label/type php file to include php class the method is in php method to call

The method signature for version 1 hooks is: 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.

Parameters
Name Type Description
$event
$arguments
methodpubliccall_relationship_handler(  $target_base = "module_dir",  $return_handler = false ) : void
inherited

Inherited from: \SugarBean::call_relationship_handler()
Parameters
Name Type Description
$target_base
$return_handler
methodpubliccall_vardef_handler(  $meta_array_type = null ) : void
inherited

Inherited from: \SugarBean::call_vardef_handler()
Parameters
Name Type Description
$meta_array_type
methodpubliccheckEmail(  $prefetch = true,  $synch = false ) : void

update INBOX

Parameters
Name Type Description
$prefetch
$synch
methodpubliccheckEmail2_meta( ) : void

methodpubliccheckEmailIMAPPartial(  $prefetch = true,  $synch = false ) : void

Parameters
Name Type Description
$prefetch
$synch
methodpubliccheckEmailOneMailbox( string $mailbox, bool $prefetch = true,  $synchronize = false ) : void

Checks email (local caching too) for one mailbox

Parameters
Name Type Description
$mailbox string

IMAP Mailbox path

$prefetch bool

Flag to prefetch email body on check

$synchronize
methodpubliccheckEmailOneMailboxPartial( string $mailbox, bool $prefetch = true,  $synchronize = false,  $start = 0,  $max = -1 ) : void

Checks email (local caching too) for one mailbox

Parameters
Name Type Description
$mailbox string

IMAP Mailbox path

$prefetch bool

Flag to prefetch email body on check

$synchronize
$start
$max
methodpubliccheckFilterDomain( object $email ) : bool

returns true if the email's domain is NOT in the filter domain string

Parameters
Name Type Description
$email object

email Email object in question

Returns
Type Description
bool true if not filtered, false if filtered
methodpubliccheckImap( ) : void

methodpubliccheckOutOfOffice( string $subject ) : bool

returns true if subject is NOT "out of the office" type

Parameters
Name Type Description
$subject string

subject Subject line of email in question

Returns
Type Description
bool returns false if OOTO found
methodpubliccheck_date_relationships_load( ) : \this
inherited

This function retrieves a record of the appropriate type from the DB.

Inherited from: \SugarBean::check_date_relationships_load()

It fills in all of the fields from the DB into the object it was called on.

Returns
Type Description
\this - The object that it was called apon or null if exactly 1 record was not found.
methodpubliccleanBean( ) : void
inherited

Cleans char, varchar, text, etc. fields of XSS type materials

Inherited from: \SugarBean::cleanBean()
methodpubliccleanOutCache( ) : void

Clears out cache files for a user

methodpubliccollapseLongMailingList( string $emails ) : string

Takes a long list of email addresses from a To or CC field and shows the first 3, the rest hidden

Parameters
Name Type Description
$emails string

emails

Returns
Type Description
string
methodpublicconnectMailserver( bool $test = false, bool $force = false ) : string

Connects to mailserver. If an existing IMAP resource is available, it will attempt to reuse the connection, updating the mailbox path.

Parameters
Name Type Description
$test bool

test Flag to test connection

$force bool

force Force reconnect

Returns
Type Description
string "true" on success, "false" or $errorMessage on failure
methodpublicconvertField(  $fieldvalue,  $fieldDef ) : string
inherited

Converts the field value based on the provided fieldDef

Inherited from: \SugarBean::convertField()
Parameters
Name Type Description
$fieldvalue
$fieldDef
Returns
Type Description
string
methodpublicconvertImapToSugarEmailAddress( \$arr $arr ) : void

Takes a PHP imap_* object's to/from/cc/bcc address field and converts it to a standard string that SugarCRM expects

Parameters
Name Type Description
$arr \$arr

an array of email address objects

methodpublicconvertRow( array $row ) : array
inherited

Convert row data from DB format to internal format Mostly useful for dates/times

Inherited from: \SugarBean::convertRow()
Parameters
Name Type Description
$row array
Returns
Type Description
array $row
methodpublicconvertToUtf8( string $input ) : string

helper method to convert text to utf-8 if necessary

Parameters
Name Type Description
$input string

text

Returns
Type Description
string output text
methodpubliccopyEmails( string $fromIe, string $fromFolder, string $toIe, string $toFolder, string $uids ) : void

moves emails from folder to folder

Parameters
Name Type Description
$fromIe string

I-E id

$fromFolder string

IMAP path to folder in which the email lives

$toIe string

I-E id

$toFolder string
$uids string

UIDs of emails to move, either Sugar GUIDS or IMAP UIDs

methodpubliccreateAutoImportSugarFolder( ) : String

Create a sugar folder for this inbound email account if the Enable Auto Import option is selected

Returns
Type Description
String Id of the sugar folder created.
methodpubliccreateRelationshipMeta( string $key, object $db, string $tablename, array $dictionary, string $module_dir, boolean $iscustom = false ) : void
inherited

Populates the relationship meta for a module.

Inherited from: \SugarBean::createRelationshipMeta()

It is called during setup/install. It is used statically to create relationship meta data for many-to-many tables.

Parameters
Name Type Description
$key string

name of the object.

$db object

database handle.

$tablename string

table, meta data is being populated for.

$dictionary array

dictionary vardef dictionary for the object. *

$module_dir string

module_dir name of subdirectory where module is installed.

$iscustom boolean

Optional,set to true if module is installed in a custom directory. Default value is false.

Details
Static
Internal function, do not override.  
methodpubliccreateUserSubscriptionsForGroupAccount( ) : void

For a group email account, create subscriptions for all users associated with the team assigned to the account.

methodpubliccreate_audit_table( ) : void
inherited

If auditing is enabled, create the audit table.

Inherited from: \SugarBean::create_audit_table()

Function is used by the install scripts and a repair utility in the admin panel.

Internal function, do not override.

methodpubliccreate_export_query( string $order_by, string $where,  $show_deleted = 0 ) : string

Override's SugarBean's

Parameters
Name Type Description
$order_by string
$where string
$show_deleted
Returns
Type Description
string SQL query
methodpubliccreate_index(  $query ) : void
inherited

This is a helper function that is used to quickly created indexes when creating tables.

Inherited from: \SugarBean::create_index()
Parameters
Name Type Description
$query
methodpubliccreate_list_count_query( string $query ) : string
inherited

Changes the select expression of the given query to be 'count(*)' so you can get the number of items the query will return. This is used to populate the upper limit on ListViews.

Inherited from: \SugarBean::create_list_count_query()
Parameters
Name Type Description
$query string

Select query string

Returns
Type Description
string count query Internal function, do not override.
methodpubliccreate_new_list_query( string $order_by, string $where, array $filter = array(), array $params = array(), int $show_deleted = 0, string $join_type = '', boolean $return_array = false, object $parentbean = null, boolean $singleSelect = false,  $ifListForExport = false ) : String
inherited

Return the list query used by the list views and export button. Next generation of create_new_list_query function.

Inherited from: \SugarBean::create_new_list_query()

Override this function to return a custom query.

Parameters
Name Type Description
$order_by string

custom order by clause

$where string

custom where clause

$filter array

Optioanal

$params array

Optional *

$show_deleted int

Optional, default 0, show deleted records is set to 1.

$join_type string
$return_array boolean

Optional, default false, response as array

$parentbean object

creating a subquery for this bean.

$singleSelect boolean

Optional, default false.

$ifListForExport
Returns
Type Description
String select query string, optionally an array value will be returned if $return_array= true.
methodpubliccreate_notification_email( string $notify_user ) : void
inherited

This function handles create the email notifications email.

Inherited from: \SugarBean::create_notification_email()
Parameters
Name Type Description
$notify_user string

the user to send the notification email to

methodpubliccreate_qualified_order_by( string $order_by, string $qualify ) : \prefixed
inherited

Ensure that fields within order by clauses are properly qualified with their tablename. This qualification is a requirement for sql server support.

Inherited from: \SugarBean::create_qualified_order_by()
Parameters
Name Type Description
$order_by string

original order by from the query

$qualify string

prefix for columns in the order by list.

Returns
Type Description
\prefixed Internal function do not override.
methodpubliccreate_relationship_meta(  $key,  $db,  $log,  $tablename,  $dictionary,  $module_dir ) : void
inherited

This method has been deprecated.

Inherited from: \SugarBean::create_relationship_meta()
Parameters
Name Type Description
$key
$db
$log
$tablename
$dictionary
$module_dir
Details
See
\createRelationshipMeta()  
Static
 
methodpubliccreate_tables( ) : void
inherited

Creates tables for the module implementing the class.

Inherited from: \SugarBean::create_tables()

If you override this function make sure that your code can handles table creation.

methodpubliccustomGetMessageText( string $msgPart ) : string

Called from $this->getMessageText() Allows upgrade-safe custom processing of message text.

To use: 1. Create a directory path: ./custom/modules/InboundEmail if it does not exist 2. Create a file in the ./custom/InboundEmail/ folder called "getMessageText.php" 3. Define a function named "custom_getMessageText()" that takes a string as an argument and returns a string

Parameters
Name Type Description
$msgPart string
Returns
Type Description
string
methodpublicdecodeHeader( \header $fullHeader ) : \decodedHeader

decodes raw header information and passes back an associative array with the important elements key'd by name

Parameters
Name Type Description
$fullHeader \header

string the raw header

Returns
Type Description
\decodedHeader array the associative array
methodpublicdecrypt_after_retrieve( STRING $value ) : string
inherited

Decode and decrypt a base 64 encoded string with field type 'encrypt' in this bean using Blowfish.

Inherited from: \SugarBean::decrypt_after_retrieve()
Parameters
Name Type Description
$value STRING

value - an encrypted and base 64 encoded string.

Returns
Type Description
string
methodpublicdeleteCache( ) : void

Deletes all rows for a given instance

methodpublicdeleteCachedMessages( string $uids, string $fromFolder ) : void

Deletes cached messages when moving from folder to folder

Parameters
Name Type Description
$uids string
$fromFolder string
methodpublicdeleteFolder( string $mbox ) : bool

Deletes the specified folder

Parameters
Name Type Description
$mbox string

"::" delimited IMAP mailbox path, ie, INBOX.saved.stuff

Returns
Type Description
bool
methodpublicdeleteMessageFromCache( string $uids ) : void

Removes an email from the cache file, deletes the message from the cache too

Parameters
Name Type Description
$uids string

String of uids, comma delimited

methodpublicdeleteMessageOnMailServer( string $uid ) : bool

deletes and expunges emails on server

Parameters
Name Type Description
$uid string

UID(s), comma delimited, of email(s) on server

Returns
Type Description
bool true on success
methodpublicdeleteMessageOnMailServerForPop3( string $uid ) : void

deletes and expunges emails on server

Parameters
Name Type Description
$uid string

UID(s), comma delimited, of email(s) on server

methodpublicdeletePersonalEmailAccount( string $id, string $user_name ) : bool

soft deletes a User's personal inbox

Parameters
Name Type Description
$id string

id I-E id

$user_name string

user_name User name of User in focus, NOT current_user

Returns
Type Description
bool True on success
methodpublicdeletePop3Cache( ) : void

Deletes all the pop3 data which has been deleted from server

methodpublicdelete_linked( string $id ) : void
inherited

Iterates through all the relationships and deletes all records for reach relationship.

Inherited from: \SugarBean::delete_linked()
Parameters
Name Type Description
$id string

Primary key value of the parent reocrd

methodpublicdisconnectMailserver( ) : void

methodpublicdisplayFetchedSortedListXML(  $ret,  $mbox ) : void

Parameters
Name Type Description
$ret
$mbox
methodpublicdisplayFolderContents( string $mbox, string $forceRefresh = 'false',  $page ) : void

Returns a list of emails in a mailbox.

Parameters
Name Type Description
$mbox string

mbox Name of mailbox using dot notation paths to display

$forceRefresh string

Flag to use cache or not

$page
methodpublicdisplayOneEmail( int $uid, string $mbox, bool $isMsgNo = false ) : void

Shows one email.

Parameters
Name Type Description
$uid int

uid UID of email to display

$mbox string

mbox Mailbox to look in for the message

$isMsgNo bool

isMsgNo Flag to assume $uid is a MessageNo, not UniqueID, default false

methodpublicdrop_tables( ) : void
inherited

Delete the primary table for the module implementing the class.

Inherited from: \SugarBean::drop_tables()

If custom fields were added to this table/module, the custom table will be removed too, along with the cache entries that define the custom fields.

methodpublicemptyTrash( ) : void

Empties Trash folders

methodpublicencrpyt_before_save( STRING $value ) : string
inherited

Encrpyt and base64 encode an 'encrypt' field type in the bean using Blowfish. The default system key is stored in cache/Blowfish/{keytype}

Inherited from: \SugarBean::encrpyt_before_save()
Parameters
Name Type Description
$value STRING

value -plain text value of the bean field.

Returns
Type Description
string
methodpublicfetchCheckedEmails( array $fetchedOverviews ) : void

Check email prefetches email bodies for quicker display

Parameters
Name Type Description
$fetchedOverviews array

array of fetched overviews

methodpublicfill_in_additional_detail_fields( ) : void

Override's SugarBean's

This allows the generic query to fill in the major fields, and then targeted queries to get related fields and add them to the record. The contact's account for instance. This method is only used for populating extra fields in the detail form

methodpublicfill_in_additional_list_fields( ) : void

Override's SugarBean's

This allows the generic query to fill in the major fields, and then targeted queries to get related fields and add them to the record. The contact's account for instance. This method is only used for populating extra fields in lists.

methodpublicfill_in_additional_parent_fields( ) : void
inherited

This is desgined to be overridden or called from extending bean. This method will fill in any parent_name fields.

Inherited from: \SugarBean::fill_in_additional_parent_fields()
methodpublicfill_in_link_field(  $linkFieldName,  $def ) : void
inherited

Inherited from: \SugarBean::fill_in_link_field()
Parameters
Name Type Description
$linkFieldName
$def
methodpublicfill_in_relationship_fields( ) : void
inherited

Fill in fields where type = relate

Inherited from: \SugarBean::fill_in_relationship_fields()
methodpublicfilterMailBoxFromRaw(  $mailboxArray,  $rawArray ) : void

Parameters
Name Type Description
$mailboxArray
$rawArray
methodpublicfindOptimumSettings(  $useSsl = false,  $user = '',  $pass = '',  $server = '',  $port = '',  $prot = '',  $mailbox = '' ) : void

Programatically determines best-case settings for imap_open()

Parameters
Name Type Description
$useSsl
$user
$pass
$server
$port
$prot
$mailbox
methodpublicfixUpFormatting( ) : void
inherited

Function corrects any bad formatting done by 3rd party/custom code

Inherited from: \SugarBean::fixUpFormatting()

This function will be removed in a future release, it is only here to assist upgrading existing code that expects formatted data in the bean

methodpublicformat_all_fields( ) : void
inherited

This functions adds formatting to all number fields before presenting them to user interface.

Inherited from: \SugarBean::format_all_fields()

Internal function, do not override.

methodpublicformat_field(  $fieldDef ) : void
inherited

Inherited from: \SugarBean::format_field()
Parameters
Name Type Description
$fieldDef
methodpublicfromArray( Array $arr ) : void
inherited

Converts an array into an acl mapping name value pairs into files

Inherited from: \SugarBean::fromArray()
Parameters
Name Type Description
$arr Array
methodpublicgenerateArrayData(  $key,  $arraymbox,  $ret,  $delimiter ) : void

Parameters
Name Type Description
$key
$arraymbox
$ret
$delimiter
methodpublicgenerateFlatArrayFromMultiDimArray(  $arraymbox,  $delimiter ) : void

Parameters
Name Type Description
$arraymbox
$delimiter
methodpublicgenerateMultiDimArrayFromFlatArray(  $raw,  $delimiter ) : void

Parameters
Name Type Description
$raw
$delimiter
methodpublicgetACLCategory( ) : string
inherited

Returns the ACL category for this module; defaults to the SugarBean::$acl_category if defined otherwise it is SugarBean::$module_dir

Inherited from: \SugarBean::getACLCategory()
Returns
Type Description
string
methodpublicgetAuditEnabledFieldDefinitions( ) : \an
inherited

Returns a list of fields with their definitions that have the audited property set to true.

Inherited from: \SugarBean::getAuditEnabledFieldDefinitions()

Before calling this function, check whether audit has been enabled for the table/module or not. You would set the audit flag in the implemting module's vardef file.

Returns
Type Description
\an array of
Details
See
\is_AuditEnabled  
methodpublicgetAutoreplyStatus( string $from ) : bool

returns true if recipient has NOT received 10 auto-replies in 24 hours

Parameters
Name Type Description
$from string

from target address for auto-reply

Returns
Type Description
bool true if target is valid/under limit
methodpublicgetCacheCount( string $mbox ) : int

Returns total number of emails for a mailbox

Parameters
Name Type Description
$mbox string

mbox

Returns
Type Description
int
methodpublicgetCacheTimestamp(  $mbox ) : void

Fetches a timestamp

Parameters
Name Type Description
$mbox
methodpublicgetCacheUnread(  $mbox ) : void

Parameters
Name Type Description
$mbox
methodpublicgetCacheUnreadCount( string $mbox ) : int

Gets a count of all rows that are flagged seen = 0

Parameters
Name Type Description
$mbox string
Returns
Type Description
int
methodpublicgetCacheValue(  $mbox,  $limit = 20,  $page = 1,  $sort = '',  $direction = '' ) : array

Retrieves cached headers

Parameters
Name Type Description
$mbox
$limit
$page
$sort
$direction
Returns
Type Description
array
methodpublicgetCacheValueForUIDs(  $mbox,  $UIDs ) : array

Retrieves cached headers

Parameters
Name Type Description
$mbox
$UIDs
Returns
Type Description
array
methodpublicgetCachedIMAPSearch(  $criteria ) : void

Parameters
Name Type Description
$criteria
methodpublicgetCaseIdFromCaseNumber( \$emailName $emailName, \$aCase $aCase ) : void

for mailboxes of type "Support" parse for '[CASE:%1]'

Parameters
Name Type Description
$emailName \$emailName

the subject line of the email

$aCase \$aCase

a Case object

methodpublicgetCharsetFromBreadCrumb( string $bc, array $parts ) : string

retrieves the charset for a given part of an email body

Parameters
Name Type Description
$bc string

bc target part of the message in format (1.1.1)

$parts array

parts 1 level above ROOT array of Objects representing a multipart body

Returns
Type Description
string charset name
methodpublicgetConnectString( string $service = '',  $mbox = '',  $includeMbox = true ) : string

Constructs the resource connection string that IMAP needs

Parameters
Name Type Description
$service string

Service string, will generate if not passed

$mbox
$includeMbox
Returns
Type Description
string
methodpublicgetCorrectMessageNoForPop3( String $messageId ) : \returnMsgNo

This method returns the correct messageno for the pop3 protocol

Parameters
Name Type Description
$messageId String

UIDL

Returns
Type Description
\returnMsgNo
methodpublicgetDuplicateEmailId(  $msgNo,  $uid ) : void

If the importOneEmail returns false, then findout if the duplicate email

Parameters
Name Type Description
$msgNo
$uid
methodpublicgetEncodingFromBreadCrumb( string $bc, array $parts ) : int

takes a breadcrumb and returns the encoding at that level

Parameters
Name Type Description
$bc string

bc the breadcrumb string in format (1.1.1)

$parts array

parts the root level parts array

Returns
Type Description
int retInt Int key to transfer encoding (see handleTranserEncoding())
methodpublicgetFieldDefinition( string $name ) : Array
inherited

Returns field definition for the requested field name.

Inherited from: \SugarBean::getFieldDefinition()

The definitions were loaded in the constructor.

Parameters
Name Type Description
$name string

field name,

Returns
Type Description
Array Field properties or boolean false if the field doesn't exist Internal function, do not override.
methodpublicgetFieldDefinitions( ) : Array
inherited

Returns field definitions for the implementing module.

Inherited from: \SugarBean::getFieldDefinitions()

The definitions were loaded in the constructor.

Returns
Type Description
Array Field definitions. Internal function, do not override.
methodpublicgetFieldValue( string $name ) : \varies
inherited

Returns the value for the requested field.

Inherited from: \SugarBean::getFieldValue()

When a row of data is fetched using the bean, all fields are created as variables in the context of the bean and then fetched values are set in these variables.

Parameters
Name Type Description
$name string

field name,

Returns
Type Description
\varies Field value. Internal function, do not override.
methodpublicgetFoldersListForMailBox( ) : void

methodpublicgetFormattedHeaders( int $uid ) : string

constructs a nicely formatted version of email headers.

Parameters
Name Type Description
$uid int
Returns
Type Description
string
methodpublicgetFormattedRawSource( int $uid ) : string

constructs a nicely formatted version of raw source

Parameters
Name Type Description
$uid int

UID of email

Returns
Type Description
string
methodpublicgetGroupsWithSelectOptions( array $groups = array() ) : string

Returns

Parameters
Name Type Description
$groups array

default empty array

Returns
Type Description
string HTML options
methodpublicgetImapMboxFromSugarProprietary( string $mbox ) : string

Constructs an IMAP c-client compatible folder path from Sugar proprietary

Parameters
Name Type Description
$mbox string

"::" delimited IMAP mailbox path, ie, INBOX.saved.stuff

Returns
Type Description
string
methodpublicgetIndices( ) : Array
inherited

Returns index definitions for the implementing module.

Inherited from: \SugarBean::getIndices()

The definitions were loaded in the constructor.

Returns
Type Description
Array Index definitions. Internal function, do not override.
methodpublicgetMailBoxesForGroupAccount( ) : void

methodpublicgetMailboxProcessCount(  $mailbox ) : void

Parameters
Name Type Description
$mailbox
methodpublicgetMailboxes( bool $justRaw = false ) : array

retrieves the mailboxes for a given account in the following format Array( [INBOX] => Array ( [Bugs] => Bugs [Builder] => Builder [DEBUG] => Array ( [out] => out [test] => test ) )

Parameters
Name Type Description
$justRaw bool

Default false

Returns
Type Description
array
methodpublicgetMessageId(  $header ) : void

Some emails do not get assigned a message_id, specifically from Outlook/Exchange.

We need to derive a reliable one for duplicate import checking.

Parameters
Name Type Description
$header
methodpublicgetMessageText( int $msgNo, string $type,  $structure,  $fullHeader,  $clean_email = true,  $bcOffset = "" ) : string

returns the HTML text part of a multi-part message

Parameters
Name Type Description
$msgNo int

msgNo the relative message number for the monitored mailbox

$type string

the type of text processed, either 'PLAIN' or 'HTML'

$structure
$fullHeader
$clean_email
$bcOffset
Returns
Type Description
string UTF-8 encoded version of the requested message text
methodpublicgetMessageTextFromSingleMimePart( string $msgNo, string $section, \stdObject $structure ) : string

Get the message text from a single mime section, html or plain.

Parameters
Name Type Description
$msgNo string
$section string
$structure \stdObject
Returns
Type Description
string
methodpublicgetMessagesInEmailCache( string $msgno, string $uid ) : void

This function is used by cron job for group mailbox without group folder

Parameters
Name Type Description
$msgno string

for pop

$uid string

for imap

methodpublicgetMimeType(  $type,  $subtype ) : void

Parameters
Name Type Description
$type
$subtype
methodpublicgetMsgnoForMessageID( int $messageid ) : \UIDL

Gets the UIDL from database for the corresponding msgno

Parameters
Name Type Description
$messageid int

messageNo of a message

Returns
Type Description
\UIDL for the message
methodpublicgetNewEmailsForSyncedMailbox( ) : array

Get Email messages IDs from server which aren't in database

Returns
Type Description
array Ids of messages, which aren't still in database
methodpublicgetNewMessageIds( ) : array

finds emails tagged "//UNSEEN" on mailserver and "SINCE: [date]" if that option is set

Returns
Type Description
array Array of messageNumbers (mail server's internal keys)
methodpublicgetNoteBeanForAttachment( string $emailId ) : \Note

Return a new note object for attachments.

Parameters
Name Type Description
$emailId string
Returns
Type Description
\Note
methodpublicgetObjectName( ) : \nothing
inherited

Returns the object name. If object_name is not set, table_name is returned.

Inherited from: \SugarBean::getObjectName()

All implementing classes must set a value for the object_name variable.

Returns
Type Description
\nothing
methodpublicgetOverviewsFromCacheFile( string $uids, string $mailbox = '', bool $remove = false ) : array

similar to imap_fetch_overview, but it gets overviews from a local cache file.

Parameters
Name Type Description
$uids string

UIDs in comma-delimited format

$mailbox string

The mailbox in focus, will default to $this->mailbox

$remove bool

Default false

Returns
Type Description
array
methodpublicgetOwnerField(  $returnFieldName = false ) : STRING
inherited

Get owner field

Inherited from: \SugarBean::getOwnerField()
Parameters
Name Type Description
$returnFieldName
Returns
Type Description
STRING
methodpublicgetOwnerWhere( \GUID $user_id ) : STRING
inherited

Gets there where statement for checking if a user is an owner

Inherited from: \SugarBean::getOwnerWhere()
Parameters
Name Type Description
$user_id \GUID
Returns
Type Description
STRING
methodprotectedgetPartByPath( string $bc, array $parts ) : void

Gets part by following breadcrumb path

Parameters
Name Type Description
$bc string

the breadcrumb string in format (1.1.1)

$parts array

parts the root level parts array

methodpublicgetPop3NewMessagesToDownload( ) : void

methodpublicgetPop3NewMessagesToDownloadForCron( ) : void

methodpublicgetPrimaryFieldDefinition( ) : Array
inherited

Returnss definition for the id field name.

Inherited from: \SugarBean::getPrimaryFieldDefinition()

The definitions were loaded in the constructor.

Returns
Type Description
Array Field properties. Internal function, do not override.
methodpublicgetRealKeyFromCustomFieldAssignedKey(  $name ) : void
Parameters
Name Type Description
$name
methodpublicgetRelatedFields(  $module,  $id,  $fields,  $return_array = false ) : void
inherited

Inherited from: \SugarBean::getRelatedFields()
Parameters
Name Type Description
$module
$id
$fields
$return_array
methodpublicgetRelatedId( \$email $email, \$table $module ) : void

This function returns a contact or user ID if a matching email is found

Parameters
Name Type Description
$email \$email

the email address to match

$module \$table

which table to query

methodpublicgetServiceString( ) : string

parses Sugar's storage method for imap server service strings

Returns
Type Description
string
methodpublicgetSessionConnectionString(  $server_url,  $email_user,  $port,  $protocol ) : void

Parameters
Name Type Description
$server_url
$email_user
$port
$protocol
methodpublicgetSessionInboundDelimiterString(  $server_url,  $email_user,  $port,  $protocol ) : void

Parameters
Name Type Description
$server_url
$email_user
$port
$protocol
methodpublicgetSessionInboundFoldersString(  $server_url,  $email_user,  $port,  $protocol ) : void

Parameters
Name Type Description
$server_url
$email_user
$port
$protocol
methodpublicgetSingularRelatedId( \$emailName $emailName, \$tableName $tableName ) : void

returns exactly 1 id match. if more than one, than returns false

Parameters
Name Type Description
$emailName \$emailName

the subject of the email to match

$tableName \$tableName

the table of the matching bean type

methodpublicgetSystemSettingsForm( ) : string

returns the HTML for InboundEmail system settings

Returns
Type Description
string HTML
methodpublicgetTableName( ) : String
inherited

Returns the implementing class' table name.

Inherited from: \SugarBean::getTableName()

All implementing classes set a value for the table_name variable. This value is returned as the table name. If not set, table name is extracted from the implementing module's vardef.

Returns
Type Description
String Table name. Internal function, do not override.
methodpublicgetTeamSetIdForTeams(  $teamIds ) : void

Parameters
Name Type Description
$teamIds
methodpublicgetTempFilename( bool $nameOnly = false ) : string

Generate a unique filename for attachments based on the message id. There are no maximum specifications for the length of the message id, the only requirement is that it be globally unique.

Parameters
Name Type Description
$nameOnly bool

Whether or not the attachment count should be appended to the filename.

Returns
Type Description
string The temp file name
methodpublicgetUIDLForMessage( int $msgNo ) : \UIDL

Gets the UIDL from database for the corresponding msgno

Parameters
Name Type Description
$msgNo int

messageNo of a message

Returns
Type Description
\UIDL for the message
methodpublicgetUnixHeaderDate( string $headerDate ) : string

Calculates the appropriate display date/time sent for an email.

Parameters
Name Type Description
$headerDate string

headerDate The date sent of email in MIME header format

Returns
Type Description
string GMT-0 Unix timestamp
methodpublicgetUserNameFromGroupId( ) : void

methodpublicgetUserPersonalAccountCount( \unknown_type $user = null ) : void

Retrieves the current count of personal accounts for the user specified.

Parameters
Name Type Description
$user \unknown_type
methodpublicgetUsersDefaultOutboundServerId( \User $user ) : string

Get the users default IE account id

Parameters
Name Type Description
$user \User
Returns
Type Description
string
methodpublicget_audit_table_name( ) : String
inherited

Returns the name of the audit table.

Inherited from: \SugarBean::get_audit_table_name()

Audit table's name is based on implementing class' table name.

Returns
Type Description
String Audit table name. Internal function, do not override.
methodpublicget_custom_table_name( ) : String
inherited

Returns the name of the custom table.

Inherited from: \SugarBean::get_custom_table_name()

Custom table's name is based on implementing class' table name.

Returns
Type Description
String Custom table name. Internal function, do not override.
methodpublicget_full_list( string $order_by = "", string $where = "",  $check_dates = false, int $show_deleted = 0 ) : void
inherited

Returns a full (ie non-paged) list of the current object type.

Inherited from: \SugarBean::get_full_list()
Parameters
Name Type Description
$order_by string

the order by SQL parameter. defaults to ""

$where string

where clause. defaults to ""

$check_dates
$show_deleted int

show deleted records. defaults to 0

methodpublicget_import_required_fields( ) : array
inherited

Returns an array of fields that are required for import

Inherited from: \SugarBean::get_import_required_fields()
Returns
Type Description
array
methodpublicget_importable_fields( ) : array
inherited

Returns an array of fields that are able to be Imported into i.e. 'importable' not set to 'false'

Inherited from: \SugarBean::get_importable_fields()
Returns
Type Description
array List of fields. Internal function, do not override.
methodpublicget_linked_beans( string $field_name,  $bean_name, array $sort_array = array(), int $begin_index = 0, int $end_index = -1, int $deleted = 0,  $optional_where = "" ) : void
inherited

Returns an array of beans of related data.

Inherited from: \SugarBean::get_linked_beans()

For instance, if an account is related to 10 contacts , this function will return an array of contacts beans (10) with each bean representing a contact record. Method will load the relationship if not done so already.

Parameters
Name Type Description
$field_name string

relationship to be loaded.

$bean_name
$sort_array array

optional, unused

$begin_index int

Optional, default 0, unused.

$end_index int

Optional, default -1

$deleted int

Optional, Default 0, 0 adds deleted=0 filter, 1 adds deleted=1 filter.

$optional_where
methodpublicget_linked_fields( ) : array
inherited

Returns an array of fields that are of type link.

Inherited from: \SugarBean::get_linked_fields()
Returns
Type Description
array List of fields. Internal function, do not override.
methodpublicget_list_view_array( ) : void
inherited

Assigns all of the values into the template for the list view

Inherited from: \SugarBean::get_list_view_array()
methodpublicget_list_view_data( ) : void

Override's SugarBean's

methodpublicget_notification_recipients( ) : void
inherited

Determines which users receive a notification

Inherited from: \SugarBean::get_notification_recipients()
methodpublicget_related_fields( ) : array
inherited

Returns an array of fields that are of type relate.

Inherited from: \SugarBean::get_related_fields()
Returns
Type Description
array List of fields. Internal function, do not override.
methodpublicget_related_list( object $child_seed, string $related_field_name, string $order_by = "", string $where = "",  $row_offset = 0,  $limit = -1,  $max = -1,  $show_deleted = 0 ) : array
inherited

Fetches data from all related tables.

Inherited from: \SugarBean::get_related_list()
Parameters
Name Type Description
$child_seed object
$related_field_name string

relation to fetch data for

$order_by string

Optional, default empty

$where string

Optional, additional where clause

$row_offset
$limit
$max
$show_deleted
Returns
Type Description
array Fetched data. Internal function, do not override.
methodpublicget_stored_options(  $option_name,  $default_value = null,  $stored_options = null ) : void

Parameters
Name Type Description
$option_name
$default_value
$stored_options
methodpublicget_summary_text( ) : string

returns the bean name - overrides SugarBean's

Returns
Type Description
string
methodpublicget_union_related_list( \SugarBean $parentbean, string $order_by = "", string $sort_order = '', string $where = "",  $row_offset = 0,  $limit = -1,  $max = -1,  $show_deleted = 0,  $subpanel_def ) : void
inherited

Constructs a query to fetch data for supanels and list views

Inherited from: \SugarBean::get_union_related_list()

It constructs union queries for activities subpanel.

Parameters
Name Type Description
$parentbean \SugarBean

constructing queries for link attributes in this bean

$order_by string

Optional, order by clause

$sort_order string

Optional, sort order

$where string

Optional, additional where clause Internal Function, do not overide.

$row_offset
$limit
$max
$show_deleted
$subpanel_def
methodpublicget_where( array $fields_array, boolean $deleted = true ) : string
inherited

Construct where clause from a list of name-value pairs.

Inherited from: \SugarBean::get_where()
Parameters
Name Type Description
$fields_array array

Name/value pairs for column checks

$deleted boolean

Optional, default true, if set to false deleted filter will not be added.

Returns
Type Description
string The WHERE clause
methodpublicgroupUserDupeCheck( ) : \GUIDboolean

Checks for duplicate Group User names when creating a new one at save()

Returns
Type Description
\GUIDboolean returns GUID of Group User if user_name match is foundfalse if NO DUPE IS FOUND
methodpublichandleAutoresponse( object $email,  $contactAddr ) : void

handles auto-responses to inbound emails

Parameters
Name Type Description
$email object

email Email passed as reference

$contactAddr
methodpublichandleCaseAssignment(  $email ) : void

Parameters
Name Type Description
$email
methodpublichandleCharsetTranslation( string $text, string $charset ) : string

handles translating message text from orignal encoding into UTF-8

Parameters
Name Type Description
$text string

text test to be re-encoded

$charset string

charset original character set

Returns
Type Description
string utf8 re-encoded text
methodpublichandleCreateCase(  $email,  $userId ) : void

Parameters
Name Type Description
$email
$userId
methodpublichandleEncodedFilename( string $name ) : string

tries to figure out what character set a given filename is using and decode based on that

Parameters
Name Type Description
$name string

name Name of attachment

Returns
Type Description
string decoded name
methodpublichandleIsPersonal( ) : void

Determines if this instance of I-E is for a Group Inbox or Personal Inbox

methodpublichandleLinking( object $email ) : string

handles linking contacts, accounts, etc. to an email

Parameters
Name Type Description
$email object

Email bean to be linked against

Returns
Type Description
string contactAddr is the email address of the sender
methodpublichandleMailboxType( object $email, object $header ) : void

handles functionality specific to the Mailbox type (Cases, bounced campaigns, etc.)

Parameters
Name Type Description
$email object

email Email object passed as a reference

$header object

header Header object generated by imap_headerinfo();

methodpublichandleMimeHeaderDecode( string $subject ) : string

takes the output from imap_mime_hader_decode() and handles multiple types of encoding

Parameters
Name Type Description
$subject string

subject Raw subject string from email

Returns
Type Description
string ret properly formatted UTF-8 string
methodpublichandleTranserEncoding( \$str $str, \$enc $enc = 0 ) : void

decodes a string based on its associated encoding if nothing is passed, we default to no-encoding type

Parameters
Name Type Description
$str \$str

encoded string

$enc \$enc

detected encoding

methodpublichandleUUDecode( string $id, string $fileName,  $UUEncode ) : void

wrapper for UUDecode

Parameters
Name Type Description
$id string

id Id of the email

$fileName string

UUEncode Encode US-ASCII

$UUEncode
methodpublichandleUUEncodedEmailBody( string $raw, string $id ) : string

handles UU Encoded emails - a legacy from pre-RFC 822 which must still be supported (?)

Parameters
Name Type Description
$raw string

raw The raw email body

$id string

id Parent email ID

Returns
Type Description
string The filtered email body, stripped of attachments
methodprotectedhandle_preset_relationships( string | boolean $new_rel_id, string $new_rel_link, array $exclude = array() ) : string | boolean
inherited

Handle the preset fields listed in the fixed relationship_fields array hardcoded into the OOB beans

Inherited from: \SugarBean::handle_preset_relationships()

TODO: remove this mechanism and replace with mechanism exclusively based on the vardefs

Parameters
Name Type Description
$new_rel_id string | boolean

String of the ID to add

$new_rel_link string

Relationship Name

$exclude array

any relationship's to exclude

Returns
Type Description
string | boolean Return the new_rel_id if it was not used. False if it was used.
Details
Api
 
See
\save_relationship_changes  
methodprotectedhandle_remaining_relate_fields( array $exclude = array() ) : array
inherited

Next, we'll attempt to update all of the remaining relate fields in the vardefs that have 'save' set in their field_def Only the 'save' fields should be saved as some vardef entries today are not for display only purposes and break the application if saved If the vardef has entries for field of type relate, where a->id_name = and field of type link then we receive a value for b from the MVC in the _REQUEST, and it should be set in the bean as $this->$b

Inherited from: \SugarBean::handle_remaining_relate_fields()
Parameters
Name Type Description
$exclude array

any relationship's to exclude

Returns
Type Description
array the list of relationships that were added or removed successfully or if they were a failure
Details
Api
 
See
\save_relationship_changes  
methodprotectedhandle_request_relate( string | boolean $new_rel_id, string $new_rel_link ) : boolean
inherited

Finally, we update a field listed in the _REQUEST['%/relate_id']/_REQUEST['relate_to'] mechanism (if it has not already been updated)

Inherited from: \SugarBean::handle_request_relate()
Parameters
Name Type Description
$new_rel_id string | boolean
$new_rel_link string
Returns
Type Description
boolean
Details
Api
 
See
\save_relationship_changes  
methodpublichardDelete( string $id ) : void

Hard deletes an I-E account

Parameters
Name Type Description
$id string

id GUID

methodpublichasCustomFields( ) : void
inherited

Inherited from: \SugarBean::hasCustomFields()
methodpublichas_been_modified_since( \date $date, string $modified_user_id ) : void
inherited

Performs a check if the record has been modified since the specified date

Inherited from: \SugarBean::has_been_modified_since()
Parameters
Name Type Description
$date \date

Datetime for verification

$modified_user_id string

User modified by

methodpublichas_calc_field_with_link( string $linkName = "" ) : bool
inherited

Tests if the current module has a calculated field with a link.

Inherited from: \SugarBean::has_calc_field_with_link()

if a link name is specified, it will return true when a field uses that specific link Otherwise it will test for all link fields.

Parameters
Name Type Description
$linkName string
Returns
Type Description
bool
methodpublicimportDupeCheck( string $message_id, int $header, object $textHeader ) : bool

checks for duplicate emails on polling. The uniqueness of a given email message is determined by a concatenation of 2 values, the messageID and the delivered-to field. This allows multiple To: and B/CC: destination addresses to be imported by Sugar without violating the true duplicate-email issues.

Parameters
Name Type Description
$message_id string

message_id message ID generated by sending server

$header int

message number (mailserver's key) of email

$textHeader object

header object generated by imap_headerinfo()

Returns
Type Description
bool
methodpublicimportOneEmail( int $msgNo, bool $uid, \clean_email $forDisplay = false,  $clean_email = true ) : void

shiny new importOneEmail() method

Parameters
Name Type Description
$msgNo int

msgNo

$uid bool

forDisplay

$forDisplay \clean_email

boolean, default true,

$clean_email
methodpublicinsertMailBoxFolders(  $value ) : void

Parameters
Name Type Description
$value
methodpublicisAutoImport( object $user = null ) : bool

Checks for $user's autoImport setting and returns the current value

Parameters
Name Type Description
$user object

User in focus, defaults to $current_user

Returns
Type Description
bool
methodpublicisFavoritesEnabled( ) : void
inherited

Inherited from: \SugarBean::isFavoritesEnabled()
methodpublicisMailBoxTypeCreateCase( ) : void

methodpublicisOwner( \GUID $user_id ) : boolean
inherited

Returns true of false if the user_id passed is the owner

Inherited from: \SugarBean::isOwner()
Parameters
Name Type Description
$user_id \GUID
Returns
Type Description
boolean
methodpublicisPop3Protocol( ) : boolean

Checks if this is a pop3 type of an account or not

Returns
Type Description
boolean
methodpublicisUuencode( string $string ) : bool

figures out if a plain text email body has UUEncoded attachments

Parameters
Name Type Description
$string string

string The email body

Returns
Type Description
bool True if UUEncode is detected.
methodpublicis_AuditEnabled( ) : boolean
inherited

Return true if auditing is enabled for this object You would set the audit flag in the implemting module's vardef file.

Inherited from: \SugarBean::is_AuditEnabled()
Returns
Type Description
boolean Internal function, do not override.
methodpubliclist_view_parse_additional_sections(  $list_form ) : void
inherited

Let implementing classes to fill in row specific columns of a list view form

Inherited from: \SugarBean::list_view_parse_additional_sections()
Parameters
Name Type Description
$list_form
methodpubliclistviewACLHelper( ) : ARRAY
inherited

Used in order to manage ListView links and if they should links or not based on the ACL permissions of the user

Inherited from: \SugarBean::listviewACLHelper()
Returns
Type Description
ARRAY of STRINGS
methodpublicloadFromRow( array $arr ) : \nothing
inherited

Loads a row of data into instance of a bean. The data is passed as an array to this function

Inherited from: \SugarBean::loadFromRow()
Parameters
Name Type Description
$arr array

row of data fetched from the database.

Returns
Type Description
\nothing Internal function do not override.
methodpublicloadLayoutDefs( ) : void
inherited

Inherited from: \SugarBean::loadLayoutDefs()
methodpublicload_relationship( string $rel_name ) : \nothing.
inherited

Loads the request relationship. This method should be called before performing any operations on the related data.

Inherited from: \SugarBean::load_relationship()

This method searches the vardef array for the requested attribute's definition. If the attribute is of the type link then it creates a similary named variable and loads the relationship definition.

Parameters
Name Type Description
$rel_name string

relationship/attribute name.

Returns
Type Description
\nothing.
methodpublicload_relationships( ) : \Nothing
inherited

Loads all attributes of type link.

Inherited from: \SugarBean::load_relationships()

DO NOT CALL THIS FUNCTION IF YOU CAN AVOID IT. Please use load_relationship directly instead.

Method searches the implmenting module's vardef file for attributes of type link, and for each attribute create a similary named variable and load the relationship definition.

Returns
Type Description
\Nothing Internal function, do not override.
methodpublicmarkEmails( string $uids, string $type ) : void

Sets flags on emails. Assumes that connection is live, correct folder is set.

Parameters
Name Type Description
$uids string

Sequence of UIDs, comma separated

$type string

Flag to mark

methodpublicmark_answered( string $mailid,  $type = 'smtp' ) : void

Mark cached email answered (replied)

Parameters
Name Type Description
$mailid string

(uid for imap, message_id for pop3)

$type
methodpublicmark_deleted( string $id ) : void

Overrides SugarBean's mark_deleted() to drop the related cache table

If it is not overridden, then marking this type of item is not allowed

Parameters
Name Type Description
$id string

GUID of I-E instance

methodpublicmark_relationships_deleted( int $id ) : void
inherited

This function deletes relationships to this object. It should be overridden to handle the relationships of the specific object.

Inherited from: \SugarBean::mark_relationships_deleted()

This function is called when the item itself is being deleted.

Parameters
Name Type Description
$id int

id of the relationship to delete

methodpublicmark_undeleted(  $id ) : void
inherited

Restores data deleted by call to mark_deleted() function.

Inherited from: \SugarBean::mark_undeleted()

Internal function, do not override.

Parameters
Name Type Description
$id
methodpublicmoveEmails( string $fromIe, string $fromFolder, string $toIe, string $toFolder, string $uids, bool $copy = false ) : bool

moves emails from folder to folder

Parameters
Name Type Description
$fromIe string

I-E id

$fromFolder string

IMAP path to folder in which the email lives

$toIe string

I-E id

$toFolder string
$uids string

UIDs of emails to move, either Sugar GUIDS or IMAP UIDs

$copy bool

Default false

Returns
Type Description
bool True on successful execution
methodprotectedparseDateDefault( string $value, bool $time = false ) : string
inherited

Create date string from default value like '+1 month'

Inherited from: \SugarBean::parseDateDefault()
Parameters
Name Type Description
$value string
$time bool

Should be expect time set too?

Returns
Type Description
string
methodpublicparse_additional_headers(  $list_form,  $xTemplateSection ) : void
inherited

Inherited from: \SugarBean::parse_additional_headers()
Parameters
Name Type Description
$list_form
$xTemplateSection
methodpublicpop3_checkEmail( ) : void

Special handler for POP3 boxes. Standard IMAP commands are useless.

methodpublicpop3_checkPartialEmail(  $synch = false ) : void

Special handler for POP3 boxes. Standard IMAP commands are useless.

This will fetch only partial emails for POP3 and hence needs to be call again and again based on status it returns

Parameters
Name Type Description
$synch
methodpublicpop3_cleanUp( ) : void

Closes connections and runs clean-up routines

methodpublicpop3_getCacheUidls( ) : array

retrieves cached uidl values.

When dealing with POP3 accounts, the message_id column in email_cache will contain the UIDL.

Returns
Type Description
array
methodpublicpop3_getUIDL( ) : array

This method returns all the UIDL for this account. This should be called if the protocol is pop3

Returns
Type Description
array od messageno to UIDL array
methodpublicpop3_open( ) : bool

Opens a socket connection to the pop3 server

Returns
Type Description
bool
methodpublicpop3_sendCommand( string $command, string $args = '', bool $return = true ) : string

sends a command down to the POP3 server

Parameters
Name Type Description
$command string

command

$args string

args

$return bool

return

Returns
Type Description
string
methodpublicpop3_shiftCache( array $diff,  $cacheUIDLs ) : void

Iterates through msgno and message_id to remove dirty cache entries

Parameters
Name Type Description
$diff array

diff

$cacheUIDLs
methodpublicpopulateDefaultValues(  $force = false ) : void
inherited

Inherited from: \SugarBean::populateDefaultValues()
Parameters
Name Type Description
$force
methodpublicpopulateRelatedBean( \SugarBean $newbean ) : void
inherited

Called from ImportFieldSanitize::relate(), when creating a new bean in a related module. Will copies fields over from the current bean into the related. Designed to be overriden in child classes.

Inherited from: \SugarBean::populateRelatedBean()
Parameters
Name Type Description
$newbean \SugarBean

newly created related bean

methodpublicpreprocess_fields_on_save( ) : void
inherited

This function processes the fields before save.

Inherited from: \SugarBean::preprocess_fields_on_save()

Interal function, do not override.

methodpublicprocessRules( array $searchResults, object $user = null ) : array

Applies rules where applicable

Parameters
Name Type Description
$searchResults array
$user object

User in focus, default to $current_user

Returns
Type Description
array
methodpublicprocess_detail_query( string $query, int $row_offset, int $limit = -1, int $max_per_page = -1, string $where = '', int $offset = 0 ) : array
inherited

Applies pagination window to select queries used by detail view, executes the query and returns fetched data.

Inherited from: \SugarBean::process_detail_query()

Internal function, do not override.

Parameters
Name Type Description
$query string

query to be processed.

$row_offset int
$limit int

optional, default -1

$max_per_page int

Optional, default -1

$where string

Custom where clause.

$offset int

Optional, default 0

Returns
Type Description
array Fetched data.
methodpublicprocess_full_list_query( string $query, boolean $check_date = false ) : array
inherited

Processes fetched list view data

Inherited from: \SugarBean::process_full_list_query()

Internal function, do not override.

Parameters
Name Type Description
$query string

query to be processed.

$check_date boolean

Optional, default false. if set to true date time values are processed.

Returns
Type Description
array Fetched data.
methodpublicprocess_list_query( string $query, int $row_offset, int $limit = -1, int $max_per_page = -1, string $where = '' ) : array
inherited

Processes the list query and return fetched row.

Inherited from: \SugarBean::process_list_query()

Internal function, do not override.

Parameters
Name Type Description
$query string

select query to be processed.

$row_offset int

starting position

$limit int

Optioanl, default -1

$max_per_page int

Optional, default -1

$where string

Optional, additional filter criteria.

Returns
Type Description
array Fetched data
methodpublicprocess_order_by( string $order_by, \SugarBean $submodule = null ) : string
inherited

Prefixes column names with this bean's table name.

Inherited from: \SugarBean::process_order_by()
Parameters
Name Type Description
$order_by string

Order by clause to be processed

$submodule \SugarBean

name of the module this order by clause is for

Returns
Type Description
string Processed order by clause Internal function, do not override.
methodpublicprocess_special_fields( ) : void
inherited

This method is called during an import before inserting a bean Define an associative array called $special_fields the keys are user defined, and don't directly map to the bean's fields the value is the method name within that bean that will do extra processing for that field. example: 'full_name'=>'get_names_from_full_name'

Inherited from: \SugarBean::process_special_fields()
methodpublicprocess_union_list_query( object $parent_bean, string $query, int $row_offset, int $limit = -1, int $max_per_page = -1, string $where = '', array $subpanel_def, string $query_row_count = '',  $secondary_queries = array() ) : array
inherited

Applies pagination window to union queries used by list view and subpanels, executes the query and returns fetched data.

Inherited from: \SugarBean::process_union_list_query()

Internal function, do not override.

Parameters
Name Type Description
$parent_bean object
$query string

query to be processed.

$row_offset int
$limit int

optional, default -1

$max_per_page int

Optional, default -1

$where string

Custom where clause.

$subpanel_def array

definition of sub-panel to be processed

$query_row_count string
$secondary_queries
Returns
Type Description
array Fetched data.
methodpublicprocess_workflow_alerts( ) : void
inherited

Any alerts that have been placed into the session, be sure to process them.

Inherited from: \SugarBean::process_workflow_alerts()

This function was created as a result of bug 7908

methodpublicremoveRelationshipMeta( string $key, string $db, string $tablename, string $dictionary, string $module_dir ) : \Nothing
inherited

Removes relationship metadata cache.

Inherited from: \SugarBean::removeRelationshipMeta()

Every module that has relationships defined with other modules, has this meta data cached. The cache is stores in 2 locations: relationships table and file system. This method clears the cache from both locations.

Parameters
Name Type Description
$key string

module whose meta cache is to be cleared.

$db string

database handle.

$tablename string

table name

$dictionary string

vardef for the module

$module_dir string

name of subdirectory where module is installed.

Returns
Type Description
\Nothing
Details
Static
Internal function, do not override.  
methodpublicremove_relationship_meta(  $key,  $db,  $log,  $tablename,  $dictionary,  $module_dir ) : void
inherited

This method has been deprecated.

Inherited from: \SugarBean::remove_relationship_meta()
Parameters
Name Type Description
$key
$db
$log
$tablename
$dictionary
$module_dir
Details
See
\removeRelationshipMeta()  
Static
 
methodpublicrenameFolder(  $oldName, string $newName ) : void

Renames an IMAP mailbox

Parameters
Name Type Description
$oldName
$newName string
methodpublicrepairAccount( ) : bool

repairs the encrypted password for a given I-E account

Returns
Type Description
bool True on success
methodpublicretrieve( string $id,  $encode = true,  $deleted = true ) : object

retrieves I-E bean

The fetched data is then set into the bean. The function also processes the fetched data by formattig date/time and numeric values.

Parameters
Name Type Description
$id string

id

$encode
$deleted
Returns
Type Description
object Bean
methodpublicretrieveAllByGroupId(  $id,  $includePersonal = true ) : void

Retrieves an array of I-E beans that the user has team access to

Parameters
Name Type Description
$id
$includePersonal
methodpublicretrieveAllByGroupIdWithGroupAccounts(  $id,  $includePersonal = true ) : void

Retrieves an array of I-E beans that the user has team access to including group

Parameters
Name Type Description
$id
$includePersonal
methodpublicretrieveAttachmentNameFromStructure( object $part ) : string

Return the filename of the attachment by examining the dparameters or parameters returned from imap_fetch_structure

Parameters
Name Type Description
$part object
Returns
Type Description
string
methodpublicretrieveByGroupFolderId( string $groupFolderId ) : arrayboolean

retrieves an array of I-E beans based on the group folder id

Parameters
Name Type Description
$groupFolderId string

GUID of the group folder

Returns
Type Description
arrayboolean $beans array of beansfalse if none returned
methodpublicretrieveByGroupId( string $groupId ) : arrayboolean

retrieves an array of I-E beans based on the group_id

Parameters
Name Type Description
$groupId string

GUID of the group user or Individual

Returns
Type Description
arrayboolean $beans array of beansfalse if none returned
methodpublicretrieveDelimiter( ) : void

methodpublicretrieveMailBoxFolders( ) : void

methodpublicretrieve_by_string_fields( array $fields_array, boolean $encode = true, boolean $deleted = true ) : object
inherited

Constructs a select query and fetch 1 row using this query, and then process the row

Inherited from: \SugarBean::retrieve_by_string_fields()

Internal function, do not override.

Parameters
Name Type Description
$fields_array array

@fields_array array of name value pairs used to construct query.

$encode boolean

Optional, default true, encode fetched data.

$deleted boolean

Optional, default true, if set to false deleted filter will not be added.

Returns
Type Description
object Instance of this bean with fetched data.
methodpublicretrieve_parent_fields( array $type_info ) : void
inherited

Returns parent record data for objects that store relationship information

Inherited from: \SugarBean::retrieve_parent_fields()
Parameters
Name Type Description
$type_info array

Interal function, do not override.

methodpublicretrieve_relationships(  $table,  $values,  $select_id ) : void
inherited

Inherited from: \SugarBean::retrieve_relationships()
Parameters
Name Type Description
$table
$values
$select_id
methodpublicsave( string $check_notify = false ) : void

wraps SugarBean->save()

This method uses the presence of an id field that is not null to signify and update. The id field should not be set otherwise.

Parameters
Name Type Description
$check_notify string

ID of saved bean

methodpublicsaveAttachmentBinaries( object $attach, string $msgNo, string $thisBc, object $part, bool $forDisplay ) : void

saves the actual binary file of a given attachment

Parameters
Name Type Description
$attach object

attach Note object that is attached to the binary file

$msgNo string

msgNo Message Number on IMAP/POP3 server

$thisBc string

thisBc Breadcrumb to navigate email structure to find the content

$part object

part IMAP standard object that contains the "parts" of this section of email

$forDisplay bool
methodpublicsaveAttachments( int $msgNo, object $parts, string $emailId, array $breadcrumb = '0', bool $forDisplay ) : void

Takes the "parts" attribute of the object that imap_fetchbody() method returns, and recursively goes through looking for objects that have a disposition of "attachement" or "inline"

Parameters
Name Type Description
$msgNo int

The relative message number for the monitored mailbox

$parts object

Array of objects to examine

$emailId string

The GUID of the email saved prior to calling this method

$breadcrumb array

Default 0, build up of the parts mapping

$forDisplay bool

Default false

methodpublicsaveInboundEmailSystemSettings( string $type, string $macro ) : void

saves InboundEmail parse macros to config.php

Parameters
Name Type Description
$type string

type Bean to link

$macro string

macro The new macro

methodpublicsaveMailBoxFolders(  $value ) : void

Parameters
Name Type Description
$value
methodpublicsaveMailBoxValueOfInboundEmail( ) : void

methodpublicsaveNewFolder( string $name, string $mbox ) : bool

Saves new folders

Parameters
Name Type Description
$name string

Name of new IMAP mailbox

$mbox string

"::" delimited IMAP mailbox path, ie, INBOX.saved.stuff

Returns
Type Description
bool True on success
methodpublicsavePersonalEmailAccount( string $userId = '', \strings $userName = '', bool $forceSave = true ) : boolean

Saves Personal Inbox settings for Users

Parameters
Name Type Description
$userId string

userId ID of user to assign all emails for this account

$userName \strings

userName Name of account, for Sugar purposes

$forceSave bool

forceSave Default true. Flag to save errored settings.

Returns
Type Description
boolean true on success, false on fail
methodpublicsave_relationship_changes( boolean $is_update, array $exclude = array() ) : void
inherited

This function is a good location to save changes that have been made to a relationship.

Inherited from: \SugarBean::save_relationship_changes()

This should be overridden in subclasses that have something to save.

Parameters
Name Type Description
$is_update boolean

true if this save is an update.

$exclude array

a way to exclude relationships

methodpublicsearch(  $ieId,  $subject = '',  $from = '',  $to = '',  $body = '',  $dateFrom = '',  $dateTo = '' ) : void

Searches IMAP (and POP3?) accounts/folders for emails with qualifying criteria

Parameters
Name Type Description
$ieId
$subject
$from
$to
$body
$dateFrom
$dateTo
methodpublicsend_assignment_notifications( string $notify_user, string $admin ) : void
inherited

Handles sending out email notifications when items are first assigned to users

Inherited from: \SugarBean::send_assignment_notifications()
Parameters
Name Type Description
$notify_user string

user to notify

$admin string

the admin user that sends out the notification

methodpublicsetAutoreplyStatus( string $addr ) : void

sets a timestamp for an autoreply to a single email addy

Parameters
Name Type Description
$addr string

addr Address of auto-replied target

methodpublicsetCacheTimestamp( string $mbox ) : void

sets the cache timestamp

Parameters
Name Type Description
$mbox string

mbox

methodpublicsetCacheValue(  $mbox,  $insert,  $update = array(),  $remove = array() ) : void

Sets cache values

Parameters
Name Type Description
$mbox
$insert
$update
$remove
methodpublicsetDefaultTeam( ) : void
inherited

Set the given module's default team in SuagrCRM Professional

Inherited from: \SugarBean::setDefaultTeam()
methodpublicsetEmailForDisplay( int $uid, bool $isMsgNo = false, bool $setRead = false, bool $forceRefresh = false ) : string

fills InboundEmail->email with an email's details

Parameters
Name Type Description
$uid int

uid Unique ID of email

$isMsgNo bool

isMsgNo flag that passed ID is msgNo, default false

$setRead bool

setRead Sets the 'seen' flag in cache

$forceRefresh bool

forceRefresh Skips cache file

Returns
Type Description
string
methodpublicsetReadFlagOnFolderCache(  $mbox,  $uid ) : void

Parameters
Name Type Description
$mbox
$uid
methodpublicsetSessionConnectionString(  $server_url,  $email_user,  $port,  $protocol,  $goodStr ) : void

Parameters
Name Type Description
$server_url
$email_user
$port
$protocol
$goodStr
methodpublicsetSessionInboundDelimiterString(  $server_url,  $email_user,  $port,  $protocol,  $delimiter ) : void

Parameters
Name Type Description
$server_url
$email_user
$port
$protocol
$delimiter
methodpublicsetSessionInboundFoldersString(  $server_url,  $email_user,  $port,  $protocol,  $foldersList ) : void

Parameters
Name Type Description
$server_url
$email_user
$port
$protocol
$foldersList
methodpublicsetStatuses(  $uid,  $field,  $value ) : void

Sets status for a particular attribute on the mailserver and the local cache file

Parameters
Name Type Description
$uid
$field
$value
methodpublicsetUsersDefaultOutboundServerId( \User $user,  $oe_id ) : void

Get the users default IE account id

Parameters
Name Type Description
$user \User
$oe_id
methodpublicset_relationship(  $table,  $relate_values,  $check_duplicates = true,  $do_update = false,  $data_values = null ) : void
inherited

Inherited from: \SugarBean::set_relationship()
Parameters
Name Type Description
$table
$relate_values
$check_duplicates
$do_update
$data_values
methodprotectedset_relationship_info( array $exclude = array() ) : array
inherited

Look in the bean for the new relationship_id and relationship_name if $this->not_use_rel_in_req is set to true, otherwise check the $_REQUEST param for a relate_id and relate_to field. Once we have that make sure that it's not excluded from the passed in array of relationships to exclude

Inherited from: \SugarBean::set_relationship_info()
Parameters
Name Type Description
$exclude array

any relationship's to exclude

Returns
Type Description
array The relationship_id and relationship_name in an array
methodpublicsetupCustomFields( string $module_name, boolean $clean_load = true ) : void
inherited

Loads the definition of custom fields defined for the module.

Inherited from: \SugarBean::setupCustomFields()

Local file system cache is created as needed.

Parameters
Name Type Description
$module_name string

setting up custom fields for this module.

$clean_load boolean

Optional, default true, rebuilds the cache if set to true.

methodpublicsortFetchedOverview( array $arr, string $sort = 4, string $direction = 'DESC',  $forceSeen = false ) : array

Sorts IMAP's imap_fetch_overview() results

Parameters
Name Type Description
$arr array

Array of standard objects

$sort string

Column to sort by

$direction string

direction Direction to sort by (asc/desc)

$forceSeen
Returns
Type Description
array Sorted array of obj.
methodpublicsortMailboxes(  $mbox, array $ret,  $delimeter = "." ) : array

sorts the folders in a mailbox in a multi-dimensional array

Parameters
Name Type Description
$mbox
$ret array
$delimeter
Returns
Type Description
array
methodpublicsyncEmail( ) : void

full synchronization

methodpublictoArray(  $dbOnly = false,  $stringOnly = false,  $upperKeys = false ) : array
inherited

returns this bean as an array

Inherited from: \SugarBean::toArray()
Parameters
Name Type Description
$dbOnly
$stringOnly
$upperKeys
Returns
Type Description
array of fields with id, name, access and category
methodpublictrack_view( string $user_id, string $current_module, string $current_view = '' ) : void
inherited

Tracks the viewing of a detail record.

Inherited from: \SugarBean::track_view()

This leverages get_summary_text() which is object specific.

Internal function, do not override.

Parameters
Name Type Description
$user_id string
  • String value of the user that is viewing the record.
$current_module string
  • String value of the module being processed.
$current_view string
  • String value of the current view
methodpublicunPopulateDefaultValues( ) : void
inherited

Basically undoes the effects of SugarBean::populateDefaultValues(); this method is best called right after object initialization.

Inherited from: \SugarBean::unPopulateDefaultValues()
methodpublicunformat_all_fields( ) : void
inherited

Removes formatting from values posted from the user interface.

Inherited from: \SugarBean::unformat_all_fields()

It only unformats numbers. Function relies on user/system prefernce for format strings.

Internal Function, do not override.

methodpublicupdateCalculatedFields( ) : void
inherited

Retrieves and executes the CF dependencies for this bean

Inherited from: \SugarBean::updateCalculatedFields()
methodpublicupdateDependentField( ) : void
inherited

Run any dependency that fields may have

Inherited from: \SugarBean::updateDependentField()
methodpublicupdateDependentFieldForListView(  $listview_def_main = '' ) : void
Parameters
Name Type Description
$listview_def_main
methodpublicupdateOverviewCacheFile( array $array, string $type = 'append', string $mailbox = '' ) : void

merges new info with the saved cached file

Parameters
Name Type Description
$array array

Array of email Overviews

$type string

'append' or 'remove'

$mailbox string

Target mailbox if not current assigned

methodpublicupdateRelatedCalcFields(  $linkName = "" ) : void
inherited

Inherited from: \SugarBean::updateRelatedCalcFields()
Parameters
Name Type Description
$linkName
methodpublicvalidCacheExists(  $mbox ) : void

Parameters
Name Type Description
$mbox

\Overview

Package: SugarCRM

Simple class to mirror the passed object from an imap_fetch_overview() call

Properties

Propertypublic  $answered= ''
Details
Type
n/a
Propertypublic  $date= ''
Details
Type
n/a
Propertypublic  $deleted= ''
Details
Type
n/a
Propertypublic  $draft= ''
Details
Type
n/a
Propertypublic  $fieldDefs= ''
Details
Type
n/a
Propertypublic  $flagged= ''
Details
Type
n/a
Propertypublic  $from= ''
Details
Type
n/a
Propertypublic  $fromaddr= ''
Details
Type
n/a
Propertypublic  $indices= ''
Details
Type
n/a
Propertypublic  $message_id= ''
Details
Type
n/a
Propertypublic  $msgno= ''
Details
Type
n/a
Propertypublic  $recent= ''
Details
Type
n/a
Propertypublic  $seen= ''
Details
Type
n/a
Propertypublic  $size= ''
Details
Type
n/a
Propertypublic  $subject= ''
Details
Type
n/a
Propertypublic  $to= ''
Details
Type
n/a
Propertypublic  $toaddr= ''
Details
Type
n/a
Propertypublic  $uid= ''
Details
Type
n/a

Methods

methodpublicOverview( ) : void

\temp

Package: SugarCRM

Stub for certain interactions;

Properties

Propertypublic  $name= ''
Details
Type
n/a
Documentation was generated by DocBlox 0.18.1.