Käynnissä

Quick PHP Job - SugarCRM Hook to create autonumbering

Software: Sugar CRM

I need a logic hook created.

High level: Create Sequential AUTO ID for a new customer when a sugar crm user saves a new customer.

Sugar CRM has logic hooks. You can develop things within a certain environment.

When the user clicks the save button when creating a new customer, it will get the next customer id and write:

Name: NEXT ID + FIRST NAME + LAST NAME

SIC_CODE = NEXT ID

INTERNAL_KEY_C: = NEXT ID

Sample Data:

Name: AC1001003 George Smith

SIC_CODE: AC1001003

INTERNAL KEY: AC1001003

Current code that I use on my forms you could re-use:

//make new User Interface ID for a record

Function GetNewUID($module_name){

$chandle = mysql_connect(DBLOC, DBUSER, DBPASS) or die("Connection Failure to Database");

mysql_select_db(DBNAME, $chandle) or die(DBNAME . " Database not found. " . DBUSER);

$sql = "select name, value from a_settings where module_name = '" . $module_name . "'";

$result = mysql_db_query(DBNAME, $sql) or die("Failed Query of " . $sql);

if ($result = mysql_query($sql)) {

if ($row = mysql_fetch_row($result)) {

$new_prefix = $row[0];

$new_value = $row[1];

}

} else {

echo "<!-- SQL Error " . mysql_error() . " -->";

}

//define client id for new customer

$new_uid = $new_prefix . $new_value;

//update settings with new value

$new_value = $new_value +1;

$sql = "UPDATE a_settings SET value = '" . $new_value . "' WHERE module_name = '" . $module_name . "' LIMIT 1";

$result = mysql_db_query(DBNAME, $sql) or die("Failed Query of " . $sql);

return $new_uid;

}

Here is my code I use on my webforms to create a new customer:

// create new user if not found

if (empty ($_SESSION['ywb_user_info'][accounts_id])) {

$formData['uid'] = make_key();

$_SESSION['ywb_user_info'][accounts_id] = $formData['uid'];

//retrieve next client id

$formData['clid'] = GetNewUID('Accounts');

$_SESSION['ywb_user_info'][accounts_sic_code] = $formData['clid'];

//add customer record - accounts

$sql = "INSERT INTO accounts(

" . $insert_field . "

name,

date_entered,

date_modified,

modified_user_id,

created_by,

deleted,

assigned_user_id,

account_type,

sic_code,

id

)

VALUES (

" . $insert_value . "

'" . $formData['clid'] . " " . $formData['first_name']. " " . $formData['last_name'] . "',

'" . $formData['datetime'] . "',

'" . $formData['datetime'] . "',

'1',

'1',

'0',

'1',

'Lead',

'" . $_SESSION['ywb_user_info'][accounts_sic_code] . "',

'" . $formData['uid'] . "'

)";

$result = mysql_db_query(DBNAME, $sql) or die("Failed Query of " . $sql);

//add customer record - accounts_cstm

$sql = "INSERT INTO accounts_cstm(

" . $cstm_insert_field . "

internal_key_c,

id_c

)

VALUES (

" . $cstm_insert_value . "

'" . $_SESSION['ywb_user_info'][accounts_sic_code]. "',

'" . $formData['uid']. "'

)";

$result = mysql_db_query(DBNAME, $sql) or die("Failed Query of " . $sql);

Please read this post. They are doing it to contacts. So essentially it would be the same, however, I need to to an account record (a customer).

[url removed, login to view]

I have a logic hook creator, it just needs the custom code.

This is where the custom code would be placed:

Editing method Autonumbering_method in class Autonumbering_class for Customers before_save

<?php

class Autonumbering_class

{

function Autonumbering_method(&$bean, $event, $arguments=null)

{

if ($event != 'before_save') return;

// Insert your custom logic between these comments

// Insert your custom logic between these comments

}

}

?>

Please BID and when i accept you I will give you login details to sqldb, sugarcrm, webroot to place your Custom Logic Code between the lines.

Cheers.

Taidot: PHP

Näytä lisää: query insert hook bean sugarcrm, dbname bean sugarcrm, sugarcrm hook, quick create insert query sugarcrm, sugarcrm logic hook mysql_query, sugarcrm custom code save quick create, before_save update query sugarcrm, sugarcrm php create sql query, sugarcrm hook before_save, logic hook update account name save sugar crm, quick create bean save sugarcrm, sugarcrm create sql query url, sugarcrm button, clid sugarcrm, logic hooks create quick, webroot, things to write to get a job, post my job, method crm, job values, job software, job in editing, job id, job event, job define

About the Employer:
( 2 reviews ) Hornsby, Australia

Projektin tunnus: #467796

Myönnetty käyttäjälle:

maruti1001

Please check PMB. Thanks

150 $ USD 1 päivässä
(5 arvostelua)
4.0

3 freelanceria on tarjonnut keskimäärin 163 $ tähän työhön

fastphp

lets start now

240 $ USD 6 päivässä
(29 arvostelua)
5.6
GalaxyTech

Hello, I can do this Task. I have exp with SugarCrm & VTiger CRM and done small customization project in SugarCRM. Thanks, Bhushan

100 $ USD 4 päivässä
(0 arvostelua)
0.0