Ok here is the neccessary cahnges to the soap server file (NOT TESTED). Defines the function create_bug and registers it with the server:
PHP Code:
$server->register(
'create_bug',
array('user_name'=>'xsd:string',
'password'=>'xsd:string',
'assigned_user_name'=>'xsd:string',
'priority'=>'xsd:string',
'status'=>'xsd:string',
'type'=>'xsd:string',
'source'=>'xsd:string',
'category'=>'xsd:string',
'found_in_release_name'=>'xsd:string',
'name'=>'xsd:string',
'description'=>'xsd:string',
'work_log'=>'xsd:string'
),
array('return'=>'xsd:string'),
$NAMESPACE);
function create_bug($user_name, $password, $assigned_user_name, $priority, $status, $type, $source, $category, $found_in_release_name, $name, $description, $work_log)
{
if(!validate_user($user_name, $password)){
return 0;
}
$seed_user = new User();
$user_id = $seed_user->retrieve_user_id($user_name);
$assigned_user = new User();
$assigned_user_id = $assigned_user->retrieve_user_id($assigned_user_name);
// Bug class
require_once('modules/Bugs/Bug.php');
$oBug = new Bug();
$oBug->retrieve('');
if(!$oBug->ACLAccess('Save')){
return -1;
}
if(empty($status)){
$status = "New";
}
if(empty($priority)){
$priority = "Medium";
}
if(empty($source)){
$source = "Web";
}
if(empty($category)){
$category = "Bug Tracker";
}
if(empty($type)){
$type = "Defect";
}
$oBug->assigned_user_id = $assigned_user_id;
$oBug->assigned_user_name = $assigned_user_name;
$oBug->name = $name;
$oBug->priority = $priority;
$oBug->description = $description;
$oBug->work_log = $work_log;
$oBug->release_name = $found_in_release_name;
$oBug->source = $source;
$oBug->product_category = $category;
$oBug->type = $type;
$oBug->status = $status;
$oBug->save();
$return_id = $oBug->id;
return $return_id;
}
More in the morning. Hopefully with a working example.
Best,
Lucas
Bookmarks