Call Us:

  • +1 212 386 5676
  • +44 (0)1273 666 355
  • +61 (0)3 9682 2441
  • +7 383 332 40 55
Intranet & Extranet Manager: An integrated platform that will grow with your business
Translations of this page:

Change the name of the reporter to user defined within the form

For basic information on plugins, please refer: Infocapture plugins

In this section we would see how to change the reporter name to user defined name within the form

You can find the xml file of the test project here:

Lets suppose we have got this test project with ID = 16

For this purpose, we require plugin_16_add_issue.php

<?php
function hd_plugin_16_add_issue($params)
{
	global $db;
	$project = new HDProject();
	$fbform = new FBForm();
	$pid = 16;
 
	$project_info = $params["project"];
	$issue_info = $params["issue"];
	$issue_fields = $params["issue"]["fields_values"];
	
	if (!$project->Load($pid))
	{
		$errno = "Cannot load current project";
		vard2($errno);
		exit;
	}
 
	//$user_id is the id of the reporter, which is "0" (ie. default reporter) if no other user is selected 
	$user_id = $issue_fields["reporter_name"];
	if ($user_id == 0)
	{
		//Here reporter name is set to id 1, which is the id of "myself";
		$result = array();
		$result["issue"] = array();
		$result["issue"]["reporter"] = 1;
		$result["issue"]["fields_values"]["reporter_name"] = 1;
		return $result;		
	}
	else
	{
		$result = array();
		$result["issue"] = array();
		$result["issue"]["reporter"] = $user_id;
		return $result;
	}
}
?>

Place the above file in folder: /httpdocs/intranet/helpdesk/plugins/

Here, I have logged in as “Claromentis Administrator” and I have selected reporter’s name as “User 1 TEST”. When I report issue, the “Reported by” field is changed to “User 1 TEST” instead of the default reporter “Claromentis Administrator”

 
help/infocapture/plugins/change_reporter_to_user_defined.txt · Last modified: 26/08/2009 06:41 by sweta
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki