# PRD — quantivia-svn (Quantivia on eGroupware)

Evidence date: 2026-10-05.

Source: `git@bitbucket.org:overdrive/quantivia-svn.git`, `master` at `ca64fae` (2019-06-12).

There is no prior PRD in the source repository or in Silicon Ark. Requirements below are recovered from the implementation (primarily `quantivia/`), eGroupware platform behaviour, and setup metadata. Provenance is labelled. Credential values are not reproduced.

## Product purpose

**Documented.** `quantivia/setup/setup.inc.php` and `class.quantivia_bo.inc.php` describe Quantivia as a **Deliverable Progress and Performance Reporting tool** (eGroupware Friendly), commercial license, author/maintainer Procon8 (Jean Thirion).

**Implemented.** The runnable Quantivia product lets authenticated eGroupware users select a project/programme, manage deliverables and control-point chains, capture progress and resource commitments, produce graphical/tabular RAMP/STEP reports, and publish reporting snapshots — through a SmartAdmin shell at `quantivia/main.php`.

**Also Implemented (platform):** the same install is a full eGroupware 1.8 groupware suite with mail, calendar, address book, file manager, and several ATE custom trackers.

**Unknown / Requires Confirmation:** whether Overdrive still operates Quantivia as a live product, and which client programmes remain in scope.

## Users and roles

| Actor | Evidence | Status |
|---|---|---|
| eGroupware account holder | `login.php` session create; Quantivia checks `sessionid` / `last_loginid` cookies | **Implemented** |
| Quantivia programme user | Template selection filtered by eGroupware group / `is_user_programme_user()` | **Implemented** |
| Project administrator | Project field `administrator`; admin forms `AdminUser.php`, `AdminUsers.php`, `AdminProgramme.php` | **Implemented** |
| Demo / webdemo user | `auto_login.php` selects idle `webdemo*` accounts | **Implemented** (demo path) |
| Worker process | `$_SESSION['worker']=true`, `$GLOBALS['current_user']='worker'` in workers and QFD | **Implemented** |
| Header / setup admin | `header.inc.php` `header_admin_user` / config users per domain | **Implemented** (eGroupware setup) |
| Licensed tenant | MAC + domain match against `license.lic`; limits `N_PROJECTS`, `Qlicensed`, `Elicensed` | **Implemented** |
| TOTP-enabled user | `loginextra.php` + `TokenAuth6238` after password auth | **Implemented** |

eGroupware ACL and application enablement still govern which EGW apps appear. Quantivia-specific ACL beyond group/template and license gates is **partially Inferred** from those mechanisms — fine-grained per-form ACL matrix is **Unknown / Requires Confirmation**.

## Systems the product talks to

1. User browser (SmartAdmin HTML/JS).
2. eGroupware MySQL database (accounts, ACL, EGW apps, config).
3. Quantivia database (projects and per-project `p_{id}_*` tables); PDO types include mysql (default), sqlite, mssql, oracle, sybase per settings comments.
4. SMTP (PHPMailer via `quantivia_notifier`, config from `egw_config`).
5. License server `online.quantivia.com` (QFD / version endpoints).
6. Local worker HTTP endpoints (`worker_url` / `worker_port` in settings).
7. Optional CalDAV/CardDAV/GroupDAV clients via `groupdav.php`.
8. Optional Primavera P6 schedule files via `forms/p6import.php`.
9. Excel via PHPExcel upload/download wizards.
10. Standard eGroupware mail stack (FelamiMail / emailadmin) when those apps are used.

## Major workflows

### WF-1 — Authenticate

1. User opens `login.php` (or `loginextra.php` for TOTP).
2. eGroupware validates credentials and creates a session.
3. Optional: `auto_login.php?demo` finds an idle `webdemo*` account, sets password equal to username, creates session, and seeds dashboard UI settings.

Provenance: **Implemented**.

### WF-2 — Enter Quantivia

1. With a valid eGroupware session, user opens `quantivia/index.php` → `quantivia/main.php`.
2. Without `sessionid`, Quantivia redirects to `../index.php` / returns 403 from common session checks.
3. SmartAdmin shell loads; forms and services are fetched into the main panel.

Provenance: **Implemented**.

### WF-3 — Select programme template and project

1. User (or default) gets template `templates_procon8_01`, overridable per user config `{username}_template`.
2. Available templates are those under `quantivia/templates_*` that the user may access via programme group membership.
3. User selects a project (`forms/SelectProject.php`, services for project selection).

Provenance: **Implemented**.

### WF-4 — Define project structure

1. Edit project metadata and PBS/WBS/LBS/OBS codes (`EditProject.php`, `EditProjectCodes.php`).
2. Create deliverables (`createdeliverables.php`, `EditDeliverable.php`, `Deliverables.php`).
3. Define control points and chains (`EditControlPoint.php`, `ChainTable.php`, `createchains.php`).
4. Optionally set budget structures (`SetupBudgetStructure.php`, `InitialBudget.php`, `OriginalBudget.php`).

Provenance: **Implemented**.

### WF-5 — Assign resources and commitments

1. Maintain resources (`Resources.php`, `EditResource.php`, profiles).
2. Link resources to deliverables/chains via commitments (`Add/EditResourceCommitments.php`).
3. Capture actual hours (`ActualHours.php`, `ActualHoursStructure.php`).

Provenance: **Implemented**.

### WF-6 — Progress update and publish

1. Progress views move through statuses defined in `$view_statuses` (Issued → Submitted → Reviewed → Archived / Rejected / …).
2. Graphs and tabular reports (`Graphs.php`, `TabularReport.php`, dashboard widgets) use RAMP or STEP reporting methods.
3. Publish report snapshots (`PublishReport.php`, `PublishReportResults.php`); heavy work can be queued to `offload_tasks`.
4. Notifier can email progress-update stakeholders (template user guides describe this).

Provenance: **Implemented**.

### WF-7 — Change control

1. Budget/schedule/structure mutations recorded via `quantivia_change` and `budget_changes` (`ChangeInstance.php`).
2. Change event types include budget increase/decrease, deliverable add/stop, replan, chain and resource assignment changes.

Provenance: **Implemented**.

### WF-8 — License / QFD bootstrap

1. QFD checks/creates eGroupware schema from `eGw_seed.sql` when needed.
2. License file uploaded/validated; runtime checks MAC + `SERVER_NAME` against license constants.
3. Named development hosts can bypass to a fixed project allowance.

Provenance: **Implemented**.

### WF-9 — Use adjacent eGroupware / ATE apps

Users with those applications enabled may open NCR, permit, risk, SMT, WOMT, actions, calendar, mail, etc. via the eGroupware router. These are separate apps sharing the same install.

Provenance: **Implemented** as apps in tree; whether Quantivia programmes require them is **Unknown**.

## Functional requirements

### FR-001 — Session-gated Quantivia access

**Requirement:** Only a browser with a valid eGroupware session may use Quantivia UI endpoints.

**Evidence:** `quantivia/main.php`, `common_functions.inc.php` session checks.

**Implementation:** Implemented. **Confidence:** High.

### FR-002 — Dual database

**Requirement:** Quantivia project data and eGroupware identity/config data are stored in separately configured databases (or the same SQLite file when configured that way).

**Evidence:** `quantivia_setings.php` `db_*` vs `egw_db_*`; `quantivia_so` PDO usage.

**Implementation:** Implemented. **Confidence:** High.

### FR-003 — Per-project table partitioning

**Requirement:** Each project materialises a set of `p_{id}_*` tables (deliverables, chains, archives, resources, commitments, profiles, published values).

**Evidence:** `confirm_project_tables($p_id)` in SO/BO layer.

**Implementation:** Implemented. **Confidence:** High.

### FR-004 — Deliverable and control-point chains

**Requirement:** Users can define deliverables, attach ordered control-point chains, and track planned/actual/forecast dates and costs per data date.

**Evidence:** forms under `quantivia/forms/`; tables `control_point_chains`, `p_{id}_chains`.

**Implementation:** Implemented. **Confidence:** High.

### FR-005 — Reporting methods and EVM-style metrics

**Requirement:** Projects configure RAMP or STEP reporting; forecasting and EAC methods are selectable (Original Duration / Current Trend / Remaining Duration; Budget Rate / CPI / CPI+SPI variants).

**Evidence:** static maps in `quantivia_bo`.

**Implementation:** Implemented. **Confidence:** High.

### FR-006 — Client programme templates

**Requirement:** Branding, help, and graph colours come from a selected `templates_*` pack; selection is constrained by programme group membership.

**Evidence:** thirteen `templates_*` directories; `services/TemplateSelection.php`; `read_template_options()`.

**Implementation:** Implemented. **Confidence:** High.

### FR-007 — License enforcement

**Requirement:** Unlicensed hosts cannot use full product features; project count and feature flags come from the license; demo mode blocks writes.

**Evidence:** `common_functions.inc.php`, `requireFullLicence()`, demo checks in edit forms.

**Implementation:** Implemented. **Confidence:** High.

### FR-008 — Asynchronous offload

**Requirement:** Long-running import/export/publish/maintenance tasks are queued in `offload_tasks` and executed by worker processes.

**Evidence:** `worker.php` task types 0–15; `TaskMaster.php`; QFD VBS loops.

**Implementation:** Implemented. **Confidence:** High.

### FR-009 — Optional TOTP second factor

**Requirement:** When using `loginextra.php`, password success is followed by RFC 6238 verification before the session remains valid.

**Evidence:** `loginextra.php`.

**Implementation:** Implemented. **Confidence:** High.

### FR-010 — P6 and Excel interchange

**Requirement:** Users can import Primavera P6 schedules and interchange Excel workbooks for bulk data.

**Evidence:** `forms/p6import.php`; PHPExcel under `quantivia/lib/`; file upload wizard forms.

**Implementation:** Implemented. **Confidence:** High.

### FR-011 — Standard eGroupware capabilities

**Requirement:** The install provides eGroupware login, admin, preferences, calendar, addressbook, mail, filemanager, and related GPL apps at the versions shipped in tree.

**Evidence:** app directories with `setup/setup.inc.php`; `phpgwapi` 1.8.004.

**Implementation:** Implemented. **Confidence:** High.

### FR-012 — ATE trackers in the same tree

**Requirement:** NCR, permit, risk, SMT, WOMT, and actions trackers are available as eGroupware applications when enabled.

**Evidence:** each app’s `setup.inc.php` description.

**Implementation:** Implemented as code. Product coupling to Quantivia: **Unknown / Requires Confirmation**.

## Important constraints

- Commercial Quantivia license (not GPL); surrounding eGroupware is GPL.
- Windows-centric file paths and worker scripts appear in default settings (`C:\Code_1_2\...`).
- Version labels disagree across files (see project-plan).
- Security-sensitive defaults are committed (see technical-documentation / business-rules).

## Assumptions (not confirmed)

1. **Assumed:** Quantivia is the primary product of interest for this Silicon Ark onboarding; other EGW apps are platform context.
2. **Assumed:** Client template folder names identify historical Procon8 / Overdrive programme customers.
3. **Not assumed:** Current production connectivity to `online.quantivia.com` or `sdev.quantivia.com`.

## Items requiring human confirmation

1. Production status and owners.
2. Authoritative version and settings file per environment.
3. Whether demo auto-login and SQL admin UIs are still intentionally exposed.
4. Whether ATE apps should be separate Silicon Ark project entries.
5. Whether `Procedures.sql` is part of any live schema.
