Results 1 to 7 of 7

Thread: How do i generate new project_id

  1. #1
    Chris1981 is offline Member
    Join Date
    Oct 2007
    Posts
    9

    Default How do i generate new project_id

    Hey All,

    I am trying to create a little system that automatically changes a Quote into a Project when its status is "Approved"

    The only bit i am stuck on is how the product_id gets generated... in my Save.php for the Quotes module i have started building the array of info that gets passed from the Quotes table into the Projects table but im stuck on the damn project_id.

    Is there a function that makes a correctly formatted id that i could call?

    Any input would be greatly appreciated.

    Cheers peoples

  2. #2
    kuske's Avatar
    kuske is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    2,597

    Default Re: How do i generate new project_id

    In inlude/utils.php you find the function needed:

    /**
    * A temporary method of generating GUIDs of the correct format for our DB.
    * @return String contianing a GUID in the format: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
    *
    * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
    * All Rights Reserved.
    * Contributor(s): ______________________________________..
    */
    function create_guid()

    It returns a unique ID which can be used for every object.

  3. #3
    GameboyRMH is offline Sugar Community Member
    Join Date
    Nov 2007
    Posts
    70

    Default Re: How do i generate new project_id

    Just thought I'd mention that Studio doesn't allow you to create a field with a name containing "project_id" (and a few others) and if you try this it won't save. Chances are there's a real problem with using such names so if you manually created one with "project_id" in the name, that might cause a problem.
    Server: Fedora
    Sugar 5 CE
    Apache 2.2.6
    MySQL 5.0.27

  4. #4
    Chris1981 is offline Member
    Join Date
    Oct 2007
    Posts
    9

    Default Re: How do i generate new project_id

    How does the project_id get generated when you enter a brand new project ... i could just copy that process?

  5. #5
    dtokeefe's Avatar
    dtokeefe is offline Sugar Community Member
    Join Date
    Mar 2005
    Location
    Sao Paulo, Brasil
    Posts
    671

    Default Re: How do i generate new project_id

    include/utils.php

    function create_guid()
    David O'Keefe
    Lampada Global Services
    SugarCRM Gold Partner
    USA: +1 908 998-2278
    BR: +55 11 3237-3110
    Skype: dtokeefe
    Email: equipe@lampadaglobal.com
    www.lampadaglobal.com

    Lampada Global delivers enterprise software and offshore programming services to customers around the world.

  6. #6
    Chris1981 is offline Member
    Join Date
    Oct 2007
    Posts
    9

    Default Re: How do i generate new project_id

    Hey .. Thanks for that.

    I gave it a quick go using just a test script as follows

    PHP Code:
    <?php
      
    require_once('include/utils.php');

      
    $Test create_guid();

      echo 
    $Test;
    ?>
    and i got an error message on the screen saying

    Not A Valid Entry Point

    Is there a way i can get past this, or do i have to include another file etc

    Cheers,

  7. #7
    kuske's Avatar
    kuske is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    2,597

    Default Re: How do i generate new project_id

    At the start of every Sugar php file you find one line which ensures that only access can be done through the Sugar application and not someone randomly accessing one of the Sugar files.

    This line looks like:

    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    So I recommend to look in the WIKI how own modules must be designed, or better to the book (sugarCRM Developer's Manual p. 193 pp) and folow all rules for correct module design. If doing so you can call sugar-utils-functions.
    No fear, it's really very simple.

    good luck

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. generate some poopus
    By holdjul in forum Help
    Replies: 1
    Last Post: 2007-08-04, 07:47 PM
  2. how generate an ID ?
    By UNi[FR] in forum Developer Help
    Replies: 1
    Last Post: 2006-05-04, 09:24 AM
  3. Replies: 2
    Last Post: 2006-04-12, 02:20 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
  •