modules/InboundEmail/InboundEmail.php
Functions
\InboundEmail
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

$InboundEmailCacheFile= ''InboundEmail.cache.php''
'InboundEmail.cache.php'Details- Type
- n/a

$acltype= ''module''
'module'Details- Type
- n/a
- Inherited_from
- \SugarBean::$$acltype

$additional_column_fields= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \SugarBean::$$additional_column_fields

$additional_meta_fields= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \SugarBean::$$additional_meta_fields

$current_notify_user= ''
- Type
- n/a
- Inherited_from
- \SugarBean::$$current_notify_user

$custom_fields= ''
- Type
- n/a
- Inherited_from
- \SugarBean::$$custom_fields

$disable_custom_fields= 'false'
falseDetails- Type
- n/a
- Inherited_from
- \SugarBean::$$disable_custom_fields

BOOL
$disable_vardefs= 'false'
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_vardefsfalseDetails- Type
- BOOL
- Inherited_from
- \SugarBean::$$disable_vardefs

BOOL
$duplicates_found= 'false'
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_foundfalseDetails- Type
- BOOL
- Inherited_from
- \SugarBean::$$duplicates_found

$fetched_row= 'false'
falseDetails- Type
- n/a
- Inherited_from
- \SugarBean::$$fetched_row

$field_name_map= ''
- Type
- n/a
- Inherited_from
- \SugarBean::$$field_name_map

$force_load_details= 'false'
falseDetails- Type
- n/a
- Inherited_from
- \SugarBean::$$force_load_details

$hrSort= 'array(
0 => 'flagged',
1 => 'status',
2 => 'from',
3 => 'subj',
4 => 'date',
)'
array(
0 => 'flagged',
1 => 'status',
2 => 'from',
3 => 'subj',
4 => 'date',
)Details- Type
- n/a

$hrSortLocal= 'array(
'flagged' => 'flagged',
'status' => 'answered',
'from' => 'fromaddr',
'subject' => 'subject',
'date' => 'senddate',
)'
array(
'flagged' => 'flagged',
'status' => 'answered',
'from' => 'fromaddr',
'subject' => 'subject',
'date' => 'senddate',
)Details- Type
- n/a

$imageTypes= 'array("JPG", "JPEG", "GIF", "PNG")'
array("JPG", "JPEG", "GIF", "PNG")Details- Type
- n/a

array
$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)
array(
0 => 'text',
1 => 'multipart',
2 => 'message',
3 => 'application',
4 => 'audio',
5 => 'image',
6 => 'video',
)Details- Type
- array

$importable= 'false'
Set to true in the child beans if the module supports importing
Inherited from: \SugarBean::$$importablefalseDetails- Type
- n/a
- Inherited_from
- \SugarBean::$$importable

$in_import= 'false'
Set to true in <modules>/Import/views/view.step4.php if a module is being imported
Inherited from: \SugarBean::$$in_importfalseDetails- Type
- n/a
- Inherited_from
- \SugarBean::$$in_import

$in_workflow= 'false'
Set to true if the bean is being dealt with in a workflow
Inherited from: \SugarBean::$$in_workflowfalseDetails- Type
- n/a
- Inherited_from
- \SugarBean::$$in_workflow

$layout_def= ''
- Type
- n/a
- Inherited_from
- \SugarBean::$$layout_def

$list_fields= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \SugarBean::$$list_fields

$listview_inner_join= 'array()'
Used to pass inner join string to ListView Data.
Inherited from: \SugarBean::$$listview_inner_joinarray()Details- Type
- n/a
- Inherited_from
- \SugarBean::$$listview_inner_join

array
$loaded_relationships= 'array()'
A way to keep track of the loaded relationships so when we clone the object we can unset them.
Inherited from: \SugarBean::$$loaded_relationshipsarray()Details- Type
- array
- Inherited_from
- \SugarBean::$$loaded_relationships

int
$max_logic_depth= '10'
10Details- Type
- int
- Inherited_from
- \SugarBean::$$max_logic_depth

String
$module_dir= ''InboundEmail''
The name of the module folder for this type of bean.
'InboundEmail'Details- Type
- String

$module_name= ''''
''Details- Type
- n/a
- Inherited_from
- \SugarBean::$$module_name

String
$new_assigned_user_name= ''
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- Type
- String
- Inherited_from
- \SugarBean::$$new_assigned_user_name

BOOL
$new_with_id= 'false'
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_idfalseDetails- Type
- BOOL
- Inherited_from
- \SugarBean::$$new_with_id

$number_formatting_done= 'false'
falseDetails- Type
- n/a
- Inherited_from
- \SugarBean::$$number_formatting_done

String
$object_name= ''InboundEmail''
This is the singular name of the bean. (i.e. Contact).
'InboundEmail'Details- Type
- String

$optimistic_lock= 'false'
falseDetails- Type
- n/a
- Inherited_from
- \SugarBean::$$optimistic_lock

$process_field_encrypted= 'false'
falseDetails- Type
- n/a
- Inherited_from
- \SugarBean::$$process_field_encrypted

BOOL
$process_save_dates= 'true'
Whether to process date/time fields for storage in the database in GMT
trueDetails- Type
- BOOL

Array
$processed_dates_times= 'array()'
An array of booleans. This array is cleared out when data is loaded.
of booleansInherited from: \SugarBean::$$processed_dates_timesAs date/times are converted, a "1" is placed under the key, the field is converted.
array()Details- Type
- Array
- Inherited_from
- \SugarBean::$$processed_dates_times

$relationship_fields= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \SugarBean::$$relationship_fields

$required_fields= 'array('name' => 'name',
'server_url' => 'server_url',
'mailbox' => 'mailbox',
'user' => 'user',
'port' => 'port',
)'
array('name' => 'name',
'server_url' => 'server_url',
'mailbox' => 'mailbox',
'user' => 'user',
'port' => 'port',
)Details- Type
- n/a

BOOL
$save_from_post= 'true'
This signals to the bean that it is being saved in a mass mode.
Inherited from: \SugarBean::$$save_from_postExamples of this kind of save are import and mass update. We turn off notificaitons of this is the case to make things more efficient.
trueDetails- Type
- BOOL
- Inherited_from
- \SugarBean::$$save_from_post

\unknown_type
$set_created_by= 'true'
This allows for seed data to be created without using the current uesr to set the id.
Inherited from: \SugarBean::$$set_created_byThis should be replaced by altering the current user before the call to save.
trueDetails- Type
- \unknown_type
- Inherited_from
- \SugarBean::$$set_created_by

$special_notification= 'false'
Set to true in the child beans if the module use the special notification template
Inherited from: \SugarBean::$$special_notificationfalseDetails- Type
- n/a
- Inherited_from
- \SugarBean::$$special_notification

String
$table_name= ''inbound_email''
The database table where records of this Bean are stored.
'inbound_email'Details- Type
- String

$team_set_id= ''
- Type
- n/a
- Inherited_from
- \SugarBean::$$team_set_id

$tracker_visibility= 'true'
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_visibilitytrueDetails- Type
- n/a
- Inherited_from
- \SugarBean::$$tracker_visibility

$transferEncoding= 'array(0 => '7BIT',
1 => '8BIT',
2 => 'BINARY',
3 => 'BASE64',
4 => 'QUOTED-PRINTABLE',
5 => 'OTHER'
)'
array(0 => '7BIT',
1 => '8BIT',
2 => 'BINARY',
3 => 'BASE64',
4 => 'QUOTED-PRINTABLE',
5 => 'OTHER'
)Details- Type
- n/a

$ungreedy_count= 'false'
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_countfalseDetails- Type
- n/a
- Inherited_from
- \SugarBean::$$ungreedy_count

$unsafeChars= 'array("&", "!", "'", '"', '\\', '/', '<', '>', '|', '$',)'
array("&", "!", "'", '"', '\\', '/', '<', '>', '|', '$',)Details- Type
- n/a

BOOL
$update_date_entered= 'false'
Setting this to true allows for updates to overwrite the date_entered
Inherited from: \SugarBean::$$update_date_enteredfalseDetails- Type
- BOOL
- Inherited_from
- \SugarBean::$$update_date_entered

BOOL
$update_date_modified= 'true'
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_modifiedtrueDetails- Type
- BOOL
- Inherited_from
- \SugarBean::$$update_date_modified

BOOL
$update_modified_by= 'true'
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_bytrueDetails- Type
- BOOL
- Inherited_from
- \SugarBean::$$update_modified_by
Methods

ACLAccess(
\$view $view, \$is_owner $is_owner
=
'not_set'
)
:
voidCheck whether the user has access to a particular view for the current bean/module
Inherited from: \SugarBean::ACLAccess()| 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 |

SugarBean(
)
:
voidConstructor for the bean, it performs following tasks:
Inherited from: \SugarBean::SugarBean()- Initalized a database connections
- Load the vardefs for the module implemeting the class. cache the entries if needed
- Setup row-level security preference All implementing classes must call this constructor using the parent::SugarBean() class.

__clone(
)
:
voidHandle 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
- Api

_checkOptimisticLocking(
$action, $isUpdate
)
:
voidMoved from save() method, functionality is the same, but this is intended to handle Optimistic locking functionality.
Inherited from: \SugarBean::_checkOptimisticLocking()| Name | Type | Description |
|---|---|---|
| $action | ||
| $isUpdate |

_get_num_rows_in_query(
string $query, boolean $is_count_query
=
false
)
:
intReturns the number of rows that the given SQL query should produce
Inherited from: \SugarBean::_get_num_rows_in_query()Internal function, do not override.
| 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. |
| Type | Description |
|---|---|
| int | count of rows found |

_loadCachedArray(
\$module_dir $module_dir, \$module $module, \$key $key
)
:
voidThis 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()| 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 |

_sendNotifications(
$check_notify
)
:
voidSend assignment notifications and invites for meetings and calls
Inherited from: \SugarBean::_sendNotifications()| Name | Type | Description |
|---|---|---|
| $check_notify |

addBreadCrumbOffset(
string $bc, string $offset
)
:
stringGivin an existing breadcrumb add a cooresponding offset
| Name | Type | Description |
|---|---|---|
| $bc | string | |
| $offset | string |
| Type | Description |
|---|---|
| string |

add_address_streets(
string $street_field
)
:
voidCombined the contents of street field 2 thru 4 into the main field
Inherited from: \SugarBean::add_address_streets()| Name | Type | Description |
|---|---|---|
| $street_field | string |

add_list_count_joins(
string $query, string $where
)
:
voidAdd 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()| Name | Type | Description |
|---|---|---|
| $query | string | |
| $where | string | Internal Function, do Not override. |

afterImportSave(
)
:
voidCalled during the import process after a bean save, to handle any needed post-save logic when importing a record
Inherited from: \SugarBean::afterImportSave()
assign_display_fields(
$currentModule
)
:
void| Name | Type | Description |
|---|---|---|
| $currentModule |

bean_implements(
$interface
)
:
void| Name | Type | Description |
|---|---|---|
| $interface |

beforeImportSave(
)
:
voidCalled during the import process before a bean save, to handle any needed pre-save logic when importing a record
Inherited from: \SugarBean::beforeImportSave()
buildBreadCrumbs(
\$parts $parts, \$subtype $subtype, \$breadcrumb $breadcrumb
=
'0'
)
:
voidBuilds up the "breadcrumb" trail that imap_fetchbody() uses to return parts of an email message, including attachments and inline images
| 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 |

buildBreadCrumbsHTML(
array $parts, int $breadcrumb
=
'0', array $stackedBreadcrumbs
=
array()
)
:
arraySimilar to buildBreadCrumbs() but returns an ordered array containing all parts of the message that would be considered "HTML" or Richtext (embedded images, formatting, etc.).
| 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 |
| Type | Description |
|---|---|
| array | Ordered array of parts to retrieve via imap_fetchbody() |

build_generic_where_clause(
$value
)
:
voidOverride this function to build a where clause based on the search criteria set into bean .
Inherited from: \SugarBean::build_generic_where_clause()| Name | Type | Description |
|---|---|---|
| $value |
- Abstract

build_related_in(
string $query
)
:
voidConstructs an comma separated list of ids from passed query results.
Inherited from: \SugarBean::build_related_in()| Name | Type | Description |
|---|---|---|
| $query | string | @query query to be executed. |

build_related_list(
string $query, object $template, int $row_offset
=
0, int $limit
=
-1
)
:
arrayThis 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.
| Name | Type | Description |
|---|---|---|
| $query | string |
|
| $template | object |
|
| $row_offset | int | Optional, default 0 |
| $limit | int | Optional, default -1 |
| Type | Description |
|---|---|
| array |

build_related_list2(
string $query, object $template, array $field_list
)
:
arrayOptionally copies values from fetched row into the bean.
Inherited from: \SugarBean::build_related_list2()Internal function, do not override.
| Name | Type | Description |
|---|---|---|
| $query | string |
|
| $template | object |
|
| $field_list | array | List of fields. |
| Type | Description |
|---|---|
| array |

build_related_list_where(
string $query, object $template, $where
=
'', $in
=
'', $order_by, $limit
=
'', $row_offset
=
0
)
:
voidThis 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
| Name | Type | Description |
|---|---|---|
| $query | string |
|
| $template | object |
|
| $where | ||
| $in | ||
| $order_by | ||
| $limit | ||
| $row_offset |

build_sub_queries_for_union(
$subpanel_list, $subpanel_def, $parentbean, $order_by
)
:
void
| Name | Type | Description |
|---|---|---|
| $subpanel_list | ||
| $subpanel_def | ||
| $parentbean | ||
| $order_by |

call_custom_logic(
$event, $arguments
=
null
)
:
voidTrigger 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.
| Name | Type | Description |
|---|---|---|
| $event | ||
| $arguments |

checkEmail(
$prefetch
=
true, $synch
=
false
)
:
voidupdate INBOX
| Name | Type | Description |
|---|---|---|
| $prefetch | ||
| $synch |

checkEmailIMAPPartial(
$prefetch
=
true, $synch
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $prefetch | ||
| $synch |

checkEmailOneMailbox(
string $mailbox, bool $prefetch
=
true, $synchronize
=
false
)
:
voidChecks email (local caching too) for one mailbox
| Name | Type | Description |
|---|---|---|
| $mailbox | string | IMAP Mailbox path |
| $prefetch | bool | Flag to prefetch email body on check |
| $synchronize |

checkEmailOneMailboxPartial(
string $mailbox, bool $prefetch
=
true, $synchronize
=
false, $start
=
0, $max
=
-1
)
:
voidChecks email (local caching too) for one mailbox
| Name | Type | Description |
|---|---|---|
| $mailbox | string | IMAP Mailbox path |
| $prefetch | bool | Flag to prefetch email body on check |
| $synchronize | ||
| $start | ||
| $max |

checkFilterDomain(
object $email
)
:
boolreturns true if the email's domain is NOT in the filter domain string
| Name | Type | Description |
|---|---|---|
| object | email Email object in question |
| Type | Description |
|---|---|
| bool | true if not filtered, false if filtered |

checkOutOfOffice(
string $subject
)
:
boolreturns true if subject is NOT "out of the office" type
| Name | Type | Description |
|---|---|---|
| $subject | string | subject Subject line of email in question |
| Type | Description |
|---|---|
| bool | returns false if OOTO found |

check_date_relationships_load(
)
:
\thisThis 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.
| Type | Description |
|---|---|
| \this | - The object that it was called apon or null if exactly 1 record was not found. |

cleanBean(
)
:
voidCleans char, varchar, text, etc. fields of XSS type materials
Inherited from: \SugarBean::cleanBean()
collapseLongMailingList(
string $emails
)
:
stringTakes a long list of email addresses from a To or CC field and shows the first 3, the rest hidden
| Name | Type | Description |
|---|---|---|
| $emails | string | emails |
| Type | Description |
|---|---|
| string |

connectMailserver(
bool $test
=
false, bool $force
=
false
)
:
stringConnects to mailserver. If an existing IMAP resource is available, it will attempt to reuse the connection, updating the mailbox path.
| Name | Type | Description |
|---|---|---|
| $test | bool | test Flag to test connection |
| $force | bool | force Force reconnect |
| Type | Description |
|---|---|
| string | "true" on success, "false" or $errorMessage on failure |

convertField(
$fieldvalue, $fieldDef
)
:
stringConverts the field value based on the provided fieldDef
Inherited from: \SugarBean::convertField()| Name | Type | Description |
|---|---|---|
| $fieldvalue | ||
| $fieldDef |
| Type | Description |
|---|---|
| string |

convertImapToSugarEmailAddress(
\$arr $arr
)
:
voidTakes a PHP imap_* object's to/from/cc/bcc address field and converts it to a standard string that SugarCRM expects
| Name | Type | Description |
|---|---|---|
| $arr | \$arr | an array of email address objects |

convertRow(
array $row
)
:
arrayConvert row data from DB format to internal format Mostly useful for dates/times
Inherited from: \SugarBean::convertRow()| Name | Type | Description |
|---|---|---|
| $row | array |
| Type | Description |
|---|---|
| array | $row |

convertToUtf8(
string $input
)
:
stringhelper method to convert text to utf-8 if necessary
| Name | Type | Description |
|---|---|---|
| $input | string | text |
| Type | Description |
|---|---|
| string | output text |

copyEmails(
string $fromIe, string $fromFolder, string $toIe, string $toFolder, string $uids
)
:
voidmoves emails from folder to folder
| 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 |

createAutoImportSugarFolder(
)
:
StringCreate a sugar folder for this inbound email account if the Enable Auto Import option is selected
| Type | Description |
|---|---|
| String | Id of the sugar folder created. |

createRelationshipMeta(
string $key, object $db, string $tablename, array $dictionary, string $module_dir, boolean $iscustom
=
false
)
:
voidPopulates 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.
| 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. |
- Static
- Internal function, do not override.

createUserSubscriptionsForGroupAccount(
)
:
voidFor a group email account, create subscriptions for all users associated with the team assigned to the account.

create_audit_table(
)
:
voidIf 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.

create_export_query(
string $order_by, string $where, $show_deleted
=
0
)
:
stringOverride's SugarBean's
| Name | Type | Description |
|---|---|---|
| $order_by | string | |
| $where | string | |
| $show_deleted |
| Type | Description |
|---|---|
| string | SQL query |

create_index(
$query
)
:
voidThis is a helper function that is used to quickly created indexes when creating tables.
Inherited from: \SugarBean::create_index()| Name | Type | Description |
|---|---|---|
| $query |

create_list_count_query(
string $query
)
:
stringChanges 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()| Name | Type | Description |
|---|---|---|
| $query | string | Select query string |
| Type | Description |
|---|---|
| string | count query Internal function, do not override. |

create_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
)
:
StringReturn 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.
| 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 |
| Type | Description |
|---|---|
| String | select query string, optionally an array value will be returned if $return_array= true. |

create_notification_email(
string $notify_user
)
:
voidThis function handles create the email notifications email.
Inherited from: \SugarBean::create_notification_email()| Name | Type | Description |
|---|---|---|
| $notify_user | string | the user to send the notification email to |

create_qualified_order_by(
string $order_by, string $qualify
)
:
\prefixedEnsure 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()| Name | Type | Description |
|---|---|---|
| $order_by | string | original order by from the query |
| $qualify | string | prefix for columns in the order by list. |
| Type | Description |
|---|---|
| \prefixed | Internal function do not override. |

create_relationship_meta(
$key, $db, $log, $tablename, $dictionary, $module_dir
)
:
void
| Name | Type | Description |
|---|---|---|
| $key | ||
| $db | ||
| $log | ||
| $tablename | ||
| $dictionary | ||
| $module_dir |
- See
- \createRelationshipMeta()
- Static

create_tables(
)
:
voidCreates 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.

customGetMessageText(
string $msgPart
)
:
stringCalled 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
| Name | Type | Description |
|---|---|---|
| $msgPart | string |
| Type | Description |
|---|---|
| string |

decodeHeader(
\header $fullHeader
)
:
\decodedHeaderdecodes raw header information and passes back an associative array with the important elements key'd by name
| Name | Type | Description |
|---|---|---|
| $fullHeader | \header | string the raw header |
| Type | Description |
|---|---|
| \decodedHeader | array the associative array |

decrypt_after_retrieve(
STRING $value
)
:
stringDecode and decrypt a base 64 encoded string with field type 'encrypt' in this bean using Blowfish.
Inherited from: \SugarBean::decrypt_after_retrieve()| Name | Type | Description |
|---|---|---|
| $value | STRING | value - an encrypted and base 64 encoded string. |
| Type | Description |
|---|---|
| string |

deleteCachedMessages(
string $uids, string $fromFolder
)
:
voidDeletes cached messages when moving from folder to folder
| Name | Type | Description |
|---|---|---|
| $uids | string | |
| $fromFolder | string |

deleteFolder(
string $mbox
)
:
boolDeletes the specified folder
| Name | Type | Description |
|---|---|---|
| $mbox | string | "::" delimited IMAP mailbox path, ie, INBOX.saved.stuff |
| Type | Description |
|---|---|
| bool |

deleteMessageFromCache(
string $uids
)
:
voidRemoves an email from the cache file, deletes the message from the cache too
| Name | Type | Description |
|---|---|---|
| $uids | string | String of uids, comma delimited |

deleteMessageOnMailServer(
string $uid
)
:
booldeletes and expunges emails on server
| Name | Type | Description |
|---|---|---|
| $uid | string | UID(s), comma delimited, of email(s) on server |
| Type | Description |
|---|---|
| bool | true on success |

deleteMessageOnMailServerForPop3(
string $uid
)
:
voiddeletes and expunges emails on server
| Name | Type | Description |
|---|---|---|
| $uid | string | UID(s), comma delimited, of email(s) on server |

deletePersonalEmailAccount(
string $id, string $user_name
)
:
boolsoft deletes a User's personal inbox
| Name | Type | Description |
|---|---|---|
| $id | string | id I-E id |
| $user_name | string | user_name User name of User in focus, NOT current_user |
| Type | Description |
|---|---|
| bool | True on success |

delete_linked(
string $id
)
:
voidIterates through all the relationships and deletes all records for reach relationship.
Inherited from: \SugarBean::delete_linked()| Name | Type | Description |
|---|---|---|
| $id | string | Primary key value of the parent reocrd |

displayFolderContents(
string $mbox, string $forceRefresh
=
'false', $page
)
:
voidReturns a list of emails in a mailbox.
| Name | Type | Description |
|---|---|---|
| $mbox | string | mbox Name of mailbox using dot notation paths to display |
| $forceRefresh | string | Flag to use cache or not |
| $page |

displayOneEmail(
int $uid, string $mbox, bool $isMsgNo
=
false
)
:
voidShows one email.
| 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 |

drop_tables(
)
:
voidDelete 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.

encrpyt_before_save(
STRING $value
)
:
stringEncrpyt 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()| Name | Type | Description |
|---|---|---|
| $value | STRING | value -plain text value of the bean field. |
| Type | Description |
|---|---|
| string |

fetchCheckedEmails(
array $fetchedOverviews
)
:
voidCheck email prefetches email bodies for quicker display
| Name | Type | Description |
|---|---|---|
| $fetchedOverviews | array | array of fetched overviews |

fill_in_additional_detail_fields(
)
:
voidOverride'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

fill_in_additional_list_fields(
)
:
voidOverride'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.

fill_in_additional_parent_fields(
)
:
voidThis 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()
fill_in_link_field(
$linkFieldName, $def
)
:
void| Name | Type | Description |
|---|---|---|
| $linkFieldName | ||
| $def |

fill_in_relationship_fields(
)
:
voidFill in fields where type = relate
Inherited from: \SugarBean::fill_in_relationship_fields()
filterMailBoxFromRaw(
$mailboxArray, $rawArray
)
:
void| Name | Type | Description |
|---|---|---|
| $mailboxArray | ||
| $rawArray |

findOptimumSettings(
$useSsl
=
false, $user
=
'', $pass
=
'', $server
=
'', $port
=
'', $prot
=
'', $mailbox
=
''
)
:
voidProgramatically determines best-case settings for imap_open()
| Name | Type | Description |
|---|---|---|
| $useSsl | ||
| $user | ||
| $pass | ||
| $server | ||
| $port | ||
| $prot | ||
| $mailbox |

fixUpFormatting(
)
:
voidFunction 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

format_all_fields(
)
:
voidThis functions adds formatting to all number fields before presenting them to user interface.
Inherited from: \SugarBean::format_all_fields()Internal function, do not override.

format_field(
$fieldDef
)
:
void| Name | Type | Description |
|---|---|---|
| $fieldDef |

fromArray(
Array $arr
)
:
voidConverts an array into an acl mapping name value pairs into files
Inherited from: \SugarBean::fromArray()| Name | Type | Description |
|---|---|---|
| $arr | Array |

generateArrayData(
$key, $arraymbox, $ret, $delimiter
)
:
void| Name | Type | Description |
|---|---|---|
| $key | ||
| $arraymbox | ||
| $ret | ||
| $delimiter |

generateFlatArrayFromMultiDimArray(
$arraymbox, $delimiter
)
:
void| Name | Type | Description |
|---|---|---|
| $arraymbox | ||
| $delimiter |

generateMultiDimArrayFromFlatArray(
$raw, $delimiter
)
:
void| Name | Type | Description |
|---|---|---|
| $raw | ||
| $delimiter |

getACLCategory(
)
:
stringReturns the ACL category for this module; defaults to the SugarBean::$acl_category if defined otherwise it is SugarBean::$module_dir
Inherited from: \SugarBean::getACLCategory()| Type | Description |
|---|---|
| string |

getAuditEnabledFieldDefinitions(
)
:
\anReturns 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.
| Type | Description |
|---|---|
| \an | array of |
- See
- \is_AuditEnabled

getAutoreplyStatus(
string $from
)
:
boolreturns true if recipient has NOT received 10 auto-replies in 24 hours
| Name | Type | Description |
|---|---|---|
| $from | string | from target address for auto-reply |
| Type | Description |
|---|---|
| bool | true if target is valid/under limit |

getCacheCount(
string $mbox
)
:
intReturns total number of emails for a mailbox
| Name | Type | Description |
|---|---|---|
| $mbox | string | mbox |
| Type | Description |
|---|---|
| int |

getCacheUnreadCount(
string $mbox
)
:
intGets a count of all rows that are flagged seen = 0
| Name | Type | Description |
|---|---|---|
| $mbox | string |
| Type | Description |
|---|---|
| int |

getCacheValue(
$mbox, $limit
=
20, $page
=
1, $sort
=
'', $direction
=
''
)
:
arrayRetrieves cached headers
| Name | Type | Description |
|---|---|---|
| $mbox | ||
| $limit | ||
| $page | ||
| $sort | ||
| $direction |
| Type | Description |
|---|---|
| array |

getCacheValueForUIDs(
$mbox, $UIDs
)
:
arrayRetrieves cached headers
| Name | Type | Description |
|---|---|---|
| $mbox | ||
| $UIDs |
| Type | Description |
|---|---|
| array |

getCaseIdFromCaseNumber(
\$emailName $emailName, \$aCase $aCase
)
:
voidfor mailboxes of type "Support" parse for '[CASE:%1]'
| Name | Type | Description |
|---|---|---|
| $emailName | \$emailName | the subject line of the email |
| $aCase | \$aCase | a Case object |

getCharsetFromBreadCrumb(
string $bc, array $parts
)
:
stringretrieves the charset for a given part of an email body
| 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 |
| Type | Description |
|---|---|
| string | charset name |

getConnectString(
string $service
=
'', $mbox
=
'', $includeMbox
=
true
)
:
stringConstructs the resource connection string that IMAP needs
| Name | Type | Description |
|---|---|---|
| $service | string | Service string, will generate if not passed |
| $mbox | ||
| $includeMbox |
| Type | Description |
|---|---|
| string |

getCorrectMessageNoForPop3(
String $messageId
)
:
\returnMsgNoThis method returns the correct messageno for the pop3 protocol
| Name | Type | Description |
|---|---|---|
| $messageId | String | UIDL |
| Type | Description |
|---|---|
| \returnMsgNo |

getDuplicateEmailId(
$msgNo, $uid
)
:
voidIf the importOneEmail returns false, then findout if the duplicate email
| Name | Type | Description |
|---|---|---|
| $msgNo | ||
| $uid |

getEncodingFromBreadCrumb(
string $bc, array $parts
)
:
inttakes a breadcrumb and returns the encoding at that level
| Name | Type | Description |
|---|---|---|
| $bc | string | bc the breadcrumb string in format (1.1.1) |
| $parts | array | parts the root level parts array |
| Type | Description |
|---|---|
| int | retInt Int key to transfer encoding (see handleTranserEncoding()) |

getFieldDefinition(
string $name
)
:
ArrayReturns field definition for the requested field name.
Inherited from: \SugarBean::getFieldDefinition()The definitions were loaded in the constructor.
| Name | Type | Description |
|---|---|---|
| $name | string | field name, |
| Type | Description |
|---|---|
| Array | Field properties or boolean false if the field doesn't exist Internal function, do not override. |

getFieldDefinitions(
)
:
ArrayReturns field definitions for the implementing module.
Inherited from: \SugarBean::getFieldDefinitions()The definitions were loaded in the constructor.
| Type | Description |
|---|---|
| Array | Field definitions. Internal function, do not override. |

getFieldValue(
string $name
)
:
\varies
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.
| Name | Type | Description |
|---|---|---|
| $name | string | field name, |
| Type | Description |
|---|---|
| \varies | Field value. Internal function, do not override. |

getFormattedHeaders(
int $uid
)
:
stringconstructs a nicely formatted version of email headers.
| Name | Type | Description |
|---|---|---|
| $uid | int |
| Type | Description |
|---|---|
| string |

getFormattedRawSource(
int $uid
)
:
stringconstructs a nicely formatted version of raw source
| Name | Type | Description |
|---|---|---|
| $uid | int | UID of email |
| Type | Description |
|---|---|
| string |

getGroupsWithSelectOptions(
array $groups
=
array()
)
:
stringReturns
| Name | Type | Description |
|---|---|---|
| $groups | array | default empty array |
| Type | Description |
|---|---|
| string | HTML options |

getImapMboxFromSugarProprietary(
string $mbox
)
:
stringConstructs an IMAP c-client compatible folder path from Sugar proprietary
| Name | Type | Description |
|---|---|---|
| $mbox | string | "::" delimited IMAP mailbox path, ie, INBOX.saved.stuff |
| Type | Description |
|---|---|
| string |

getIndices(
)
:
ArrayReturns index definitions for the implementing module.
Inherited from: \SugarBean::getIndices()The definitions were loaded in the constructor.
| Type | Description |
|---|---|
| Array | Index definitions. Internal function, do not override. |

getMailboxes(
bool $justRaw
=
false
)
:
arrayretrieves the mailboxes for a given account in the following format Array( [INBOX] => Array ( [Bugs] => Bugs [Builder] => Builder [DEBUG] => Array ( [out] => out [test] => test ) )
| Name | Type | Description |
|---|---|---|
| $justRaw | bool | Default false |
| Type | Description |
|---|---|
| array |

getMessageId(
$header
)
:
voidSome emails do not get assigned a message_id, specifically from Outlook/Exchange.
We need to derive a reliable one for duplicate import checking.
| Name | Type | Description |
|---|---|---|
| $header |

getMessageText(
int $msgNo, string $type, $structure, $fullHeader, $clean_email
=
true, $bcOffset
=
""
)
:
stringreturns the HTML text part of a multi-part message
| 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 |
| Type | Description |
|---|---|
| string | UTF-8 encoded version of the requested message text |

getMessageTextFromSingleMimePart(
string $msgNo, string $section, \stdObject $structure
)
:
stringGet the message text from a single mime section, html or plain.
| Name | Type | Description |
|---|---|---|
| $msgNo | string | |
| $section | string | |
| $structure | \stdObject |
| Type | Description |
|---|---|
| string |

getMessagesInEmailCache(
string $msgno, string $uid
)
:
voidThis function is used by cron job for group mailbox without group folder
| Name | Type | Description |
|---|---|---|
| $msgno | string | for pop |
| $uid | string | for imap |

getMsgnoForMessageID(
int $messageid
)
:
\UIDLGets the UIDL from database for the corresponding msgno
| Name | Type | Description |
|---|---|---|
| $messageid | int | messageNo of a message |
| Type | Description |
|---|---|
| \UIDL | for the message |

getNewEmailsForSyncedMailbox(
)
:
arrayGet Email messages IDs from server which aren't in database
| Type | Description |
|---|---|
| array | Ids of messages, which aren't still in database |

getNewMessageIds(
)
:
arrayfinds emails tagged "//UNSEEN" on mailserver and "SINCE: [date]" if that option is set
| Type | Description |
|---|---|
| array | Array of messageNumbers (mail server's internal keys) |

getNoteBeanForAttachment(
string $emailId
)
:
\NoteReturn a new note object for attachments.
| Name | Type | Description |
|---|---|---|
| $emailId | string |
| Type | Description |
|---|---|
| \Note |

getObjectName(
)
:
\nothingReturns 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.
| Type | Description |
|---|---|
| \nothing |

getOverviewsFromCacheFile(
string $uids, string $mailbox
=
'', bool $remove
=
false
)
:
arraysimilar to imap_fetch_overview, but it gets overviews from a local cache file.
| 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 |
| Type | Description |
|---|---|
| array |

getOwnerField(
$returnFieldName
=
false
)
:
STRING
| Name | Type | Description |
|---|---|---|
| $returnFieldName |
| Type | Description |
|---|---|
| STRING |

getOwnerWhere(
\GUID $user_id
)
:
STRINGGets there where statement for checking if a user is an owner
Inherited from: \SugarBean::getOwnerWhere()| Name | Type | Description |
|---|---|---|
| $user_id | \GUID |
| Type | Description |
|---|---|
| STRING |

getPartByPath(
string $bc, array $parts
)
:
voidGets part by following breadcrumb path
| Name | Type | Description |
|---|---|---|
| $bc | string | the breadcrumb string in format (1.1.1) |
| $parts | array | parts the root level parts array |

getPrimaryFieldDefinition(
)
:
ArrayReturnss definition for the id field name.
Inherited from: \SugarBean::getPrimaryFieldDefinition()The definitions were loaded in the constructor.
| Type | Description |
|---|---|
| Array | Field properties. Internal function, do not override. |

getRealKeyFromCustomFieldAssignedKey(
$name
)
:
void| Name | Type | Description |
|---|---|---|
| $name |

getRelatedFields(
$module, $id, $fields, $return_array
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $module | ||
| $id | ||
| $fields | ||
| $return_array |

getRelatedId(
\$email $email, \$table $module
)
:
voidThis function returns a contact or user ID if a matching email is found
| Name | Type | Description |
|---|---|---|
the email address to match |
||
| $module | \$table | which table to query |

getServiceString(
)
:
stringparses Sugar's storage method for imap server service strings
| Type | Description |
|---|---|
| string |

getSessionConnectionString(
$server_url, $email_user, $port, $protocol
)
:
void| Name | Type | Description |
|---|---|---|
| $server_url | ||
| $email_user | ||
| $port | ||
| $protocol |

getSessionInboundDelimiterString(
$server_url, $email_user, $port, $protocol
)
:
void| Name | Type | Description |
|---|---|---|
| $server_url | ||
| $email_user | ||
| $port | ||
| $protocol |

getSessionInboundFoldersString(
$server_url, $email_user, $port, $protocol
)
:
void| Name | Type | Description |
|---|---|---|
| $server_url | ||
| $email_user | ||
| $port | ||
| $protocol |

getSingularRelatedId(
\$emailName $emailName, \$tableName $tableName
)
:
voidreturns exactly 1 id match. if more than one, than returns false
| Name | Type | Description |
|---|---|---|
| $emailName | \$emailName | the subject of the email to match |
| $tableName | \$tableName | the table of the matching bean type |

getSystemSettingsForm(
)
:
stringreturns the HTML for InboundEmail system settings
| Type | Description |
|---|---|
| string | HTML |

getTableName(
)
:
String
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.
| Type | Description |
|---|---|
| String | Table name. Internal function, do not override. |

getTempFilename(
bool $nameOnly
=
false
)
:
stringGenerate 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.
| Name | Type | Description |
|---|---|---|
| $nameOnly | bool | Whether or not the attachment count should be appended to the filename. |
| Type | Description |
|---|---|
| string | The temp file name |

getUIDLForMessage(
int $msgNo
)
:
\UIDLGets the UIDL from database for the corresponding msgno
| Name | Type | Description |
|---|---|---|
| $msgNo | int | messageNo of a message |
| Type | Description |
|---|---|
| \UIDL | for the message |

getUnixHeaderDate(
string $headerDate
)
:
stringCalculates the appropriate display date/time sent for an email.
| Name | Type | Description |
|---|---|---|
| $headerDate | string | headerDate The date sent of email in MIME header format |
| Type | Description |
|---|---|
| string | GMT-0 Unix timestamp |

getUserPersonalAccountCount(
\unknown_type $user
=
null
)
:
voidRetrieves the current count of personal accounts for the user specified.
| Name | Type | Description |
|---|---|---|
| $user | \unknown_type |

getUsersDefaultOutboundServerId(
\User $user
)
:
stringGet the users default IE account id
| Name | Type | Description |
|---|---|---|
| $user | \User |
| Type | Description |
|---|---|
| string |

get_audit_table_name(
)
:
String
Audit table's name is based on implementing class' table name.
| Type | Description |
|---|---|
| String | Audit table name. Internal function, do not override. |

get_custom_table_name(
)
:
String
Custom table's name is based on implementing class' table name.
| Type | Description |
|---|---|
| String | Custom table name. Internal function, do not override. |

get_full_list(
string $order_by
=
"", string $where
=
"", $check_dates
=
false, int $show_deleted
=
0
)
:
voidReturns a full (ie non-paged) list of the current object type.
Inherited from: \SugarBean::get_full_list()| 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 |

get_import_required_fields(
)
:
arrayReturns an array of fields that are required for import
Inherited from: \SugarBean::get_import_required_fields()| Type | Description |
|---|---|
| array |

get_importable_fields(
)
:
arrayReturns an array of fields that are able to be Imported into i.e. 'importable' not set to 'false'
Inherited from: \SugarBean::get_importable_fields()| Type | Description |
|---|---|
| array | List of fields. Internal function, do not override. |

get_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
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.
| 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 |

get_linked_fields(
)
:
arrayReturns an array of fields that are of type link.
Inherited from: \SugarBean::get_linked_fields()| Type | Description |
|---|---|
| array | List of fields. Internal function, do not override. |

get_list_view_array(
)
:
voidAssigns all of the values into the template for the list view
Inherited from: \SugarBean::get_list_view_array()
get_notification_recipients(
)
:
voidDetermines which users receive a notification
Inherited from: \SugarBean::get_notification_recipients()
get_related_fields(
)
:
arrayReturns an array of fields that are of type relate.
Inherited from: \SugarBean::get_related_fields()| Type | Description |
|---|---|
| array | List of fields. Internal function, do not override. |

get_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
| 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 |
| Type | Description |
|---|---|
| array | Fetched data. Internal function, do not override. |

get_stored_options(
$option_name, $default_value
=
null, $stored_options
=
null
)
:
void| Name | Type | Description |
|---|---|---|
| $option_name | ||
| $default_value | ||
| $stored_options |

get_summary_text(
)
:
stringreturns the bean name - overrides SugarBean's
| Type | Description |
|---|---|
| string |

get_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
)
:
voidConstructs a query to fetch data for supanels and list views
Inherited from: \SugarBean::get_union_related_list()It constructs union queries for activities subpanel.
| 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 |

get_where(
array $fields_array
)
:
stringConstruct where clause from a list of name-value pairs.
Inherited from: \SugarBean::get_where()| Name | Type | Description |
|---|---|---|
| $fields_array | array | Name/value pairs for column checks |
| Type | Description |
|---|---|
| string | The WHERE clause |

groupUserDupeCheck(
)
:
\GUIDbooleanChecks for duplicate Group User names when creating a new one at save()
| Type | Description |
|---|---|
| \GUIDboolean | returns GUID of Group User if user_name match is foundfalse if NO DUPE IS FOUND |

handleAutoresponse(
object $email, $contactAddr
)
:
voidhandles auto-responses to inbound emails
| Name | Type | Description |
|---|---|---|
| object | email Email passed as reference |
|
| $contactAddr |

handleCharsetTranslation(
string $text, string $charset
)
:
stringhandles translating message text from orignal encoding into UTF-8
| Name | Type | Description |
|---|---|---|
| $text | string | text test to be re-encoded |
| $charset | string | charset original character set |
| Type | Description |
|---|---|
| string | utf8 re-encoded text |

handleEncodedFilename(
string $name
)
:
stringtries to figure out what character set a given filename is using and decode based on that
| Name | Type | Description |
|---|---|---|
| $name | string | name Name of attachment |
| Type | Description |
|---|---|
| string | decoded name |

handleLinking(
object $email
)
:
stringhandles linking contacts, accounts, etc. to an email
| Name | Type | Description |
|---|---|---|
| object | Email bean to be linked against |
| Type | Description |
|---|---|
| string | contactAddr is the email address of the sender |

handleMailboxType(
object $email, object $header
)
:
voidhandles functionality specific to the Mailbox type (Cases, bounced campaigns, etc.)
| Name | Type | Description |
|---|---|---|
| object | email Email object passed as a reference |
|
| $header | object | header Header object generated by imap_headerinfo(); |

handleMimeHeaderDecode(
string $subject
)
:
stringtakes the output from imap_mime_hader_decode() and handles multiple types of encoding
| Name | Type | Description |
|---|---|---|
| $subject | string | subject Raw subject string from email |
| Type | Description |
|---|---|
| string | ret properly formatted UTF-8 string |

handleTranserEncoding(
\$str $str, \$enc $enc
=
0
)
:
voiddecodes a string based on its associated encoding if nothing is passed, we default to no-encoding type
| Name | Type | Description |
|---|---|---|
| $str | \$str | encoded string |
| $enc | \$enc | detected encoding |

handleUUDecode(
string $id, string $fileName, $UUEncode
)
:
voidwrapper for UUDecode
| Name | Type | Description |
|---|---|---|
| $id | string | id Id of the email |
| $fileName | string | UUEncode Encode US-ASCII |
| $UUEncode |

handleUUEncodedEmailBody(
string $raw, string $id
)
:
stringhandles UU Encoded emails - a legacy from pre-RFC 822 which must still be supported (?)
| Name | Type | Description |
|---|---|---|
| $raw | string | raw The raw email body |
| $id | string | id Parent email ID |
| Type | Description |
|---|---|
| string | The filtered email body, stripped of attachments |

hardDelete(
string $id
)
:
voidHard deletes an I-E account
| Name | Type | Description |
|---|---|---|
| $id | string | id GUID |

has_been_modified_since(
\date $date, string $modified_user_id
)
:
voidPerforms a check if the record has been modified since the specified date
Inherited from: \SugarBean::has_been_modified_since()| Name | Type | Description |
|---|---|---|
| $date | \date | Datetime for verification |
| $modified_user_id | string | User modified by |

importDupeCheck(
string $message_id, int $header, object $textHeader
)
:
boolchecks 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.
| 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() |
| Type | Description |
|---|---|
| bool |

importOneEmail(
int $msgNo, bool $uid, \clean_email $forDisplay
=
false, $clean_email
=
true
)
:
voidshiny new importOneEmail() method
| Name | Type | Description |
|---|---|---|
| $msgNo | int | msgNo |
| $uid | bool | forDisplay |
| $forDisplay | \clean_email | boolean, default true, |
| $clean_email |

isAutoImport(
object $user
=
null
)
:
boolChecks for $user's autoImport setting and returns the current value
| Name | Type | Description |
|---|---|---|
| $user | object | User in focus, defaults to $current_user |
| Type | Description |
|---|---|
| bool |

isOwner(
\GUID $user_id
)
:
booleanReturns true of false if the user_id passed is the owner
Inherited from: \SugarBean::isOwner()| Name | Type | Description |
|---|---|---|
| $user_id | \GUID |
| Type | Description |
|---|---|
| boolean |

isPop3Protocol(
)
:
booleanChecks if this is a pop3 type of an account or not
| Type | Description |
|---|---|
| boolean |

isUuencode(
string $string
)
:
boolfigures out if a plain text email body has UUEncoded attachments
| Name | Type | Description |
|---|---|---|
| $string | string | string The email body |
| Type | Description |
|---|---|
| bool | True if UUEncode is detected. |

is_AuditEnabled(
)
:
booleanReturn 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()| Type | Description |
|---|---|
| boolean | Internal function, do not override. |

list_view_parse_additional_sections(
$list_form
)
:
voidLet implementing classes to fill in row specific columns of a list view form
Inherited from: \SugarBean::list_view_parse_additional_sections()| Name | Type | Description |
|---|---|---|
| $list_form |

listviewACLHelper(
)
:
ARRAYUsed 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()| Type | Description |
|---|---|
| ARRAY | of STRINGS |

loadFromRow(
array $arr
)
:
\nothingLoads a row of data into instance of a bean. The data is passed as an array to this function
Inherited from: \SugarBean::loadFromRow()| Name | Type | Description |
|---|---|---|
| $arr | array | row of data fetched from the database. |
| Type | Description |
|---|---|
| \nothing | Internal function do not override. |

load_relationship(
string $rel_name
)
:
\nothing.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.
| Name | Type | Description |
|---|---|---|
| $rel_name | string | relationship/attribute name. |
| Type | Description |
|---|---|
| \nothing. |

load_relationships(
)
:
\Nothing
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.
| Type | Description |
|---|---|
| \Nothing | Internal function, do not override. |

markEmails(
string $uids, string $type
)
:
voidSets flags on emails. Assumes that connection is live, correct folder is set.
| Name | Type | Description |
|---|---|---|
| $uids | string | Sequence of UIDs, comma separated |
| $type | string | Flag to mark |

mark_answered(
string $mailid, $type
=
'smtp'
)
:
voidMark cached email answered (replied)
| Name | Type | Description |
|---|---|---|
| $mailid | string | (uid for imap, message_id for pop3) |
| $type |

mark_deleted(
string $id
)
:
voidOverrides SugarBean's mark_deleted() to drop the related cache table
If it is not overridden, then marking this type of item is not allowed
| Name | Type | Description |
|---|---|---|
| $id | string | GUID of I-E instance |

mark_relationships_deleted(
int $id
)
:
voidThis 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.
| Name | Type | Description |
|---|---|---|
| $id | int | id of the relationship to delete |

mark_undeleted(
$id
)
:
voidRestores data deleted by call to mark_deleted() function.
Inherited from: \SugarBean::mark_undeleted()Internal function, do not override.
| Name | Type | Description |
|---|---|---|
| $id |

moveEmails(
string $fromIe, string $fromFolder, string $toIe, string $toFolder, string $uids, bool $copy
=
false
)
:
boolmoves emails from folder to folder
| 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 |
| Type | Description |
|---|---|
| bool | True on successful execution |

parseDateDefault(
string $value, bool $time
=
false
)
:
stringCreate date string from default value like '+1 month'
Inherited from: \SugarBean::parseDateDefault()| Name | Type | Description |
|---|---|---|
| $value | string | |
| $time | bool | Should be expect time set too? |
| Type | Description |
|---|---|
| string |

parse_additional_headers(
$list_form, $xTemplateSection
)
:
void| Name | Type | Description |
|---|---|---|
| $list_form | ||
| $xTemplateSection |

pop3_checkPartialEmail(
$synch
=
false
)
:
voidSpecial 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
| Name | Type | Description |
|---|---|---|
| $synch |

pop3_getCacheUidls(
)
:
arrayretrieves cached uidl values.
When dealing with POP3 accounts, the message_id column in email_cache will contain the UIDL.
| Type | Description |
|---|---|
| array |

pop3_getUIDL(
)
:
arrayThis method returns all the UIDL for this account. This should be called if the protocol is pop3
| Type | Description |
|---|---|
| array | od messageno to UIDL array |

pop3_sendCommand(
string $command, string $args
=
'', bool $return
=
true
)
:
stringsends a command down to the POP3 server
| Name | Type | Description |
|---|---|---|
| $command | string | command |
| $args | string | args |
| $return | bool | return |
| Type | Description |
|---|---|
| string |

pop3_shiftCache(
array $diff, $cacheUIDLs
)
:
voidIterates through msgno and message_id to remove dirty cache entries
| Name | Type | Description |
|---|---|---|
| $diff | array | diff |
| $cacheUIDLs |

populateDefaultValues(
$force
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $force |

populateRelatedBean(
\SugarBean $newbean
)
:
voidCalled 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()| Name | Type | Description |
|---|---|---|
| $newbean | \SugarBean | newly created related bean |

preprocess_fields_on_save(
)
:
voidThis function processes the fields before save.
Inherited from: \SugarBean::preprocess_fields_on_save()Interal function, do not override.

process_detail_query(
string $query, int $row_offset, int $limit
=
-1, int $max_per_page
=
-1, string $where
=
'', int $offset
=
0
)
:
arrayApplies 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.
| 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 |
| Type | Description |
|---|---|
| array | Fetched data. |

process_full_list_query(
string $query, boolean $check_date
=
false
)
:
array
Internal function, do not override.
| Name | Type | Description |
|---|---|---|
| $query | string | query to be processed. |
| $check_date | boolean | Optional, default false. if set to true date time values are processed. |
| Type | Description |
|---|---|
| array | Fetched data. |

process_list_query(
string $query, int $row_offset, int $limit
=
-1, int $max_per_page
=
-1, string $where
=
''
)
:
arrayProcesses the list query and return fetched row.
Inherited from: \SugarBean::process_list_query()Internal function, do not override.
| 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. |
| Type | Description |
|---|---|
| array | Fetched data |

process_order_by(
string $order_by, \SugarBean $submodule
=
null
)
:
stringPrefixes column names with this bean's table name.
Inherited from: \SugarBean::process_order_by()| Name | Type | Description |
|---|---|---|
| $order_by | string | Order by clause to be processed |
| $submodule | \SugarBean | name of the module this order by clause is for |
| Type | Description |
|---|---|
| string | Processed order by clause Internal function, do not override. |

process_special_fields(
)
:
voidThis 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()
process_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()
)
:
arrayApplies 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.
| 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 |
| Type | Description |
|---|---|
| array | Fetched data. |

removeRelationshipMeta(
string $key, string $db, string $tablename, string $dictionary, string $module_dir
)
:
\Nothing
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.
| 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. |
| Type | Description |
|---|---|
| \Nothing |
- Static
- Internal function, do not override.

remove_relationship_meta(
$key, $db, $log, $tablename, $dictionary, $module_dir
)
:
void
| Name | Type | Description |
|---|---|---|
| $key | ||
| $db | ||
| $log | ||
| $tablename | ||
| $dictionary | ||
| $module_dir |
- See
- \removeRelationshipMeta()
- Static

renameFolder(
$oldName, string $newName
)
:
voidRenames an IMAP mailbox
| Name | Type | Description |
|---|---|---|
| $oldName | ||
| $newName | string |

repairAccount(
)
:
boolrepairs the encrypted password for a given I-E account
| Type | Description |
|---|---|
| bool | True on success |

retrieve(
string $id, $encode
=
true, $deleted
=
true
)
:
objectretrieves 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.
| Name | Type | Description |
|---|---|---|
| $id | string | id |
| $encode | ||
| $deleted |
| Type | Description |
|---|---|
| object | Bean |

retrieveAllByGroupId(
$id, $includePersonal
=
true
)
:
voidRetrieves an array of I-E beans that the user has team access to
| Name | Type | Description |
|---|---|---|
| $id | ||
| $includePersonal |

retrieveAllByGroupIdWithGroupAccounts(
$id, $includePersonal
=
true
)
:
voidRetrieves an array of I-E beans that the user has team access to including group
| Name | Type | Description |
|---|---|---|
| $id | ||
| $includePersonal |

retrieveAttachmentNameFromStructure(
object $part
)
:
stringReturn the filename of the attachment by examining the dparameters or parameters returned from imap_fetch_structure
| Name | Type | Description |
|---|---|---|
| $part | object |
| Type | Description |
|---|---|
| string |

retrieveByGroupFolderId(
string $groupFolderId
)
:
arraybooleanretrieves an array of I-E beans based on the group folder id
| Name | Type | Description |
|---|---|---|
| $groupFolderId | string | GUID of the group folder |
| Type | Description |
|---|---|
| arrayboolean | $beans array of beansfalse if none returned |

retrieveByGroupId(
string $groupId
)
:
arraybooleanretrieves an array of I-E beans based on the group_id
| Name | Type | Description |
|---|---|---|
| $groupId | string | GUID of the group user or Individual |
| Type | Description |
|---|---|
| arrayboolean | $beans array of beansfalse if none returned |

retrieve_by_string_fields(
array $fields_array, boolean $encode
=
true
)
:
objectConstructs 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.
| 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. |
| Type | Description |
|---|---|
| object | Instance of this bean with fetched data. |

retrieve_parent_fields(
array $type_info
)
:
voidReturns parent record data for objects that store relationship information
Inherited from: \SugarBean::retrieve_parent_fields()| Name | Type | Description |
|---|---|---|
| $type_info | array | Interal function, do not override. |

retrieve_relationships(
$table, $values, $select_id
)
:
void| Name | Type | Description |
|---|---|---|
| $table | ||
| $values | ||
| $select_id |

save(
string $check_notify
=
false
)
:
voidwraps 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.
| Name | Type | Description |
|---|---|---|
| $check_notify | string | ID of saved bean |

saveAttachmentBinaries(
object $attach, string $msgNo, string $thisBc, object $part, bool $forDisplay
)
:
voidsaves the actual binary file of a given attachment
| 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 |

saveAttachments(
int $msgNo, object $parts, string $emailId, array $breadcrumb
=
'0', bool $forDisplay
)
:
voidTakes 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"
| 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 |

saveInboundEmailSystemSettings(
string $type, string $macro
)
:
voidsaves InboundEmail parse macros to config.php
| Name | Type | Description |
|---|---|---|
| $type | string | type Bean to link |
| $macro | string | macro The new macro |

saveNewFolder(
string $name, string $mbox
)
:
boolSaves new folders
| Name | Type | Description |
|---|---|---|
| $name | string | Name of new IMAP mailbox |
| $mbox | string | "::" delimited IMAP mailbox path, ie, INBOX.saved.stuff |
| Type | Description |
|---|---|
| bool | True on success |

savePersonalEmailAccount(
string $userId
=
'', \strings $userName
=
'', bool $forceSave
=
true
)
:
booleanSaves Personal Inbox settings for Users
| 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. |
| Type | Description |
|---|---|
| boolean | true on success, false on fail |

save_relationship_changes(
\$is_update $is_update, $exclude
=
array()
)
:
voidThis function is a good location to save changes that have been made to a relationship.
Inherited from: \SugarBean::save_relationship_changes()This should be overriden in subclasses that have something to save.
| Name | Type | Description |
|---|---|---|
| $is_update | \$is_update | true if this save is an update. |
| $exclude |

search(
$ieId, $subject
=
'', $from
=
'', $to
=
'', $body
=
'', $dateFrom
=
'', $dateTo
=
''
)
:
voidSearches IMAP (and POP3?) accounts/folders for emails with qualifying criteria
| Name | Type | Description |
|---|---|---|
| $ieId | ||
| $subject | ||
| $from | ||
| $to | ||
| $body | ||
| $dateFrom | ||
| $dateTo |

send_assignment_notifications(
string $notify_user, string $admin
)
:
voidHandles sending out email notifications when items are first assigned to users
Inherited from: \SugarBean::send_assignment_notifications()| Name | Type | Description |
|---|---|---|
| $notify_user | string | user to notify |
| $admin | string | the admin user that sends out the notification |

setAutoreplyStatus(
string $addr
)
:
voidsets a timestamp for an autoreply to a single email addy
| Name | Type | Description |
|---|---|---|
| $addr | string | addr Address of auto-replied target |

setCacheTimestamp(
string $mbox
)
:
voidsets the cache timestamp
| Name | Type | Description |
|---|---|---|
| $mbox | string | mbox |

setCacheValue(
$mbox, $insert, $update
=
array(), $remove
=
array()
)
:
voidSets cache values
| Name | Type | Description |
|---|---|---|
| $mbox | ||
| $insert | ||
| $update | ||
| $remove |

setEmailForDisplay(
int $uid, bool $isMsgNo
=
false, bool $setRead
=
false, bool $forceRefresh
=
false
)
:
stringfills InboundEmail->email with an email's details
| 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 |
| Type | Description |
|---|---|
| string |

setSessionConnectionString(
$server_url, $email_user, $port, $protocol, $goodStr
)
:
void| Name | Type | Description |
|---|---|---|
| $server_url | ||
| $email_user | ||
| $port | ||
| $protocol | ||
| $goodStr |

setSessionInboundDelimiterString(
$server_url, $email_user, $port, $protocol, $delimiter
)
:
void| Name | Type | Description |
|---|---|---|
| $server_url | ||
| $email_user | ||
| $port | ||
| $protocol | ||
| $delimiter |

setSessionInboundFoldersString(
$server_url, $email_user, $port, $protocol, $foldersList
)
:
void| Name | Type | Description |
|---|---|---|
| $server_url | ||
| $email_user | ||
| $port | ||
| $protocol | ||
| $foldersList |

setStatuses(
$uid, $field, $value
)
:
voidSets status for a particular attribute on the mailserver and the local cache file
| Name | Type | Description |
|---|---|---|
| $uid | ||
| $field | ||
| $value |

setUsersDefaultOutboundServerId(
\User $user, $oe_id
)
:
voidGet the users default IE account id
| Name | Type | Description |
|---|---|---|
| $user | \User | |
| $oe_id |

set_relationship(
$table, $relate_values, $check_duplicates
=
true, $do_update
=
false, $data_values
=
null
)
:
void| Name | Type | Description |
|---|---|---|
| $table | ||
| $relate_values | ||
| $check_duplicates | ||
| $do_update | ||
| $data_values |

setupCustomFields(
string $module_name, boolean $clean_load
=
true
)
:
voidLoads the definition of custom fields defined for the module.
Inherited from: \SugarBean::setupCustomFields()Local file system cache is created as needed.
| 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. |

sortFetchedOverview(
array $arr, string $sort
=
4, string $direction
=
'DESC', $forceSeen
=
false
)
:
arraySorts IMAP's imap_fetch_overview() results
| 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 |
| Type | Description |
|---|---|
| array | Sorted array of obj. |

sortMailboxes(
$mbox, array $ret, $delimeter
=
"."
)
:
arraysorts the folders in a mailbox in a multi-dimensional array
| Name | Type | Description |
|---|---|---|
| $mbox | ||
| $ret | array | |
| $delimeter |
| Type | Description |
|---|---|
| array |

toArray(
$dbOnly
=
false, $stringOnly
=
false, $upperKeys
=
false
)
:
array
| Name | Type | Description |
|---|---|---|
| $dbOnly | ||
| $stringOnly | ||
| $upperKeys |
| Type | Description |
|---|---|
| array | of fields with id, name, access and category |

track_view(
string $user_id, string $current_module, string $current_view
=
''
)
:
void
This leverages get_summary_text() which is object specific.
Internal function, do not override.
| Name | Type | Description |
|---|---|---|
| $user_id | string |
|
| $current_module | string |
|
| $current_view | string |
|

unPopulateDefaultValues(
)
:
voidBasically undoes the effects of SugarBean::populateDefaultValues(); this method is best called right after object initialization.
Inherited from: \SugarBean::unPopulateDefaultValues()
unformat_all_fields(
)
:
voidRemoves 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.

updateOverviewCacheFile(
array $array, string $type
=
'append', string $mailbox
=
''
)
:
voidmerges new info with the saved cached file
| Name | Type | Description |
|---|---|---|
| $array | array | Array of email Overviews |
| $type | string | 'append' or 'remove' |
| $mailbox | string | Target mailbox if not current assigned |
\Overview
Simple class to mirror the passed object from an imap_fetch_overview() call