Forum OpenACS Development: get instance workflow id

Collapse
Posted by Iuri Sampaio on
I am trying to include a portlet of bug-tracker in my package and i got the followed message in the screen

Error in include template "/web/openacs/packages/people/lib/bugs-includelet": Selection did not return a value, and no default was provided

i debugged the error and at logs i have

PAGE: /packages/people/lib/bugs-includelet
------------------------------------------------------------
Selection did not return a value, and no default was provided
while executing
"db_string get_instance_workflow_id {}"
(procedure "bug_tracker::bug::get_instance_workflow_id" line 6)
invoked from within
"bug_tracker::bug::get_instance_workflow_id"
(procedure "bug_tracker::get_page_variables" line 13)
invoked from within
"bug_tracker::get_page_variables"
invoked from within
"[bug_tracker::get_page_variables]"
("uplevel" body line 10)
invoked from within
"uplevel {
ad_page_contract {
Bug listing page.

@author Iuri Sampaio (mailto:iuri.sampaio@gmail.com)
@creation-date 2009-04-28
@cvs-id $Id: i..."
(procedure "code::tcl::/web/openacs/packages/people/lib/bugs-includelet" line 2)
invoked from within
"code::tcl::$__adp_stub"
invoked from within
"if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init tcl $__adp_stub
..."
("uplevel" body line 3)
invoked from within
"uplevel {

if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init t..."
(procedure "adp_prepare" line 2)
invoked from within
"adp_prepare"

######################

which took me to the file packages/bug-tracker/tcl/bug-procs.tcl where the API is located
at line 547

procedure "bug_tracker::bug::get_instance_workflow_id"
and
db_string get_instance_workflow_id {}"

the code of this API calls a psql query db_string, that uses package_id

#TCL
ad_proc -public bug_tracker::bug::get_instance_workflow_id {
{-package_id {} }
} {
Return the workflow_id for the package (not instance) workflow
} {

if { [empty_string_p $package_id] } {
set package_id [ad_conn package_id]
}
return [db_string get_instance_workflow_id {}]
}

#XQL
fullquery name="bug_tracker::bug::get_instance_workflow_id.get_instance_workflow_id">
querytext
select workflow_Id
from bt_projects
where project_id = :package_id
querytext
fullquery

"1449" is a valid pkg id. since it is bug-tracker pkg id and comes with workflow pkg by default

I created a workflow instance and a workflow a boiler plate to my package.
My guess was once i have done that i should get rid of the error since in my mind i would have a package_id attached to workflow.

But this idea didn't work
How do i get over this situation without messing up bug-tracker and workflow procs?

Collapse
Posted by Iuri Sampaio on
I believe the query has to be diferent
as i said i created a new workflow to my pkg and i see in the table workflows

So the API bug_tracker::bug::get_instance_workflow_id
remains the same and the query changes a bit, from:

fullquery name="bug_tracker::bug::get_instance_workflow_id.get_instance_workflow_id">
querytext
select workflow_Id
from bt_projects
where project_id = :package_id
querytext
fullquery

it should be

fullquery name="bug_tracker::bug::get_instance_workflow_id.get_instance_workflow_id">
querytext
select workflow_id
from workflows
where object_id = :package_id
querytext
fullquery

This way seems more logical to me
But that is just a guess of a newbie user ;)