Chermannns
Joined: 27 Oct 2006
Posts: 2
Location: Düsseldorf Germany
|
| Posted: Fri Oct 27, 2006 10:33 am Post subject: Submitting Picklist Values to Vtiger |
|
|
I am using VTIGER 5.0.1 and the webform .....
i managed to post custom fields into Vtiger (int and string)
Now i am in some kind of trouble posting picklist results to the vtiger fields
Sourcecode i added :
index.php
Code: .....
<tr><th>kwh:</th>
<td><input type=text name=cf_501 size=30 value="<?php echo $_POST['cf_501']?>"></td>
</tr>
<tr><th>Spannungsebene</th>
<td><select name=cf_509>
<option value="<?php echo $_POST['cf_509']?>">0,4 k Niederspannung</option>
<option value="<?php echo $_POST['cf_509']?>">10,20,30 k Mittelspannung</option>
<option value="<?php echo $_POST['cf_509']?>">110 k Hochspannung</option>
</select>
</td>
</tr>
send_data.php
Code: if($_REQUEST['create'] == 'lead')
{
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$company = $_POST['company'];
$country = $_POST['country'];
$cf_501 = $_POST['cf_501'];
$cf_509 = $_POST['cf_509'];
$description = "WebForm : ".$_POST['description'];
$params = array(
'lastname' => "$lastname",
'email'=>"$email",
'phone'=>"$phone",
'company'=>"$company",
'country'=>"$country",
'cf_501'=>"$cf_501",
'cf_509'=>"$cf_509",
'description'=>"$description",
'assigned_user_id'=>"$assigned_user_id"
);
webforms.php
Code: $server->register(
'create_lead_from_webform',
array(
'lastname'=>'xsd:string',
'email'=>'xsd:string',
'phone'=>'xsd:string',
'company'=>'xsd:string',
'country'=>'xsd:string',
'cf_501'=>'xsd:int',
'cf_509'=>'xsd:var',
'description'=>'xsd:string',
'assigned_user_id'=>'xsd:string'
),
array('return'=>'xsd:string'),
$NAMESPACE);
$server->register(
'create_contact_from_webform',
array(
'first_name'=>'xsd:string',
'last_name'=>'xsd:string',
'email_address'=>'xsd:string',
'home_phone'=>'xsd:string',
'department'=>'xsd:string',
'cf_501'=>'xsd:int',
'cf_509'=>'xsd:var',
'description'=>'xsd:string',
'assigned_user_id'=>'xsd:string'
),
array('return'=>'xsd:string'),
$NAMESPACE);
$server->register(
'unsubscribe_email',
array(
'email_address'=>'xsd:string'
),
array('return'=>'xsd:string'),
$NAMESPACE);
/** function used to create lead from webform from the passed details
* @param string $lastname - last name of the lead
* @param string $email - email of the lead
* @param string $phone - phone number of the lead
* @param string $company - company name of the lead
* @param string $country - country name of the lead
* @param string $description - description to create a lead
* @param int $assigned_user_id - assigned to user for the lead
* return message success or failure about the lead creation
*/
function create_lead_from_webform($lastname, $email, $phone, $company, $country, $cf_501, $description, $assigned_user_id)
{
global $adb;
$adb->println("Create New Lead from Web Form - Starts");
if($assigned_user_id == '')
{
//if the user id is empty then assign it to the admin user
$assigned_user_id = $adb->query_result($adb->query("select id from vtiger_users where user_name='admin'"),0,'id');
}
require_once("modules/Leads/Lead.php");
$focus = new Lead();
$focus->column_fields['lastname'] = $lastname;
$focus->column_fields['email'] = $email;
$focus->column_fields['phone'] = $phone;
$focus->column_fields['company'] = $company;
$focus->column_fields['country'] = $country;
$focus->column_fields['cf_501'] = $cf_501;
$focus->column_fields['cf_509'] = $cf_509;
$focus->column_fields['description'] = $description;
$focus->column_fields['assigned_user_id'] = $assigned_user_id;
$focus->save("Leads");
//$focus->retrieve_entity_info($focus->id,"Leads");
$adb->println("Create New Lead from Web Form - Ends");
if($focus->id != '')
$msg = 'Thank you for your interest. Information has been successfully added as Lead in vtigerCRM.';
else
$msg = "Lead creation failed. Please try again";
return $msg;
}
i tried :
'cf_509'=>'xsd:var',
and
'cf_509'=>'xsd:string',
........
every field i added including the integer field works just fine ..... picklistresults dont work at all......
i think i am just using the wrong datatype but as from a php point of view everything is right ......
dont have much experience with soap tho.
i would be more than greatfull for any help
Christian Hermanns
Strombörse Deutschland
SBD.AG |
|