modules/SNIP/SugarSNIP.php
\SugarSNIP
SNIP data handling implementation
Constants
Properties
Methods
assignUser(
\Email $email, string $username
=
null
)
:
void
Assign the email to proper user
Name | Type | Description |
---|---|---|
$username | string |
assignUserTeam(
\SugarBean $email, string $userid
)
:
void
Assign user's private team to an email
Name | Type | Description |
---|---|---|
\SugarBean | Email object |
|
$userid | string | User ID |
callRest(
string $name, string $params
=
array(), bool $json
=
false, $connectionfailed
=
false
)
:
bool
Generic REST call to SNIP instance
Name | Type | Description |
---|---|---|
$name | string | function to call |
$params | string | parameters |
$json | bool | encode params as JSON in data var or send as query? |
$connectionfailed |
Type | Description |
---|---|
bool | Success? |
createNote(
array $data, \Email $email
)
:
void
Create a new Note object
Name | Type | Description |
---|---|---|
$data | array | Note data |
parent email |
createObject(
\Email $email
)
:
void
Create objects from createdef definitions
Example definition:
$createdef['email@host.com']['Contacts'] = array(
'fields' => array(
'email1' => '{from_addr}',
'last_name' => '{from_name}',
'description' => 'created from {subject}',
'lead_source' => 'Email',
),
);
Supported variables:
- from
- from_addr
- from_name
- subject
- date
- description
- description_html
- message_id
- email_id
Name | Type | Description |
---|---|---|
createPurchaseURL(
$snipuser
)
:
string
Generate the url that the user can visit to purchase SNIP.
Name | Type | Description |
---|---|---|
$snipuser |
Type | Description |
---|---|
string | the generated url |
createSnipToken(
\User $user
)
:
void
Create oauth token for the SNIP user
Name | Type | Description |
---|---|---|
$user | \User |
deleteSnipTokens(
\User $user
)
:
void
Create oauth token for the SNIP user
Name | Type | Description |
---|---|---|
$user | \User |
getInstance(
)
:
\SugarSNIP
Get instance of the SNIP client
Type | Description |
---|---|
\SugarSNIP | SNIP client instance |
getStatus(
)
:
array
Get status of the SNIP installation
Type | Description |
---|---|
array | Returns an associative array ('status'=>string, 'message'=>string|null), with 'status' as one of the following: - purchased (instance has snip license) - notpurchased (instance does not have snip license) - down (snip server unresponsive) - purchased_error (instance has snip license, server is not down, but server detects something is wrong). Iff 'status' is 'purchased_error', 'message' will be the error returned by the server. Otherwise $message will be NULL. |
importEmail(
array $email
)
:
void
Imports an email from the SNIP serice
Name | Type | Description |
---|---|---|
array |
processEmailAttachment(
$data, $email
)
:
void
Save a snip email attachment and associated it to a parent email. Content is base64 encoded.
Name | Type | Description |
---|---|---|
$data | ||
registerSnip(
)
:
mixed
Register this instance with SNIP server
Type | Description |
---|---|
mixed | server response |
relateRecords(
\Email $e
)
:
void
Relate records to this email
Name | Type | Description |
---|---|---|
$e |
setClient(
\SugarHttpClient $client
)
:
void
Set client to talk to SNIP
Name | Type | Description |
---|---|---|
$client | \SugarHttpClient |
setSnipEmail(
string $email
)
:
void
Set SNIP email address
Name | Type | Description |
---|---|---|
string |
splitEmailAddress(
\Email $email, string $addr
)
:
array
Split email address into name & address part
Name | Type | Description |
---|---|---|
$addr | string |
Type | Description |
---|---|
array |