# Project plan — convergence_production (Convergence 2017)

Evidence date: 2026-10-18.

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

Inspected revision: `master` at `a91a555` (2021-06-15, Lloyd Sherewa, "Import live tables"). The scan-host path `~/projects/sonar_scan/repos/convergence_production` was not on this machine. The tree was read from that git revision.

Git history on `master` is 14 commits, all by Lloyd Sherewa, from `189dcdf` (2021-06-11, "initial commit") through `a91a555`. Every message is an import or a column add (`import`, `added import kpa`, `added SLA Column`, `Import live tables`). Dated comments inside the PHP files run from 2010 (SMS helper) through 2019 (performance reviews and opportunities). Provenance: the application behaviour was written before this repository existed. This git history records a 2021 import, not the original development timeline.

There is no README, product plan, or prior Silicon Ark directory for this project. This plan describes what the repository contains. It does not decide what the product should become.

Credentials are hardcoded in `system.php` and in a SQL comment inside `emailscry/classes/class.MailFetch.php`. They are not copied into this document.

## Product

Convergence is Silicon Overdrive’s internal operations system, branded in the shell as Silicon Overdrive and addressed in email subjects as "Convergence".

The live host named in configuration is `convergence.overdrive.co.za`. The primary database name is `convergence_2017`. A second database, `convergence_2017_aux`, holds email rows. The under-construction page tells visitors to write to `helpdesk@overdrive.co.za`.

Provenance: **Implemented** in `system.php`, `layouts/layout.back.incl.php`, `cron.hourly.php`, `under.construction.php`, and `cron.email.scry.php`. There is no product requirements document in the repository.

**Unknown / Requires Confirmation:** whether Convergence was still the live helpdesk and HR system after the June 2021 import, and which client organisation it served besides Silicon Overdrive staff.

## Branch reality

| Line | Tip | Date | What it is |
|---|---|---|---|
| `master` (default; `origin/HEAD`) | `a91a555` | 2021-06-15 | Only branch. Fourteen import commits, 11–15 June 2021 |

No `develop` branch, release tag, or pipeline file is in the tree.

## Objectives (inferred from the implementation, not from a written plan)

- Sign staff in and show a menu limited by security group.
- Run a client helpdesk: clients, sites, contacts, tickets, tasks, SLAs, a calendar, and time logged against work.
- Turn inbound helpdesk email into tickets.
- Quote work (proposals, products, bundles, payment terms) and turn an accepted proposal into tickets and tasks.
- Run HR: leave, public holidays, roles, KPAs, KPIs, performance reviews, and a review wizard.
- Keep training courses, materials, and certificates.
- Record client servers and software updates.
- Email reminders and notifications from scheduled PHP pages.
- Watch the application files for unexpected changes (FIM).

## Scope

### In scope of `master`

1. The Nemo PHP framework under `_framework/`.
2. Page controllers at the repository root (`ticket.php`, `client.php`, `hr.leave.application.php`, and the other `*.php` pages).
3. Entity classes under `includes/`.
4. Layouts, CSS, JavaScript, images, and the `vendors/` admin-theme libraries.
5. Cron entry points: daily, hourly, SLA ticket creation, email scry, and FIM.
6. PDF (mPDF) and Excel (PHPExcel) libraries, including dated copies from 15 March 2021.
7. Uploaded training-certificate files under `edulab/training_certificates/`.

### Out of scope of this repository

- The MySQL schema and the live rows. Tables are named in PHP. There is no `.sql` dump.
- The menu labels and security-group matrix. Those live in `sysMenuLevel1`, `sysMenuLevel2`, `sysSecurity`, and `sysSecurityGroup`.
- The web-server cron schedule. The PHP pages exist. Crontab entries do not.
- A mobile app, public API, or automated test suite.

## System architecture

```text
Browser
  │
  ├─ login.php          (NemoBasic — no session required)
  ├─ ticket.ops.php     (client authorize / decline — no session required)
  ├─ under.construction.php
  │
  └─ *.php pages        (Nemo — session required)
        ├─ layouts/layout.back.incl.php
        ├─ includes/*.cls.php
        └─ _framework/  (Nemo list, details, menu, email, audit)

MySQL  convergence_2017       clients, tickets, HR, proposals, users, settings
MySQL  convergence_2017_aux   tblEmail and email templates (switchBD)

PHP mail()                    outbound mail
Office 365 mailbox            inbound helpdesk mail (Email Scry)
mymobileapi.com               SMS (SendSMS)
mPDF / PHPExcel               proposal PDFs and report exports
```

Environment selection is the HTTP `SERVER_NAME`:

| Key | Role in `system.php` | Database |
|---|---|---|
| `debian` | Comment "DEV REPO". Local host `192.168.100.6` | `convergence_2017` |
| `lamp` | Comment "DEV QA", then "20180806 - Change lamp to use live db" | `convergence_2017` on the hosted MySQL server |
| `convergence.overdrive.co.za` | Comment "LIVE PROD" | `convergence_2017` on the same hosted MySQL server |

`www.convergence.overdrive.co.za` and a null `SERVER_NAME` are rewritten to `convergence.overdrive.co.za` before the connection is opened. A cron or CLI run with an empty server name therefore uses the live settings. Provenance: **Implemented** in `system.php`.

## Major components

| Component | Where | Role |
|---|---|---|
| Nemo | `_framework/_nemo.cls.php` and siblings | Page shell, session gate, toolbar, filters, paging |
| NemoDatabase | `_framework/_nemo.database2.cls.php` | Active data-access class (mysqli). Included from `system.functions.inc.php` |
| NemoDatabase (old) | `_framework/_nemo.database.cls.php` | Older `mysql_*` class. Not the one included by `system.functions.inc.php` |
| Menu and security | `sysMenuLevel1`, `sysMenuLevel2`, `sysSecurity` | Database-driven menu and view/save/delete/new/special flags |
| Helpdesk | `ticket.php`, `task.php`, `sla.*.php`, `schedule.php`, `time.php` | Tickets, tasks, SLA schedules, calendar, time |
| CRM | `client.php`, `contact.php`, `supplier.php`, `proposal.php`, `product.php` | Clients, contacts, quotes, catalogue |
| HR | `hr.*.php` | Leave, holidays, roles, KPAs, KPIs, reviews |
| Education | `edu.training.*.php`, `edulab/` | Courses, materials, certificates, uploaded files |
| Servers | `so.server.php`, `so.update.php` | Client servers and software updates |
| Mail | `_framework/_nemo.email.cls.php`, `emailscry/` | Send with `mail()`, fetch helpdesk mail |
| Jobs | `cron.*.php` | Reminders, SLA materialisation, mailbox import, file integrity |
| Reports | `report.console.php` | Project summary and HR leave reports |

## Milestones visible in comments

These are comment dates, not git tags.

| Period | What the comments record |
|---|---|
| 2010-12 | SMS helper (`SendSMS`) |
| 2014-11 | mysqli database class |
| 2016-09 | Password policy (`sysPassword`) |
| 2017-01 to 2017-03 | Login revamp, security groups, no more guest users |
| 2017-06 | SLA cron that creates tickets |
| 2017-11 | Hetzner credential reset (comment in `system.php`) |
| 2018-02 | Email Scry, hourly notifications, aux database |
| 2018-08 | `lamp` pointed at the live database; UTF-8 |
| 2018-09 to 2018-12 | Leave workflow, reports, servers and updates |
| 2019-01 | Ticket complete and archive |
| 2019-03 to 2019-12 | Performance reviews and 360 reviewers |
| 2021-03-15 | Dated copies of PHPExcel, mPDF, and some framework files |
| 2021-06-11 to 2021-06-15 | This git repository: import commits only |

## Implementation plan

There is no written plan in the repository. The shape of the code is a single PHP application deployed as a document root, with behaviour extended by adding a root `*.php` page, an `includes/*.cls.php` class, and menu rows in MySQL.

## Known dependencies

- PHP with the mysqli extension. The active database class is mysqli. The unused `_nemo.database.cls.php` still calls `mysql_*`.
- MySQL databases `convergence_2017` and `convergence_2017_aux` on `sql45.jnb1.host-h.net` for the `lamp` and live keys.
- PHP `mail()` for outbound email.
- An Office 365 mailbox for Email Scry. The fetch comment names `helpdesk@overdrive.co.za` as the To/Cc filter.
- `http://www.mymobileapi.com/api5/http5.aspx` for SMS. Credentials are `sysSettings` keys, not in this document.
- Apache-style rewrites, but the rewrite file is named `.htaccesss` (extra `s`). See the discrepancy below.
- Browser libraries under `vendors/` (Bootstrap, jQuery, DataTables, FullCalendar, Select2, and others).

## Current project status

**Implemented** as a snapshot imported in June 2021. No commit after `a91a555`. No test suite, no dependency manifest, no pipeline, no README.

**Unknown / Requires Confirmation:** whether the hosted site is still served from this tree, and whether the menu in the live database still matches these page files.

## Discrepancies

1. **Page permission bypass.** `Nemo::iniSecurity()` loads `blnView` from `sysSecurity`, then sets the current page’s `blnView` to `1`. The comment says this was added for testing (2017-01-10). The menu still hides items the group cannot view. A direct URL is not refused by this check.
2. **`lamp` uses the live database.** The 2018-08-06 comment says the QA key was pointed at the hosted live database.
3. **Rewrite file name.** The HTTP-to-HTTPS rule is in `.htaccesss`, not `.htaccess`. Apache will not load the extra-`s` name unless the server is configured to.
4. **Opportunity screens are not a data module.** `opportunity1.cls.php` and `opportunity2.cls.php` return a fixed HTML table. `opportunity.php` is an older copy of `ticket.php` (it includes `includes/ticket.cls.php` and stops at the 2018-09-03 comment; `ticket.php` continues to 2019-01-17).
5. **Parallel copies.** Several pages exist as `.pj.php`, `.russel.php`, `.bak`, `.backup`, or a `20210315` dated file. Which file the menu opens is stored in the database and was not in git.
6. **Task-creation file list.** The issue listed the same root names this revision contains. No missing-file discrepancy of the kind seen on other imports.
