Results 1 to 9 of 9

Thread: Modifying VardDefs & It's Not Working LOL

  1. #1
    banning's Avatar
    banning is offline Sugar Community Member
    Join Date
    Jul 2010
    Location
    Kansas
    Posts
    73

    Exclamation Modifying VardDefs & It's Not Working LOL

    i've got this code

    Code:
      'TOTAL_DAYS_OPEN_C' => 
      array (
        'default' => true,
        'label' => 'LBL_TOTAL_DAYS_OPEN ',
        'width' => '10%',
    	'link' => true,
    	'customCode' => show_id('{$ID}'),
      ),
    in my listviewdefs.php
    you can see in my customCode section i'm calling a function and passing the ID through... and its coming out PERFECT... just one problem

    when it comes out its not coming out as a string, i guess. i used php's function gettype and php says its a string but when i use strtoupper it wont uppercase the text... OR if i md5 it all the id's come out encrypted the same. It's driving me up a wall.

    can anyone help?

  2. #2
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: Modifying VardDefs & It's Not Working LOL

    It will be determined by what is returned by your show_id() function, so you'll need to make sure it is returning proper type. If you're not sure, post the function definition.

    Phil

  3. #3
    banning's Avatar
    banning is offline Sugar Community Member
    Join Date
    Jul 2010
    Location
    Kansas
    Posts
    73

    Default Re: Modifying VardDefs & It's Not Working LOL

    Here is the function code itself

    Code:
    function show_id($id){
    	$db = DBManagerFactory::getInstance();
    	
    	$sql = 'SELECT * FROM opportunities WHERE id="'.$id.'"';
    	$query = $db->query($sql);
    	
    	$row = $db->fetchByAssoc($query);
    	$date_entered = $row['date_entered'];
    	
    	return $id;
    }
    Hope this is able to help you guys help me... it would be awesome if i could figure this out.

    Thanks!

  4. #4
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: Modifying VardDefs & It's Not Working LOL

    I don't see anything unusual. A GUID is a string (see php function com_create_guid()), so that shouldn't cause any trouble. You're not modifying the ID in the function, but simply returning the original variable, so it shouldn't change type.

    What is the context for calling the md5 or strtoupper functions where you see the problem? Is it within the function? Within the custom code? Somewhere else?

    Phil

  5. #5
    banning's Avatar
    banning is offline Sugar Community Member
    Join Date
    Jul 2010
    Location
    Kansas
    Posts
    73

    Default Re: Modifying VardDefs & It's Not Working LOL

    i passed the $ID though md5 and strtoupper to see what would happen... and no matter what value $ID was when i would pass it through an md5 encryption it would always come out the same. 2 different ID's coming out the same lol

    as for the strtoupper i just was trying some more testing since the ID's have char in them... and when i sent the $ID through strtoupper non of the char were in uppercase everything stayed lower case.

    I'm so puzzled because php say's its a string yet it wont do anything with it. However I am having ANOTHER problem right now to and its involving sugars cache... i'm trying to clear it but its not working i'll be making a post shortly on that matter though.

  6. #6
    banning's Avatar
    banning is offline Sugar Community Member
    Join Date
    Jul 2010
    Location
    Kansas
    Posts
    73

    Default Re: Modifying VardDefs & It's Not Working LOL

    Sorry Phil i miss read your question. I use md5 and strtoupper here...

    Code:
    function show_id($id){
    	$db = DBManagerFactory::getInstance();
    	
    	$sql = 'SELECT * FROM opportunities WHERE id="'.$id.'"';
    	$query = $db->query($sql);
    	
    	$row = $db->fetchByAssoc($query);
    	$date_entered = $row['date_entered'];
    	
    	return md5($id);
            -or-
    	return strtoupper($id);
    }

  7. #7
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: Modifying VardDefs & It's Not Working LOL

    That doesn't make sense, so I suspect something at a higher level.

    Have you verified that the ID is properly passed into the function by any means other than what you see in the Sugar List? I'd probably put in some fprintf calls to write the id value to a log file within the function and do more printf's on md5 and strtoupper calls for that id all within the function.

    Then you'll see exactly what value is getting passed in and whether it matches what you see on the screen. You'll also see whether the strtoupper and md5 calls work properly for each string (again within the function). And you'll see each time the function gets called.

    Comparing the log output to the screen output may give you some good clues what's going on.

    Phil

  8. #8
    banning's Avatar
    banning is offline Sugar Community Member
    Join Date
    Jul 2010
    Location
    Kansas
    Posts
    73

    Default Re: Modifying VardDefs & It's Not Working LOL

    so i find myself having this problem again... in listviewdefs.php

    PHP Code:
        'customCode' => getRelatedJob('{$ID}'), 
    PHP Code:
    function getRelatedJob($id){
        global 
    $db;
        global 
    $sugar_config;
        
        
    $sql 'SELECT o.id, o.name FROM ab12_companpportunities_c po, opportunities o WHERE o.id = po.ab12_compaed91unities_idb AND po.ab12_compa9de1nvoices_ida = "'.$id.'"';
        
    $query $db->query($sql);
        
    $row $db->fetchByAssoc($query);
        
        
    $return '<a href="index.php?module=Opportunities&action=DetailView&record='.$row['id'].'">'.$row['name'].'</a>';
        
        return 
    $return;
    }; 
    its like whenever i run the query it does not see the ID... now i can echo out the ID and it looks fine... and is_string returns true... but if i try to manipulate ID in any way like explode() it doesn't work.
    --
    -Banning Stuckey
    http://www.iambanning.com
    Web 2.0 New Media Developer][Designer

  9. #9
    banning's Avatar
    banning is offline Sugar Community Member
    Join Date
    Jul 2010
    Location
    Kansas
    Posts
    73

    Default Re: Modifying VardDefs & It's Not Working LOL

    Well i still don't know what the issue was but i found a solution here http://www.sugarcrm.com/forums/f3/lo...-record-50426/

    i just exposed the process_record logic hook and then applied what i wanted to the bean i was trying to effect.
    --
    -Banning Stuckey
    http://www.iambanning.com
    Web 2.0 New Media Developer][Designer

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Modifying additionalDetails.php
    By SilenceIT in forum Developer Help
    Replies: 0
    Last Post: 2009-07-28, 06:18 PM
  2. Help! Modifying relationships
    By StRos in forum Developer Help
    Replies: 1
    Last Post: 2009-04-09, 01:44 AM
  3. Modifying Employees
    By neusagudo in forum Help
    Replies: 1
    Last Post: 2007-06-30, 05:59 PM
  4. modifying php.ini
    By Karol in forum Help
    Replies: 1
    Last Post: 2006-10-15, 10:07 PM
  5. Modifying Calendar
    By kevind in forum Developer Help
    Replies: 0
    Last Post: 2005-01-13, 10:20 AM

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
  •