# MEGA™ Municipal Risk Management v1.7 — User-Friendly Errors

## Changes
- Fixed a **confirmed blocking defect** after planning import: `note('bulk_import','planning',null,...)` sent `null` to the audit function's integer ID parameter. The audit ID is now `0` for catalogue-level imports.
- Added reusable premium-styled error, warning and success cards with understandable headings, next steps, accessible status semantics, and dismiss controls.
- Removed direct presentation of PHP method names, SQL errors, file paths and stack traces from handled errors; technical details are sent to the PHP server log under a reference such as `MEGA-1234ABCD`.
- Friendly Excel upload, validation (sheet / row / code), session, permission, login, workshop voting and record-not-found messages.
- Replaced misleading duplicate-vote feedback for unrelated database failures with a safe message.
- Updated stylesheet and script cache-busting versions to 1.7.0.

## Verification and limitations
| Test | Result |
| --- | --- |
| PHP syntax for feedback, bootstrap, app and installer | Passed (see local checks) |
| JavaScript parsing | Passed |
| Previous invalid `note()` argument eliminated | Passed (static inspection) |
| Plain-language message mapping and HTML escaping | Passed (CLI fixture tests) |
| Original `app/config.php` byte-for-byte unchanged | Passed (SHA-256 comparison) |
| Full package integrity | Passed (`unzip -t`) |
| Live MySQL planning import on Afrihost | **Not tested** — run on staging |
| Workshop concurrency and operational security | **Not certified** |

**Important:** Deploy to staging first. This release corrects the identified import audit error but cannot guarantee that a different server/database error will not be encountered during live import; such a failure will now have a support reference rather than showing technical details.

## Afrihost update
1. Back up the current MEGA application and database.
2. Extract the **complete** v1.7 package to your MEGA directory. Copy its application files over the old version, **without overwriting the server's `app/config.php`**.
3. Ensure `app/feedback.php`, `public/index.php`, `public/style.css`, `public/app.js` and `app/bootstrap.php` are present. These are all needed for the new message system.
4. Do **not** rerun `install.php` on an existing installation; delete any copy left online. Retain your current database and user accounts.
5. Hard-refresh the page and reupload the GTM planning workbook. A successful import displays a confirmation, while validation issues provide sheet/row guidance.
6. If MEGA displays a support reference, share that reference only with the administrator, who can locate details in the Afrihost PHP error log. Do not share database passwords.

The installer now also uses MEGA's styled forms and safe plain-language notices. Development tests under `tests/` are blocked from HTTP requests via `.htaccess`.
