Forum OpenACS Q&A: Adding field to main schema.

Collapse
Posted by C. R. Oldham on
Greetings,

Can I make a pitch to add a field to the Person object?  It looks
like the Persons table is the place where a user/party/person's first
and last names are stored, I would like to add a "Salutation"
or "Greeting" field to this table, to contain traditional titles
like "Mr.", "Mrs.", "Dr.", "Sr.", etc.

I think this would be helpful because there isn't any other place
really to keep this data, and it seems wasteful to create a table
just for this field.

I could probably make a case for a "Suffix" as well (e.g. Jr., II,
III), but in the project I am currently working on this is less
important.

Collapse
Posted by Jon Griffin on
I wouldn't change anything in a core table.

The whole persons/party etc is leftover cruft from the original hack in ACS prior to any versions. It is not even close to being usable for anything except what it was designed for i.e. community membership etc. You really should create new tables that do the right thing and "inherit" from persions

Collapse
Posted by C. R. Oldham on
Yes, but if I inherit, wouldn't I want to inherit from the person object?  And then the user object would not have the fields I need, correct?
Collapse
Posted by Jon Griffin on
Create a table myperson with a foreign key on person (person_id).

Then you add your other fields. This way you get the important info and if you want to change the first_names, last_name in your new table you could do that also (via a trigger in your table or some code changes in the core).

Collapse
Posted by Stephen . on
What?  The suggestion that OpenACS add a salutation column to the persons table sounds pretty reasonable.
Collapse
Posted by Jon Griffin on
Then we need to change person to be correct. This means ripping it apart and making it mulitlingual, multicultural and etc.. Right now it is useless for anything like contact manager or directory of people etc.

Don't change the core unless you need to and I for one say it isn't needed. When you change the core you break things. It is very easy to create the tables you need and inherit from that.

If you use HR-XML standards you can even make it a package to be ADDED to openacs. In fact I already have that module done in my contact manager package and will try to find time to make it stand alone. Notice I said try, that said I think acs-person is needed and I will add it to my list.