Forum OpenACS Q&A: problems with new-ticket

Collapse
Posted by Carlo Moneti on
Hi,
I am working with the rpm install of openacs3.2.5 on RH7.1, PG7.1, and
Aolserver3.2. I activated the Intranet module, added a couple of
customers, added a project for each, and defined a ticket for each
from the 'Tasks and Tickets' section of the main Intranet page. All
went well. However, when I go to one of the project pages and click on
'create a ticket tracker',  I get a "Server Error The requested URL
cannot be accessed due to a system error on this server" The output
from defaultacs.log is below:

[20/Jun/2001:15:31:31][11306.64518][-conn22-] Error: can't read
"new_id": no such variable
can't read "new_id": no such variable
    while executing
"ns_returnredirect "/new-ticket/project-top.tcl?project_id=$new_id"
"
    (file
"/var/lib/aolserver/servers/defaultacs/www/intranet/projects/ticket-edit.tcl"
line 48)
    invoked from within
"source $script"
    (procedure "ns_sourceproc" line 6)
    invoked from within
"ns_sourceproc cns493 {}"
192.168.1.224 - - [20/Jun/2001:15:31:31 -0400] "GET
/intranet/projects/ticket-edit.tcl?group_id=23&return_url=%2fintranet%2fprojects%2fview%2etcl%3fgroup%5fid%3d23&customer_id=19
HTTP/1.1" 500 545
"http://workflow:8000/intranet/projects/view.tcl?group_id=23"
"Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)"

Thanks in advance for any suggestions you may offer.

Collapse
Posted by Al Walworth on
Carlo,

I'm not sure exactly what you did. You say you added a ticket for each and the clicked on 'create a ticket tracker', but logically you have to "create a ticket tracker" (which adds an id for the project into the ticket_projects table) before you can add a ticket for the project.

At any rate, once you've gone through the "create a ticket tracker" process for a project, it doesn't make sense to do it again: there's already an entry for the project in ticket_projects, and you want just a single entry per project there.

Consequently, intranet/projects/ticket-edit.tcl runs into trouble. It knows enough to not create a new id when one already exists, but then tries to use the new id it would create when used as intended in redirecting you to the ticket display page for the project.

If you'd prefer it to send you on to the project's ticket display when there's already an entry for the project in ticket_projects, you can add an "else" clause to the "if {$check == 0}{ ... }" section of ticket-edit.tcl by changing the final "}" line of that block to

} else { set new_id [database_to_tcl_string $db "select project_id from ticket_project_teams where team_id=$group_id"]
}
Collapse
Posted by Al Walworth on
The earlier response was too superficial. The underlying problem is that ticket_project_id isn't getting set in im_projects, so intranet/customers/view.tcl finds nothing there and concludes it should invite you to "create a ticket tracker" for the project, when it ought to be giving you a link to a list of the project's tickets. The same happens with intranet/projects/view.tcl.

You can fix the problem by adding the following at the end of the "if {$check == 0} { " block in intranet/projects/ticket-edit.tcl (before the '}'):

ns_db dml $db "update im_projects set ticket_project_id = $new_id where group_id = $group_id"
That will give you correct behavior for future projects. For ones you've already created (and for which you've "created a ticket tracker" with the deficient code), you can manually add the missing data as follows:

  1. In psql, use "select * from ticket_projects;" to find the project's project_id.
  2. Use "select * from ticket_project_teams;" to determine the corresponding team_id.
  3. Finally, supposing the project_id is 10 and the team_id is 38, use "update im_projects set ticket_project_id = 10 where group_id = 38;" to fix that project's entry.
Collapse
Posted by Carlo Moneti on
Al,

Your explanation and solution were impeccable. I followed you directions and everything works great. Thank you very much.