Change the STATUS field value depending on certain condition

For basic information on plugins, please refer: Infocapture plugins

In this section we would see how to change STATUS field value depending on the number entered in the text box

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

Lets suppose we have this test project with ID = 35

Lets suppose there are three STATUSES: Less, Equal, Greater. If the number entered is less than 100, STATUS = Less. If the number is equal to 100, STATUS = Equal else STATUS = Greater.

To achive this we would require plugin_35_add_issue.php

<?php
function hd_plugin_35_add_issue($params)
{
	$project_info = $params["project"];
	$issue_info = $params["issue"];
	$issue_fields = $params["issue"]["fields_values"];
	
	$number = $issue_fields["enter_number"];
	$result["issue"] = array();
	if($number < 100)
		$result["issue"]["status"] = 1;
	elseif($number == 100)
		$result["issue"]["status"] = 2;
	else
		$result["issue"]["status"] = 3;
	
	return $result;
}
?>

Here I have entered number 45, STATUS is set to Less