Advertisement
Guest User

Untitled

a guest
May 13th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. function sugar_initialize(){
  2.  
  3. # get variable settings that are entered using the form defined in the file sugarcrm_bridge.admin.inc
  4. $url = variable_get('sugar_test_url', '');
  5. $username = variable_get('sugar_username', '');
  6. $password = variable_get('sugar_password', '');
  7.  
  8. # we default to the test URL, but if the environment is prod, then sugar prod is selected
  9. if(isset($_SERVER['SGK_ENVIRONMENT']) && $_SERVER['SGK_ENVIRONMENT'] == 'prod'){
  10. $url = variable_get('sugar_url', '');
  11. }
  12.  
  13. #include the Spinegar wrapper class
  14. require_once libraries_get_path('sugarcrm7-api-wrapper-class') . '/vendor/autoload.php';
  15.  
  16. $sugar = new \Spinegar\Sugar7Wrapper\Rest();
  17. $sugar->setUrl($url)
  18. ->setUsername($username)
  19. ->setPassword($password)
  20. ->connect();
  21.  
  22. return $sugar;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement