Forum OpenACS Q&A: Bug in ed-com-msg.tcl?

Collapse
Posted by Anton Bajri on
Hi.

I'm new to OpenACS and WEB programming in general.
I'm about to build a site using OpenACS, and was trying the different
modules, when found trouble with featured bboards. I suffered from
disaparing posts: they appeared in the index, but i couldn't read
them.
I'm using OpenACS 3.2.4-1, AOL Server 3.1-2 and Postgresql 7.0.2-2 in
a RedHat 6.1 box.

After my first ever debugging session in TCL, first ever debugging
trough a web server, and first ever postgres experience, i found the
following:

in the bboard/ed-com-msg.tcl (first line '# ed-com-msg.tcl,v 3.0
2000/02/06 03:33:48 ron Exp'), there's the next if clause:

"if [catch {set selection [ns_db 1row $db "select bt.*, u.email as
maintainer_email from bboard_topics bt, users u
where bt.topic='[DoubleApos $topic]'
and bt.primary_maintainer_id = u.user_id"]} errmsg] {"

The problem is $topic is not defined. I changed it for

"if [catch {set selection [ns_db 1row $db "select bt.*, u.email as
maintainer_email from bboard_topics bt, users u
where bt.topic_id=$topic_id
and bt.primary_maintainer_id = u.user_id"]} errmsg] {"

and everything worked (and sounds more reasonable, also). This
$topic_id is loaded in a previous db query, tough it's already in the
URL.

Sorry for my english, and saludos,

Jorge

Collapse
Posted by Don Baccus on
Ahhh...once upon a time, the bboard topics table was keyed of the
topic name.  Then later, arsDigita added an integer "topic_id" key as
part of a policy to make all primary keys in the system integers (to
make it easier to build generic mapping tables that are unaware of
which tables are being mapped).

Either they missed this when they made the change, or we missed it
when we ran patch and hand-fixed queries that caused patch conflicts.

Thanks!  Good job.

Collapse
Posted by Anton Bajri on
Wow... I think i'll print this page and frame it :)

Saludos,