# Project plan — clientModule

Evidence date: 2026-10-18.

Source repository: `git@bitbucket.org:overdrive/clientmodule.git`.

Inspected revision: `master` at `aa88a34` (2019-06-24, TrevorMararike, "can not update directly from php"). The scan-host path `~/projects/sonar_scan/repos/clientModule` was not on this machine. The tree below was read from that git revision. Database passwords committed in `dbconnection.php` and `insertClient.php` are omitted.

This plan describes what the repository contains. It does not decide what the product should become.

## Product

The README titles the work **Unity : clientModule**. It is a PHP and MySQL exercise that collects a client on an HTML form, inserts a row, and lists rows. The only product description in git is `README.md`. There is no separate plan, ticket export, or Silicon Ark set before this one.

Provenance: the three-phase list is **Documented** in `README.md`. The form, insert, and list are **Implemented** in the files on `master`. The word "Unity" is not used anywhere except that README heading. Whether clientModule belongs to a larger product named Unity is **Unknown / Requires Confirmation**.

## Branch reality

| Line | Tip | Date | What it is |
|---|---|---|---|
| `master` (default; `origin/HEAD`) | `aa88a34` | 2019-06-24 | Only branch. 36 commits from 2019-06-11 to 2019-06-24 |

No other local or remote branches were present at inspection. Nothing in git is dated after 2019-06-24. Whether anyone still runs this application is **Unknown / Requires Confirmation**.

Authors on the commits:

- Jaco Brits (`jaco@overdrive.co.za`) — initial commit (`fd5f4a9`) and an early style pass (`3dca93f`), 2019-06-11.
- `SILICONOVERDRIV\pieter` (`pj@overdrive.co.za`) — README wording and the Smart Admin template, 2019-06-11.
- Trevor Mararike — the application. Commit author strings are `Trevor Mararike` and `TrevorMararike`, both `trevor@overdrive.co.za`.

Commit `4e41169` says the stylesheet link and the move to mysqli were "as per Gael Trello tasks" (`#180`). Gael is not a commit author. Commit `5770d86` says Trevor tried Bootstrap with Banele. Banele is not a commit author on this repository.

Commit subjects cite `#160` on most early work, and mention `#161`, `#173`, and `#180`. Only `#180` is tied to a tracker name (Trello) in a commit message. The board those numbers belong to is not in the repository. **Unknown / Requires Confirmation.**

One pull request is named in history: `e3121e4` merged `Trevor-Mararike/stylecss-edited-online-with-bitbucket-1560817470653` (pull request #1) on 2019-06-19. It changed `style.css`.

## Objectives (from the README, not from a later decision)

`README.md` splits the work into three phases:

1. A client form (first name, last name, 13-digit ID number, male or female, client type SLA-Software / SLA-AWS / Technical, submit, cancel), validation, a MySQL database and client table, and a post of the ID number only into a PHP file under an `api` directory. The table is described with `per_id` (auto-increment) and `per_date_created`.
2. An HTML/JS table of all clients. Clicking a row edits and saves that client.
3. A separate table of client types: add a type, archive a type, and link the type to the client module.

The README ends with one note: "Theme include in template". There is no login phase.

## Scope

### In scope of `master`

1. `formClient.html` — the client form, inline `showInput()`, link to `style.css`.
2. `insertClient.php` — its own mysqli connection and a prepared insert into `tbl_client`.
3. `displayClient.php` — `SELECT * FROM tbl_client` rendered as an HTML table, with links to the form and to `editClient.php`.
4. `editClient.php` — includes the display page. The update query is commented out.
5. Shared include `dbconnection.php` and helper `projectfunctions.php` (`print_rr`). The insert page does not include them.
6. `style.css`, linked by the form, the list, and the edit page.
7. `README.md` as the phase list.
8. A vendored Smart Admin 2.0 HTML theme under `template/` (415 tracked files). The application pages do not load it.

423 files are tracked. Eight of them sit at the repository root. The rest are the template.

### Out of scope / not in this repository

- A `CREATE TABLE` script, migration, or dump. The live column types, keys, and defaults are **Unknown**.
- An `api/` directory. Phase 1 asks for one. It does not appear in git history.
- A client-type table, archive action, or admin UI for types. Phase 3 is not started. An earlier insert targeted `clienttype` and then `tbltype` (2019-06-20 to 2019-06-21). Those statements are not at HEAD.
- Sessions, login, role checks, email delivery, queues, workers, tests, Docker, and a Bitbucket pipeline.
- `index.html` and `formClient.php`. Both were committed and later deleted (`8e401a8`, `6352b3f`).
- `sonar-project.properties` and `sonarqube_scan.bat`. The onboarding scan listed both at the repository root. Neither file is in git history. Provenance: **Unknown** — they may have been untracked files on the scan host.

## What landed against the README

| README phase | What `master` contains |
|---|---|
| Phase 1 form and validation | `formClient.html` exists and is wider than the README: date of birth and an "account active" checkbox were added. HTML `required` covers ID, date of birth, and type. `showInput()` alerts on empty or numeric names, a non-13-digit ID, and an empty date. The submit button calls `showInput()` and does not return its result, so a failed check does not cancel the POST by itself. The server stores the posted strings and does not repeat those checks. |
| Phase 1 "GET the fields and only POST the ID to `api/`" | Not implemented. The form `method` is `post` and `action` is `insertClient.php` at the repository root. Every field is inserted. |
| Phase 1 MySQL table `per_id`, `per_date_created` | The PHP expects database `db_clientmodule` and table `tbl_client` with `str_fname`, `str_lname`, `str_idNum`, `str_dob`, `str_gender`, `str_type`, `str_status`, plus list columns `int_ID` and `tms_dateCreated`. The insert does not write `int_ID` or `tms_dateCreated`. No schema file confirms types, keys, or defaults. |
| Phase 1 Cancel | The form has `type="reset"` labelled "Clear". There is no Cancel control. |
| Phase 2 list, click, edit, save | `displayClient.php` lists every row. The edit link is `editClient.php` with the id as link text and no query string. The row-click script reads `getElementById('tbl')` while the table id is `tblClient`. `editClient.php` does not run an update. Commit `aa88a34` is titled "can not update directly from php". |
| Phase 3 type catalogue | Not implemented. Three type labels are hardcoded `<option>` elements. |
| Theme in `template` | The theme is in git. Application pages link `style.css` only. |

## System architecture

```text
Browser
  |  formClient.html (inline showInput, style.css)
  |  displayClient.php and editClient.php (style.css)
  v
insertClient.php          displayClient.php
  |  own mysqli copy         |  include dbconnection.php
  |                          |       include projectfunctions.php (print_rr, call commented out)
  v                          v
MySQL database db_clientmodule, table tbl_client
```

`editClient.php` includes `dbconnection.php` and then `displayClient.php`, so opening the edit URL renders the list and then a second HTML document. `template/` is a separate static Smart Admin 2.0 site. Nothing in the application files links to `template/`.

Host selection is a `switch` on `$_SERVER["SERVER_NAME"]`. `localhost` uses host `localhost`. The `lamp` case is also the `default`, so every other server name uses host `lamp`. Both branches set user `root`, database `db_clientmodule`, and a non-empty password. The same switch is copied in `insertClient.php`.

## Major components

| Component | Role | Evidence |
|---|---|---|
| `README.md` | Phase 1–3 task list and the "Unity : clientModule" title | Only product document |
| `formClient.html` | Create form and client-side checks | Posts to `insertClient.php` |
| `insertClient.php` | Prepared insert and a text echo of the posted values | Does not include `dbconnection.php` |
| `displayClient.php` | List every `tbl_client` row | Edit link does not pass an id |
| `editClient.php` | Intended update page | Update SQL is commented out. Includes the list page |
| `dbconnection.php` | mysqli connection by server name | Used by the list and the edit page. Prints "connection successful" on success |
| `projectfunctions.php` | `print_rr` | Included from `dbconnection.php`. The only call is commented out |
| `style.css` | Layout for the form, list, and edit page | Padding last changed in `978e733` |
| `template/` | Smart Admin 2.0 demo pages and assets | Added in `278eb93` |

## Milestones

No milestone plan is written beyond the README phases. The commits are the timeline:

| Date | What landed |
|---|---|
| 2019-06-11 | `fd5f4a9` Jaco Brits, Bitbucket tutorial README. `5258419` Pieter rewrote the README into the three phases. `278eb93` added the Smart Admin template (`#160`). `3dca93f` style pass. `ba782c7` first HTML form |
| 2019-06-12 to 2019-06-14 | Field-by-field validation on `index.html` (`#160`). `formClient.php` added beside it (`cf33369`). External `style.css` and mysqli preferred over `mysql_*` (`4e41169`, `#180`, "Gael Trello tasks") |
| 2019-06-18 to 2019-06-19 | `formClient.html` chosen for a code review (`f40b567`). `index.html` deleted (`8e401a8`). Pull request #1 merged stylesheet edits |
| 2019-06-20 to 2019-06-21 | `projectfunctions.php`. Insert into `clienttype`, then `tbltype`, database name moved from `client_module` to `db_clientmodule` |
| 2019-06-24 | `formClient.php` deleted (`6352b3f`). Insert retargeted to `tbl_client` with name, id, date of birth, and gender (`eb0b3d4`). `displayClient.php` lists rows (`cdc9100`). HEAD `aa88a34` adds `editClient.php` and records that update from PHP was not achieved |

## Known dependencies

- PHP with the `mysqli` extension. No `composer.json` and no pinned PHP version.
- MySQL (or MariaDB — the code only shows `mysqli`) with a database named `db_clientmodule` and a table named `tbl_client` whose columns match the insert and the list.
- For `SERVER_NAME` `localhost`: host `localhost`, user `root`, database `db_clientmodule`, and a non-empty password stored in `dbconnection.php` and again in `insertClient.php`. The value is omitted from this document.
- For every other `SERVER_NAME`, including `lamp`: host `lamp`, user `root`, database `db_clientmodule`, and a different non-empty password stored in the same two files. The value is omitted from this document.
- A browser. The application pages do not load a CDN. The unused theme under `template/` carries its own vendor bundles.
- The Smart Admin files are already in git. They are not loaded by the application pages.

## Current project status

**Implemented** on `master`: a client form, client-side checks that do not block submit on their own, a prepared insert of seven columns, an echo of the posted values, and a list of `tbl_client`.

**Documented and not built:** `api/` post of the ID only, a Cancel button, edit-and-save, and a client-type table with add and archive.

**Present and unused by the screens:** `template/`, and `print_rr` (defined, call commented out).

**Removed during June 2019:** `index.html`, `formClient.php`, and inserts into `clienttype` and `tbltype`.

**No automated tests, no pipeline, no deploy config.**

## Human review

- Confirm whether "Unity" is a product name or only a README heading.
- Confirm the live `tbl_client` definition, including whether `int_ID` and `tms_dateCreated` are generated by the database. Neither is in git.
- Confirm whether Phase 2 edit/save and Phase 3 are still wanted. The last commit says update from PHP could not be done.
- Confirm whether the committed database passwords, duplicated in two PHP files, are accepted or should be rotated. The values are omitted here.
- Confirm whether `sonar-project.properties` and `sonarqube_scan.bat` from the scan host should be treated as part of this project.
- Confirm which tracker issued `#160`, `#161`, `#173`, and `#180`.
- Confirm whether this module is still deployed. The last commit is 2019-06-24.
