-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from MichaelJ2324/2.0
SUPP-1255, SUPP-1256
- Loading branch information
Showing
74 changed files
with
766 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,33 @@ | ||
<?php | ||
/** | ||
* ©[2019] SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license. | ||
*/ | ||
|
||
require_once 'include.php'; | ||
|
||
$SugarAPI = new \Sugarcrm\REST\Client\Sugar7API($server,$credentials); | ||
try{ | ||
$SugarAPI->login(); | ||
echo "Logged In: <pre>"; | ||
print_r($SugarAPI->getAuth()->getToken()->access_token); | ||
echo "</pre>"; | ||
$Account = $SugarAPI->module('Accounts')->set("name","Audit Log Test"); | ||
$Account->save(); | ||
echo "<pre>Created Account: {$Account['id']}</pre><br>"; | ||
$Account->set('phone_office','555-555-5555'); | ||
$Account['name'] = 'Audit Log Test - Updated'; | ||
$Account['assigned_user_id'] = 'seed_max_id'; | ||
$Account->save(); | ||
echo "<pre> Account Updated: <br>".print_r($Account->asArray(),true)."</pre><br>"; | ||
$Account->audit(); | ||
echo "<pre> Audit Log:".print_r($Account->getResponse()->getBody(),true)."</pre><br>"; | ||
if ($SugarAPI->login()){ | ||
echo "Logged In: "; | ||
pre($SugarAPI->getAuth()->getToken()); | ||
$Account = $SugarAPI->module('Accounts')->set("name","Audit Log Test"); | ||
$Account->save(); | ||
pre("Created Account: {$Account['id']}"); | ||
$Account->set('phone_office','555-555-5555'); | ||
$Account['name'] = 'Audit Log Test - Updated'; | ||
$Account['assigned_user_id'] = 'seed_max_id'; | ||
$Account->save(); | ||
echo "Account Updated:"; | ||
pre($Account->asArray()); | ||
$Account->audit(); | ||
echo "Audit Log: "; | ||
pre($Account->getResponse()->getBody()); | ||
} else { | ||
echo "Could not login."; | ||
pre($SugarAPI->getAuth()->getActionEndpoint('authenticate')->getResponse()); | ||
} | ||
}catch (Exception $ex){ | ||
echo "<pre>"; | ||
//print_r($SugarAPI); | ||
echo "</pre>"; | ||
print $ex->getMessage(); | ||
echo "Error Occurred: "; | ||
pre($ex->getMessage()); | ||
pre($ex->getTraceAsString()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,39 @@ | ||
<?php | ||
/** | ||
* ©[2019] SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license. | ||
*/ | ||
|
||
require_once 'include.php'; | ||
|
||
$SugarAPI = new \Sugarcrm\REST\Client\Sugar7API($server,$credentials); | ||
try{ | ||
$SugarAPI->login(); | ||
echo "<pre>"; | ||
print_r($SugarAPI->getAuth()->getToken()->access_token); | ||
echo "</pre>"; | ||
$Account = $SugarAPI->module('Accounts')->set("name","Test")->set("phone_office","555-555-5555"); | ||
echo "<pre> Account:".print_r($Account->asArray(),true)."</pre><br>"; | ||
$Account->save(); | ||
echo "<pre> Saved Account ID: {$Account['id']}</pre><br>"; | ||
$Account->set('employees','100'); | ||
$Account['shipping_address_city'] = 'Indianapolis'; | ||
$Account->save(); | ||
echo "<pre> Account Updated: <br>".print_r($Account->asArray(),true)."</pre>"; | ||
$Account2 = $SugarAPI->module('Accounts',$Account['id']); | ||
$Account2->retrieve(); | ||
echo "<pre> Account2:".print_r($Account2->asArray(),true)."</pre><br>"; | ||
$Account2->delete(); | ||
echo "Account Deleted. <br><pre>".print_r($Account2->getResponse(),true)."</pre>"; | ||
if ($SugarAPI->login()){ | ||
echo "Logged In: "; | ||
pre($SugarAPI->getAuth()->getToken()); | ||
$Account = $SugarAPI->module('Accounts')->set("name","Test")->set("phone_office","555-555-5555"); | ||
echo "Creating Account: "; | ||
pre($Account->asArray()); | ||
$Account->save(); | ||
pre("Saved Account ID: {$Account['id']}"); | ||
$Account->set('employees','100'); | ||
$Account['shipping_address_city'] = 'Indianapolis'; | ||
echo "Changing fields employees and shipping address...<br>"; | ||
$Account->save(); | ||
echo "Account Updated: "; | ||
pre($Account->asArray()); | ||
$Account2 = $SugarAPI->module('Accounts',$Account['id']); | ||
$Account2->retrieve(); | ||
echo "Retrieving the Account Again...<br>"; | ||
pre($Account2->asArray()); | ||
$Account2->delete(); | ||
echo "Account Deleted. Response: "; | ||
pre($Account2->getResponse()); | ||
} else { | ||
echo "Could not login."; | ||
pre($SugarAPI->getAuth()->getActionEndpoint('authenticate')->getResponse()); | ||
} | ||
}catch (Exception $ex){ | ||
echo "<pre>"; | ||
//print_r($SugarAPI); | ||
echo "</pre>"; | ||
print $ex->getMessage(); | ||
echo "Error Occurred: "; | ||
pre($ex->getMessage()); | ||
pre($ex->getTraceAsString()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* ©[2019] SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license. | ||
*/ | ||
|
||
require_once 'include.php'; | ||
|
||
$SugarAPI = new \Sugarcrm\REST\Client\Sugar7API($server,$credentials); | ||
|
||
try{ | ||
if ($SugarAPI->login()){ | ||
echo "Logged In: "; | ||
pre($SugarAPI->getAuth()->getToken()); | ||
$Account = $SugarAPI->module('Accounts')->set("name","DuplicateCheck Test"); | ||
$Account->save(); | ||
pre("Account Created: {$Account['id']}"); | ||
$a = $Account->asArray(); | ||
unset($a['id']); | ||
echo "Running duplicateCheck for Account: "; | ||
pre($a); | ||
$Account->duplicateCheck(); | ||
pre($Account->getResponse()->getBody()); | ||
} else { | ||
echo "Could not login."; | ||
pre($SugarAPI->getAuth()->getActionEndpoint('authenticate')->getResponse()); | ||
} | ||
}catch (Exception $ex){ | ||
echo "Error Occurred: "; | ||
pre($ex->getMessage()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
<?php | ||
/** | ||
* ©[2019] SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license. | ||
*/ | ||
|
||
require_once 'include.php'; | ||
|
||
$SugarAPI = new \Sugarcrm\REST\Client\Sugar7API($server,$credentials); | ||
|
||
try{ | ||
$SugarAPI->login(); | ||
echo "Logged In: <pre>"; | ||
print_r($SugarAPI->getAuth()->getToken()->access_token); | ||
echo "</pre>"; | ||
$Account = $SugarAPI->module('Accounts')->set("name","Favorite Test"); | ||
$Account->save(); | ||
echo "<pre> Account Created: {$Account['id']}</pre><br>"; | ||
$Account->favorite(); | ||
echo "<pre> Account added to Favorites: <br>".print_r($Account,true)."</pre>"; | ||
if ($SugarAPI->login()){ | ||
echo "Logged In: <pre>"; | ||
print_r($SugarAPI->getAuth()->getToken()->access_token); | ||
echo "</pre>"; | ||
$Account = $SugarAPI->module('Accounts')->set("name","Favorite Test"); | ||
$Account->save(); | ||
echo "<pre> Account Created: {$Account['id']}</pre><br>"; | ||
$Account->favorite(); | ||
echo "<pre> Account added to Favorites: <br>".print_r($Account,true)."</pre>"; | ||
} else { | ||
echo "Could not login."; | ||
pre($SugarAPI->getAuth()->getActionEndpoint('authenticate')->getResponse()); | ||
} | ||
}catch (Exception $ex){ | ||
echo "<pre>"; | ||
//print_r($SugarAPI); | ||
echo "</pre>"; | ||
print $ex->getMessage(); | ||
echo "Error Occurred: "; | ||
pre($ex->getMessage()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
<?php | ||
/** | ||
* ©[2017] SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license. | ||
* ©[2019] SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license. | ||
*/ | ||
|
||
require_once 'include.php'; | ||
|
||
$SugarAPI = new \Sugarcrm\REST\Client\Sugar7API($server,$credentials); | ||
try{ | ||
$SugarAPI->login(); | ||
echo "<pre>"; | ||
print_r($SugarAPI->getAuth()->getToken()->access_token); | ||
echo "</pre>"; | ||
$Accounts = $SugarAPI->list('Accounts'); | ||
$Accounts->fetch(); | ||
$Account = $Accounts->at(1); | ||
$Account->getRelated('contacts',true); | ||
echo $Account->getRequest()->getURL()."<br>"; | ||
echo "<pre> Response:".print_r($Account->getResponse()->getBody(),true)."</pre><br>"; | ||
$Filter = $Account->filterRelated('contacts')->contains('first_name','s'); | ||
echo "<pre> Filter Contacts related to Account {$account['id']} where first_name contains an 's': ".print_r($Filter->compile(),true)."</pre><br>"; | ||
$Filter->execute(); | ||
echo "<pre> Response:".print_r($Account->getResponse()->getBody(),true)."</pre><br>"; | ||
if ($SugarAPI->login()){ | ||
echo "<pre>"; | ||
print_r($SugarAPI->getAuth()->getToken()->access_token); | ||
echo "</pre>"; | ||
$Accounts = $SugarAPI->list('Accounts'); | ||
$Accounts->fetch(); | ||
$Account = $Accounts->at(1); | ||
$Account->getRelated('contacts',true); | ||
echo $Account->getRequest()->getURL()."<br>"; | ||
echo "<pre> Response:".print_r($Account->getResponse()->getBody(),true)."</pre><br>"; | ||
$Filter = $Account->filterRelated('contacts')->contains('first_name','s'); | ||
echo "<pre> Filter Contacts related to Account {$account['id']} where first_name contains an 's': ".print_r($Filter->compile(),true)."</pre><br>"; | ||
$Filter->execute(); | ||
echo "<pre> Response:".print_r($Account->getResponse()->getBody(),true)."</pre><br>"; | ||
} else { | ||
echo "Could not login."; | ||
pre($SugarAPI->getAuth()->getActionEndpoint('authenticate')->getResponse()); | ||
} | ||
}catch (Exception $ex){ | ||
echo "<pre>"; | ||
//print_r($SugarAPI); | ||
echo "</pre>"; | ||
print $ex->getMessage(); | ||
echo "Error Occurred: "; | ||
pre($ex->getMessage()); | ||
} |
Oops, something went wrong.