Results 1 to 5 of 5

Thread: Sending to PHP page

  1. #1
    inv
    inv is offline Junior Member
    Join Date
    Feb 2011
    Posts
    3

    Default Sending to PHP page

    Hello everybody,

    I'm using the free Sugar CRM and I would like to add some special functionalities.
    Therefore, I want to use an external module written in GWT.
    As input for this module, I need many parameters from Sugar (opportunity, current user ...). After having searched on the sugar sites, it seems to me that the only solution is to have a php script gathering every information I need and then call my external module.

    I plan to use the "url" field in the opportunity module to go on my php page. I already tried to add the following php page:

    Code:
    <html>
    
    <head>
    </head>
    
    <body>
    <?php
    
    global $current_user;
    echo $current_user->user_name;  
    
    ?>
    </body>
    </html>
    The link to this page works but the page doesn't display anything and it's source code is empty.

    Are there some steps I did forget ?
    Do you have any hints ?

    In the documentation I saw something about writing an action, do I have to do this ?

    Thank you for your help !
    Inv.

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Sending to PHP page

    Hi inv

    Where did you save this script? How are you calling it?

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    inv
    inv is offline Junior Member
    Join Date
    Feb 2011
    Posts
    3

    Default Re: Sending to PHP page

    Hello,

    First, thank you for your reply !

    I put my script at the root of the CRM application (same directory as the index.php).

    I called it with the url field of the opportunity. The url's value is: "localhost/CRM/test.php" (I access my suger with localhost/CRM/index.php).

    When I click on the url, my browser is going to my test page (the urlbar indicates the test.php file).

    Best regards,
    Inv.

  4. #4
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Sending to PHP page

    So you need to include the include/entryPoint.php. This script will load all SugarCRM environment in order to let you access all SugarCRM features, including $current_user, $db and so on.
    Take a look at cron.php for reference.

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  5. #5
    inv
    inv is offline Junior Member
    Join Date
    Feb 2011
    Posts
    3

    Default Re: Sending to PHP page

    Hello,

    Thank you very much andopes, I took example on the cron.php file and it works !

    Here is my simple php script:
    Code:
    <html>
    
    <head>
    </head>
    
    <body>
    
    <?php
    	if(!defined('sugarEntry'))define('sugarEntry', true);
    	require_once('include/entryPoint.php');
    	
    	global $current_user;
    	$current_user = new User();
    	$current_user->getSystemUser();
    	
    	$id = $current_user->id;
    	$team_id = $current_user->default_team;  
    
    	echo 'User name: '.$current_user->user_name.'<br/>';  
    	echo 'Team ID: '.$team_id.'<br/>';
    	echo 'Id: '.$id.'<br/>'; 
    	echo 'Last name: '.$current_user->last_name.'<br/>';
    ?>
    </body>
    
    </html>
    This is perfectly working.

    Best regards,
    Inv.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need to add button on detailed view page for sending mails
    By truptinijai in forum Developer Help
    Replies: 4
    Last Post: 2009-03-09, 12:11 PM
  2. Replies: 0
    Last Post: 2008-10-29, 12:35 PM
  3. Replies: 0
    Last Post: 2008-08-22, 07:05 PM
  4. Replies: 1
    Last Post: 2006-09-08, 07:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •