Forum OpenACS Development: Organization Hierarchy Package

Collapse
Posted by James Thornton on
I need an organization hierarchy package for use with the stores component of the subsite-enabled e-commerce package. I'll also use it on this project to generate About Us and Contact Us pages. Below is the first draft of the data model based on my requirements, and please let me know if you have any input on how this package should be designed for use with OpenACS.
create table org2_organization (
       organization_id     int primary key references groups(group_id),
       legal_name	   text not null unique,
       informal_name 	   text not null unique,
       description         text,
       tagline             text,
       -- email stored in parties table
       package_id 	   int references apm_packages(package_id)
);

-- do we care about divisions?

create table org2_location (
       location_id            int primary key references groups(group_id),
       organization_id        int not null references org2_organization(organization_id),
       location_name 	      text not null,
       description            text,
       address1               text,
       address2               text,
       city 	              text,
       state 	              char(2) references us_states(abbrev),
       postal_code            text,
       country		      char(2) references countries(iso),
       landmark_description   text, -- e.g. Located near... (html) 
       phone_primary          text,
       phone_tollfree         text,
       phone_fax              text,
       -- email stored in parties table
       timezone               text, -- e.g. -600 (CST)
       primary_p              bool not null, -- primary location?
       sort_key               numeric not null default 10,
       package_id             int not null references apm_packages(package_id)
);

create sequence org2_location_hours_id_seq start 2000;
create table org2_location_hours (
       location_hours_id  int primary key,
       -- day values 1-7 (easier to sort)
       day_begin   	  int not null check (day_begin >= 1 and day_begin <= 7),
       day_end 	 	  int not null check (day_end >= 1 and day_end <= 7),
       time_open          timestamptz not null,
       time_close         timestamptz not null,
       location_id   	  int not null references org2_organization_location(location_id),
       package_id         int not null references apm_packages(package_id),
       unique             (day_begin,location_id),
       unique             (day_end,location_id)
);

create table org2_department (
       -- departments at large companies may have specific hours
       department_id      int primary key references groups(group_id),
       location_id        int references org2_location(location_id),
       department_name    text not null, -- e.g. Sales, Parts, Service       
       description        text,
       phone_primary	  text,
       phone_fax	  text,
       -- email stored in parties table
       parent_id          int references org2_department(department_id),
       package_id         int not null references apm_packages(package_id),
       unique             (department_name,location_id)
);

-- do we care about teams?

create table org2_position (
       position_id        int primary key references groups(group_id),
       department_id      int references org2_department(department_id)
       job_title          text not null, -- e.g. Parts Manager
       description        text,
       package_id         int not null references apm_packages(package_id),
       unique             (job_title,department_id)
);

create table org2_employee (
       employee_id        int primary key references persons(person_id),
       position_id        int references org2_position(position_id),
       title              text not null, -- e.g. Mr., Mrs., Dr.
       -- first_name, last_name stored in persons table
       -- email stored in parties table
       -- if they have an email address, should we make them a user?
       bio_short          text, --html
       bio_long           text, --html
       phone_primary	  text,
       phone_fax	  text,
       supervisor_id      int references org2_organization_employee(employee_id),
       package_id         int not null references apm_packages(package_id)
);

create table org2_employee_photo (
       employee_id        int references org2_employee(employee_id),
       image_id           int references images(image_id),
       primary key	  (employee_id,image_id)
);
Collapse
Posted by Dave Bauer on
James,

Look at the organization, postal-address, and telecom number packages. These provide a data model to store contact information, addresses and phone numbers. There isn't any user interface to these that I am aware of.

In addition, i built a system to represent a company hierarchy in a simialr way. We have several levels of the company, each was a group.

I created a tree_sortkey similar to that used for acs_objects to represent the group hierarchy. On oracle it could just use connect by.

Collapse
Posted by Jade Rubick on
The organization package does have a primitive UI. (Note that the Oracle version is out of sync with the Postgres version). The UI is nothing to boast about, but it works. It would be nice to link those three packages together, perhaps using a fourth package to do so.
Collapse
Posted by Barry Books on
When I needed this I built a package called office and used the site map to model the organization. I associated a group with each office and created an employee rel type to make people employees. If you use package parameters and rel type attributes to store the data you have a (primitive) gui. You can also use the tcl package callbacks to create the group when you mount a package.

The advantages are you can model any depth and the context bar will help you navigate. You can also use the permission system to control access. And it's easy to extend and customize.

The only real drawbacks are; you end up with a lot of site_nodes and package parameters are not stored in an easily searchable way (but they are cached)