# DEPLOY — 5 September 2026

Two pieces of work. **No new table, no new column.** The migration below is a
proof-and-settings run, not a schema change.

---

## 1 · NEW FILES — upload these

| File | What it is |
|---|---|
| `includes/kyc_checkout.php` | The checkout-KYC engine: what the basket needs, the form, the save, the lock |
| `includes/pipeline.php` | The activity pipeline — the four steps, the KYC desk, per-person access |
| `kycsmsmigration.php` | **root** — run once in a browser, then delete |

## 2 · MODIFIED FILES — replace these

| File | What changed |
|---|---|
| `includes/shares.php` | Admin approval is no longer a purchase gate; the gate now reports `collect` |
| `includes/kyc.php` | A saved KYC line can never be re-edited by the member; name / email / phone are written from the account |
| `includes/sms.php` | Reads the gateway's reply whatever its shape; new `sms_dlr()` delivery check |
| `checkout.php` | Verification form on step 1, contact boxes locked, KYC saved before the order is placed |
| `category.php` | Buy Now instead of "KYC Required" — it goes to the checkout page |
| `product.php` | Same, plus an amber note that details will be asked at checkout |
| `cart.php` | Missing KYC no longer blocks the basket |
| `kyc_extra.php` | An answered extra question is locked |
| `admin/sms_settings.php` | The approved-DLT-wording button, and the delivery-report check |
| `register.php` | The User ID / referral card is no longer shown on the success screen |
| `admin/activity_task.php` | **Rewritten** — the pipeline screen. The old 1572-line page is in `_to_delete/activity_task.php.old.bak` |
| `admin/includes/sidebar.php` | Activity & Task now lists All Tasks and KYC Requests; Matching People and Task Criteria are off the menu |

## 3 · DO NOT UPLOAD

`smsconfig.php` was a one-time local tool. It has been moved to
`_to_delete/smsconfig.php.bak`. Everything it did now lives on the admin screen,
behind the admin login and the `website.sms` permission.

---

## 4 · ORDER OF DEPLOYMENT

1. Upload the two new files and the nine modified ones.
2. Open **`https://wbmcz.online/kycsmsmigration.php`** — it should say
   *Migration completed successfully*.
3. **Delete `kycsmsmigration.php` from the server.**
4. Open **Admin → Website Settings → SMS & OTP**, press **Send a test SMS**.
5. As a member, buy one KYC-gated service and check the verification form on the
   checkout page.

---

---

## 4b · ACTIVITY & TASK — PHASE 1

The old screen asked an administrator to write criteria, look at "matching
people", and hand out tasks by hand. The new one is a line with four steps and
one desk:

    Lead  ->  KYC  ->  Refer
                   ->  Order          plus the KYC Pending Request desk

**Nobody moves anybody along.** The goal of a step is a fact about the member —
subscribed, KYC approved, has a referral, has an order — so the moment that fact
becomes true the step completes itself and the next one opens. A member who
subscribes leaves Lead on their own; a KYC that is approved opens Refer and
Order together.

**Staff record an outcome, not a status.** Interested · Follow up (with a date
and a remark) · Free user · Not interested. Dropping somebody needs a reason,
and a follow-up needs a date, or it is only a note.

**Two things float to the top by themselves** — a call-back due today or
overdue, and somebody nobody has been given yet.

**Not interested** leaves the list but is still counted on the tile above it,
and one click brings those rows back.

**Access is per person.** A tick opens one step for one member of staff, set
either while handing work over or from **Team access** in the header. Within a
step they still only see the people they hold. The owner account holds
everything.

**Where the rows come from.** Nothing is imported. A pass over `users` opens
every step that should be open and closes every one that has got what it wanted;
it runs when somebody opens the screen (at most once a minute) and on
**Refresh the line**. Up to 300 people are seeded per pass, so a first fill of a
large member list settles over a few page loads.

Sellers, Products, Support, Wallet, Payout and General are Phase 2.

---

## 5 · WHAT THE MIGRATION DOES

It checks, it sets, and for the pipeline it adds.

**Adds, for the pipeline** — `tasks.outcome`, `tasks.outcome_at`,
`users.task_access` and the small `pipe_reviews` table (accept / hold / reject
decisions), then fills the line for the first time.

**Checks** — that all the files are actually on the server; that
`kyc_details`, `kyc_custom_fields`, `kyc_custom_values`, `otp_codes` and
`sms_log` exist; that all forty columns the checkout form writes to are present
(and adds any that a very old database happens to be missing); that
`uploads/kyc/` and `uploads/kyc_extra/` exist and are writable.

**Sets** — the SMS settings that turn the OTP on:

| Setting | What it does | When it is left alone |
|---|---|---|
| `sms_sender_id` | `GUERAR` | if you have already put a header in |
| `sms_tpl_otp_register` | the approved DLT wording | if you have your own wording there |
| `sms_tpl_otp_reset` | the approved DLT wording | same |
| `sms_welcome_enabled` | `0` — it has no approved template, so it would be billed and dropped | if already off |
| `sms_enabled` | `1` | if already on |
| `sms_test_mode` | `0` | only switched off once the gateway details are complete |

Every decision is printed with its reason. Running it twice changes nothing the
second time.

---

## 6 · WHAT MEMBERS WILL NOTICE

* No more orange **KYC Required** button. Every product a member can buy in their
  area shows **Buy Now**.
* On the checkout page, name / mobile / email are shown greyed out with a lock —
  they are the ones from registration and support has to change them.
* Under them, a **Verification details** block asks for whatever that service
  still needs, grouped the way the KYC wizard groups it. Lines already on the
  record show greyed with *saved*.
* They cannot reach the payment step until every box is filled, so nothing is
  ever charged for an order that would then be rejected.
* After paying, those lines are locked everywhere — on the checkout page, on
  `profile.php#kyc`, and on `kyc_extra.php`. Only the office can correct them.
* Buying no longer waits for an admin to approve the KYC. Admin → KYC Pending
  still shows every submission.
* Service-area blocking is untouched.
* The success screen after signing up no longer shows the User ID as a referral
  code. Referring only pays once a subscription is taken, so handing somebody the
  code the moment they join invites them to share something that earns them
  nothing yet. The ID is unchanged and still on the dashboard and on Refer & Earn.

---

## 7 · STILL OPEN

The OTP text ends with *"This SMS has been sent from GuestRAR"* — that is the
reseller's brand, and members will read it. Sending under your own name needs
your own DLT entity, your own header and your own approved templates. No code
changes for that: only the Sender ID box and the two template boxes on the
admin screen.
