Forum OpenACS Q&A: Payroll Function for Employees in Intranet Module

Is the payroll function working? I can modify most of the employee's
information through the admin pages, but get an error every time I
try to edit an employee's payroll information. (Server Error: The
requested URL cannot be accessed due to a system error on this
server.) I've looked at the payroll.tcl and payroll-edit.tcl, but not
being familier with TCL or Postgresql (learning though), I really
can't see why it isn't functioning.

Also, I'm not able to find admin pages for filling in the "Years
experience:" "Educational history:" or "Last degree completed:"
fields.

Thanks,

Missing pages from the early Intranet module don't surprise me, nor do  lingering errors.  The module wasn't really ready for prime time as released by aD in OpenACS 3.2, and our port suffers some of the same incompleteness etc.

As far as the error goes, can you tell us what's in your AOLserver error log?  You might want to turn "Verbose" "On" in your database pools first, as that will log all queries.

Thanks Don for the quick response, I've turned verbose on and then
executed the same attempt to edit "payroll" information, the log says
this is what happened: (sorry for the mass log, I haven't figured out
how to paste in a text piece without losing the formatting)...

10.104.168.141 - - [23/May/2001:13:27:13 -0400] "GET
/intranet/employees/payroll.tcl?user_id=3&return_url=%2fintranet%2femployees%2fadmin%2fview%2etcl%3fuser%5fid%3d3
HTTP/1.1" 200 1391
"http://10.104.168.60:8000/intranet/employees/admin/view.tcl?user_id=3"
"Mozilla/4.0 (compatible; MSIE 5.01; Windows 98)"
[23/May/2001:13:27:19][9989.4101][-conn0-] Notice: Querying 'select
case when ad_group_member_p(3, 11) = 't' or  ad_group_member_p(3, 8) =
't' then 1 else 0 end;'
[23/May/2001:13:27:19][9989.4101][-conn0-] Notice: dbinit:
sql(localhost::acs): 'select case when ad_group_member_p(3, 11) = 't'
or  ad_group_member_p(3, 8) = 't' then 1 else 0 end'
[23/May/2001:13:27:19][9989.4101][-conn0-] Notice: Querying '
select
  u.first_names,
  u.last_name,
  u.email,
  (sysdate() - info.first_experience::timestamp)/365 as years_experience,
  info.*
from users u, im_employee_info_view info
where u.user_id = 3
and u.user_id = info.user_id
and ad_group_member_p ( u.user_id, 8 ) = 't'
union
select
  u.first_names,
  u.last_name,
  u.email,
  0::interval as years_experience,
  info.*
from users u, im_employee_info_null info
where u.user_id = 3
and not exists (select 1 from im_employee_info i
                where u.user_id = i.user_id)
and ad_group_member_p ( u.user_id, 8 ) = 't';'
[23/May/2001:13:27:19][9989.4101][-conn0-] Error: Ns_PgExec: result
status: 7 message: ERROR:  Bad interval external representation '0'

[23/May/2001:13:27:19][9989.4101][-conn0-] Error: dbinit:
error(localhost::acs,ERROR:  Bad interval external representation '0'
): '
select
  u.first_names,
  u.last_name,
  u.email,
  (sysdate() - info.first_experience::timestamp)/365 as years_experience,
  info.*
from users u, im_employee_info_view info
where u.user_id = 3
and u.user_id = info.user_id
and ad_group_member_p ( u.user_id, 8 ) = 't'
union
select
  u.first_names,
  u.last_name,
  u.email,
  0::interval as years_experience,
  info.*
from users u, im_employee_info_null info
where u.user_id = 3
and not exists (select 1 from im_employee_info i
                where u.user_id = i.user_id)
and ad_group_member_p ( u.user_id, 8 ) = 't''
[23/May/2001:13:27:19][9989.4101][-conn0-] Error: Database operation
"0or1row" failed (exception NSDB, "Query was not a statement returning
rows.")
Database operation "0or1row" failed (exception NSDB, "Query was not a
statement returning rows.")
    while executing
"ns_db 0or1row $db "
select
  u.first_names,
  u.last_name,
  u.email,
  (sysdate() - info.first_experience::timestamp)/365 as years_experience,
  ..."
    invoked from within
"set selection [ns_db 0or1row $db "
select
  u.first_names,
  u.last_name,
  u.email,
  (sysdate() - info.first_experience::timestamp)/365 as years..."
    (file
"/var/lib/aolserver/servers/defaultacs/www/intranet/employees/payroll-edit.tcl"
line 47)
    invoked from within
"source $script"
    (procedure "ns_sourceproc" line 6)
    invoked from within
"ns_sourceproc cns5 {}"
[23/May/2001:13:27:19][9989.4101][-conn0-] Notice: Querying 'select *
from referer_log_glob_patterns;'
[23/May/2001:13:27:19][9989.4101][-conn0-] Notice: dbinit:
sql(localhost::acs): 'select * from referer_log_glob_patterns'
[23/May/2001:13:27:19][9989.4101][-conn0-] Notice: Querying 'update
referer_log set click_count = click_count + 1
where local_url = '/intranet/employees/payroll-edit.tcl'
and foreign_url =
'http://10.104.168.60:8000/intranet/employees/payroll.tcl?user_id=3&return_url=%2fintranet%2femployees%2fadmin%2fview%2etcl%3fuser%5fid%3d3';
and trunc(entry_date) = trunc(sysdate());'
[23/May/2001:13:27:19][9989.4101][-conn0-] Notice: dbinit:
sql(localhost::acs): 'update referer_log set click_count = click_count + 1
where local_url = '/intranet/employees/payroll-edit.tcl'
and foreign_url =
'http://10.104.168.60:8000/intranet/employees/payroll.tcl?user_id=3&return_url=%2fintranet%2femployees%2fadmin%2fview%2etcl%3fuser%5fid%3d3';
and trunc(entry_date) = trunc(sysdate())'
10.104.168.141 - - [23/May/2001:13:27:19 -0400] "GET
/intranet/employees/payroll-edit.tcl?user_id=3&return_url=%2fintranet%2femployees%2fadmin%2fview%2etcl%3fuser%5fid%3d3
HTTP/1.1" 500 530
"http://10.104.168.60:8000/intranet/employees/payroll.tcl?user_id=3&return_url=%2fintranet%2femployees%2fadmin%2fview%2etcl%3fuser%5fid%3d3"
"Mozilla/4.0 (compatible; MSIE 5.01; Windows 98)"

Sorry for the long log piece, but I'm not sure what is important and
what's not...Also in the employee's subdirectory of the intranet
module there are some "history-edit.tcl" files, but I don't see a link
to them from any admin page. Tomorrow when I have time I may try
executing them to see what happens...

Thanks,

I ran into this error while working on intranet (a current project as my company is now using it).. I did post most fixes in the SDM so you can find it there..

If not I am sure I can find the diff and send it to you

cheers
Jamie

Welp, I think that's a problem I introduced. What version of Postgres are you using? Even with all the patches I've submitted, intranet continues to be a bug ridden mess.  I'm just glad that the Intranet Module was never written for 4.X Muhahahahahahhahahahhaha ;)  Seriously, I'm willing to go thru and fix bugs as they are found.. If SDM could be set up so that I got e-mail alerts when bugs were submited, as well as giving me power to close bugs when they are fixed, why that would be wonderful! But alas, I'm not holding my breath... I've always wondered.. We've got some nice tools to do collaborative work w/OpenACS (Ticket Tracker/SDM) but it never has been used to it's full potential IMHO
Chris and Jamie, you guys should collaborate to rid Intranet of these bugs, since you are working on that module.

You can set up bug alerts on the SDM preferences. This reminds me that we need to put that patch-a-bug feature that Pascal in Openacs.org ASAP.

No I agree... I think Chris and I can make a lot of headway.. as I said I have a LOT of incentive as my 25 person company is using intranet now as a core element.

I will check.. I can fix code. .but would need access to CVS tree (I may have this but didnt see it)

Roberto,

    We have been colobrating, but the module is a huge Kludge.  For the most part, we've worked out alot of the bugs (and that's alot, alot of bugs). I do have to admit that I'm a bit perplexed and frustrated with how the development on the openacs side is tho.  Both Jamie and I are willing to patch bugs/and have patched bugs.  I've taken over ownership of that module as much as I can, but if the head developers won't release the riens and allow me or Jamie authority (CVS commits, bug closing, etc) to control that module.  That's one big reason why I haven't looked at working on the OpenACS 4.x intranet module (which would have to be written pretty much from scratch). I suppose me and jamie could setup a CVS server and Ticket tracker of our own and work out all the bugs that way, but somehow I don't know if you would like that either.. ;I
I'm using PostgreSQL 7.1.1, my installation is the one Jonathan Marsh provided RPM's for, his RPM's really make the setting up and configuration a breeze compared to doing it all manually. While I'm on this subject, should I continue to post the various errors I'm coming up with here, or use SDM? I just don't want to put something into SDM if it's just a lack of system knowledge or a simple configuration error on my part...

Thanks,

Post them here.. I read the forums every night and I believe Jamie does as well.  We are happy to help.
Chris, it looks like you already have CVS commits. I see you in the SourceForge list of project members. Are you saying you can't commit?

As for giving you permissions to close bugs on SDM, since you and Jamie are working hard on that module, I think it's time we do that, but it's ultimately Ben's decision. Ben?

From my POV, it's not like we are trying to keep tight grips on the project and the way it's being developed and not letting anybody in. That was never what we wanted to do. Right now there are _a lot_ of things happenning, and somethings just slip. Try to put yourselves in our own shoes too.

I, for one, didn't know up until now, that you were willing to take ownership of that module. I think it's great that you and Jamie are willing to do that.

Gilbert, are you saying you are running OpenACS on PG 7.1.1? If so, this has been mentioned several times here but I'll do it one more time anyways: PG 7.1.1 has a bug on PL/pgSQL that can cause part of your OpenACS pages to not function properly.

I'd recommend you go back to 7.1 or wait for 7.1.2, which will have the bug fixed.

Oh I can commit, but from 3.2.4-> 3.2.5 it seemed like no-one was commiting to that tree, so I was confused as to where the real tree was.  I was also informed to funnel all patches thru you.  Guys, don't get me wrong. I enjoy OpenACS, and don't mind working on it to make it better, I was just getting frustrated.  I know you all are busy, and that's one reason I wanted to take ownership of the Intranet Module.  One less thing for you all to worry about.
Roberto,

My mistake, I put in a "." when it should have been a "-", I'm using the 7.1-1 version, not the 7.1.1..

Sorry for the confusion, but being primarily on the Darkside with MS versioning schemes, it's taking me a little time to get used being in the light and adjusting to the *nix versioning numbers...

Thanks,

Back the the original question...is there a fix for this problem? If so, how or what do I need to modify. I'd really like to get this module completely working. Is it a Postgresql error? Will an upgrade of my Postgresql to the next version correct the problem?

Thanks...

One thing I had to change in payroll.tcl was this (as shown by diff):
63c63
<   0::interval as years_experience,
---
>   0.0::interval as years_experience,
0 makes a pretty lousy interval-type value....