Forum OpenACS Q&A: Referencing the Persons table

Collapse
Posted by Jade Rubick on
Hi all. I'm starting to port some packages over from ACS 3.4 to OpenACS. I'm hoping this will allow me to eventually be using OpenACS full-time, so perhaps I'll be able to contribute a lot back to the community.

But for now I'm stuck in learning curve stage.

Here's my problem: I'm porting a package that keeps track of all of our contracts. The data model, simplified, looks like this:

create table ibr_contracts (
        contract_id	       	integer primary key,
	name			varchar(400) not null,
        status			char(1) default('a') 
				constraint contract_status_constraint 
				check(status in ('a','i','d')),
	agreement_date		date,
	-- the user who entered the original information
	author			not null references users,
	creation_date		date not null,
	modification_date	date not null
);
This isn't completely ported yet. My question is what do I change the author to refer to? Do I point it to persons? Is this taboo in OpenACS 4.6? I haven't quite figured this out yet, and looking over the documents, they help, but I'm still not quite sure what to do.

Any help will be greatly appreciated.

Collapse
Posted by Jon Griffin on
users is correct. You could use parties or persons but I think parties may go away and persons may not be registered, but they all actually point to the same acs_object.
Collapse
Posted by Jade Rubick on
Thanks, Jon.

If I can do it either way, I guess the advantage of choosing Persons would be that if I deleted a User, then there would still be a reference in my table to that person's name and whatever information was still left over... I think I'll go with that.

PS  How's your migration going? I checked your "upgrade document", and it looked like you hadn't completed it yet.

I should probably make up a document of my own, so that anybody else doesn't have to go through all this pain..

Collapse
Posted by Tilmann Singer on
I would recommend to use persons - it is explicitely there for representing single individuals in the system that do not need to have a login account. So you might have (don't know if you need that) authors that are not able to login but are entered by another user into the system.

You can later augment a person to a user by giving them an account. I think that's covered in the admin UI with 'select existing person from this system', but I'm not sure. If it's not there it should be easy to add a page for that.

Persons can also be associated with each other in groups, in case you want to model employees of different client companies or the like - it's not necessary to store them as users for that.

Collapse
Posted by Jon Griffin on
The reason I used user was that it seems that you are using that field for auditing.<p>
You are correct that person isn't a registered user.