modules/SNIP/SugarSNIP.php
\SugarSNIP
SNIP data handling implementation
Constants
Properties
Methods

assignUser(
\Email $email, string $username
=
null
)
:
voidAssign the email to proper user
| Name | Type | Description |
|---|---|---|
| $username | string |

assignUserTeam(
\SugarBean $email, string $userid
)
:
voidAssign 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
)
:
boolGeneric 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
)
:
voidCreate a new Note object
| Name | Type | Description |
|---|---|---|
| $data | array | Note data |
parent email |

createObject(
\Email $email
)
:
voidCreate 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
)
:
stringGenerate the url that the user can visit to purchase SNIP.
| Name | Type | Description |
|---|---|---|
| $snipuser |
| Type | Description |
|---|---|
| string | the generated url |

createSnipToken(
\User $user
)
:
voidCreate oauth token for the SNIP user
| Name | Type | Description |
|---|---|---|
| $user | \User |

deleteSnipTokens(
\User $user
)
:
voidCreate oauth token for the SNIP user
| Name | Type | Description |
|---|---|---|
| $user | \User |

getInstance(
)
:
\SugarSNIPGet instance of the SNIP client
| Type | Description |
|---|---|
| \SugarSNIP | SNIP client instance |

getStatus(
)
:
arrayGet 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
)
:
voidImports an email from the SNIP serice
| Name | Type | Description |
|---|---|---|
| array |

processEmailAttachment(
$data, $email
)
:
voidSave a snip email attachment and associated it to a parent email. Content is base64 encoded.
| Name | Type | Description |
|---|---|---|
| $data | ||

registerSnip(
)
:
mixedRegister this instance with SNIP server
| Type | Description |
|---|---|
| mixed | server response |

relateRecords(
\Email $e
)
:
voidRelate records to this email
| Name | Type | Description |
|---|---|---|
| $e |

setClient(
\SugarHttpClient $client
)
:
voidSet client to talk to SNIP
| Name | Type | Description |
|---|---|---|
| $client | \SugarHttpClient |

setSnipEmail(
string $email
)
:
voidSet SNIP email address
| Name | Type | Description |
|---|---|---|
| string |

splitEmailAddress(
\Email $email, string $addr
)
:
arraySplit email address into name & address part
| Name | Type | Description |
|---|---|---|
| $addr | string |
| Type | Description |
|---|---|
| array |