# Project plan — promotions

Evidence date: 2026-10-06.

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

Inspected revision: `f06ff39` (2026-08-28, "Merged in #112_Promo-Planner-bugfixes (pull request #1)") on `master`. That commit is `origin/HEAD`.

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

There is no project plan, product README, or requirements document in the repository. `.gitignore` refers to a README that is not in the tree. The statements below are recovered from the ASP.NET Web Forms application, SQL scripts, and Git history.

## Product

The repository holds **RGBC Promotions Module**, an internal ASP.NET Web Forms application (VB.NET, .NET Framework 4.6.2). The page title and heading are "RGBC Promotions Module" / "Promotions Module". The assembly title is `RGBC_Promotions`. Copyright in `AssemblyInfo.vb` is "Copyright © 2012".

Provenance: **Implemented** in `Admin.Master`, `Index.aspx`, and `My Project/AssemblyInfo.vb`.

What **RGBC** expands to is **Unknown / Requires Confirmation**. The logo file is `content/rgbc_logo.jpg`. No about-text in the application defines the organisation.

The module plans and records promotional activities against brands, domestic regions, rep managers, and customer accounts. It reads and writes the SQL Server database **Superbowl**, which also holds company, brand, branch, customer, product, sales, and user tables used by other RGBC systems. A large `Branding.vb` class builds forecast-style quantity-forecast (QF) grids from `dwfSales`. The Home page's call into that report is commented out.

The footer version compiled into the master page is **1.1.0**, dated **17 June 2026**, with a `[Dev]` or `[Live]` suffix from the compile symbol. The assembly version remains `1.0.0.0`. Provenance: **Implemented** in `Admin.Master.vb` and `AssemblyInfo.vb`. Which of those numbers operations treats as the product version is **Unknown / Requires Confirmation**.

## Branch reality

| Branch | Tip | Date | What it is |
|---|---|---|---|
| `master` (`origin/HEAD`) | `f06ff39` | 2026-08-28 | Merged pull request #1 from `#112_Promo-Planner-bugfixes` |
| `#112_Promo-Planner-bugfixes` | `6b06854` | 2026-09-14 | One commit after the merge. Not contained in `master`. |

History that matters for the product, oldest first (abbreviated):

1. `4f6cf88` — 2020-04-14 — maanie — initial commit. The master-page comment above that code says the project started 2012-05-15 (`v0.0.0`) and reached import and audit logging by 2012. Those earlier years are comments, not Git history. Provenance: **Documented** only as comments in `Admin.Master.vb`.
2. 2021 — Lloyd and maanie — rep manager, activity-type filter, import column adjustment, start/end month validation, promotions grid sorting.
3. `6f0b416` — 2025-12-04 — maanie — promotion id label; activity names loaded from the status field.
4. `75662bf` — 2025-11-27 — Activity menu, list, and details; import/export moved from `.xls` to `.xlsx`.
5. 2026-02 to 2026-08 — tags, planning removal commit then continued planning work, security changes, planning save fix, activity and audit-log refactor, pull request #1 merged to `master`.

The onboarding scan (2026-09-28) recorded local `master` at `6f0b416` (2025-12-04). Remote `master` has moved. That scan also listed `sonar-project.properties` and `sonarqube_scan.bat` at the repository root. Neither file is in Git history. Provenance: **Unknown** — they may have been untracked files on the scan host.

`6b06854` (2026-09-14, Renier van Rooyen) is only on `#112_Promo-Planner-bugfixes`. It changes `Import.aspx.vb`, `Promotions.aspx.vb`, and `PagedGridEdit.vb` so blank Excel cells and blank posted grid fields keep the existing database values, and so a promotions-page postback maps form fields by the PromoIDs of the previously bound page. Provenance: **Planned / not on `master`**. Whether that commit should be merged is **Unknown / Requires Confirmation**.

Authors on recent work: Renier van Rooyen (`renier@overdrive.co.za`), maanie (`maanie@overdrive.co.za`), Lloyd (`lloyd@overdrive.co.za`).

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

- Let signed-in RGBC users plan how many promotions a brand activity will run, per domestic region and rep manager, by month.
- Let those users record the account, date, rep, duration, segment, and rep manager on each promotion row.
- Maintain a master list of activities (name, type, brand, channel, active flag, tags) and show each activity as a promotion id `PR` plus a four-digit id.
- Import account, date, and rep updates from `.xlsx`, and export the promotions and planning grids.
- Keep an audit trail of promotion field changes, adds, and deletes.
- Restrict brands, regions, and write actions using user rows stored in Superbowl.

Which of these match a signed-off business brief is **Unknown / Requires Confirmation**. No such brief is in the repository.

## Scope

### In scope of the repository

- Web Forms site under `RGBC Promotions/RGBC Promotions/`: Activity, Activity Details, Planning, Promotions, Import, My Brands, Audit Log, Home, Index (login).
- Shared data access (`db.generic.vb`), session paging (`PagedGridEdit.vb`), audit helper (`ProjectFunctions.WriteLogPromo`), and the `Branding` class.
- SQL scripts that create `promoActivity`, add `dwfPromo.refActivityID`, add `promoActivity.strTags`, and migrate 2025 promotion rows into activities.
- NuGet packages for `.xlsx` (ClosedXML 0.105.0 and its dependencies), `packages.config`.
- `.env.example` for the Superbowl connection string.
- Legacy Team Foundation Server 11 build workflow XAML under `BuildProcessTemplates/`.
- A filesystem publish profile whose output path is a personal desktop folder.

### Out of scope / not in this repository

- The Superbowl database itself. Schema for `dwfPromo`, `mstUser`, `mstBrand`, and the sales tables is only partly described by the SQL scripts. The live schema is **Unknown** beyond what the scripts and queries assume.
- IIS site bindings, the host name, and who deploys the site. `Web.config` comments that the app is served at `/promo_module/` so that `Index.aspx` is the default document. Whether that path is still the production URL is **Unknown / Requires Confirmation**.
- `zSandbox.aspx`. The menu names it and marks it not selectable. The file is not in the tree.
- Automated tests, a Bitbucket pipeline, and a SonarQube project file. None are in Git.
- User provisioning. Users are read from `mstUser`. This application does not create them.

## Architecture (as implemented)

```text
Browser (Windows identity)
  -> IIS, ASP.NET 4.6.2, Web Forms
       Index.aspx looks up Request.LogonUserIdentity in mstUser / mstUserGroupPromotion
       Admin.Master requires Session("USER") and blnView
       Pages query and update Superbowl through db.generic.vb
            promoActivity, promoActivityType, dwfPromo, logPromo
            mstUser, mstUserBrand, mstBrand, mstBranch, mstRepManager
            mstPeriod, mstCompany, mstChannelSegment, dwdCustomer
```

Connection strings are not in `Web.config`. `SecureConfig` reads `RGBC_PROMOTIONS_CONNECTION_STRING_DEBUG` or `RGBC_PROMOTIONS_CONNECTION_STRING_RELEASE` from a `.env` file one directory above the web app, or from the process environment. `.env` is gitignored.

`Web.config` sets `authentication mode="Windows"`. An ASP.NET membership provider is also declared against a connection name `ApplicationServices` that is not defined. `Account/Login.aspx`, `Register.aspx`, `ChangePassword.aspx`, and `Site.Master` are the Visual Studio Web Forms template ("My ASP.NET Application"). They are not linked from `Admin.Master`. Provenance: **Implemented** files. Whether any environment still routes users through `Account/` is **Unknown / Requires Confirmation**.

## Major components

| Component | Role |
|---|---|
| Index | Clears the session and logs the Windows user in against Superbowl |
| Admin master | Menu, version footer, session gate, view-right gate |
| Activity / Activity Details | Activity master data |
| Planning | Monthly promotion counts by rep manager; inserts and deletes `dwfPromo` rows |
| Promotions | Editable list of promotion rows; export; link to import; delete |
| Import | `.xlsx` update of account number, date, and rep |
| Audit Log | Search `logPromo`, export, 5,000-row cap |
| My Brands | Assign brands and a domestic region to a user |
| Branding | Fiscal-year and QF grid helper; also recolours grids |
| SQL scripts | Activity table, tags column, 2025 data migration |

## Milestones visible in the code and Git

These are observed deliveries, not a forward plan.

| When | What landed | Evidence |
|---|---|---|
| 2012 (comments only) | Planning and promo forms, audit log, import | Comments in `Admin.Master.vb` |
| 2015-01-15 (comment) | Duration and rep fields | Comment `v1.0.3` |
| 2020-04-14 | First Git commit | `4f6cf88` |
| 2021 | Rep manager, activity-type filter, month validation | Lloyd / maanie commits |
| 2025-11 to 2026-02 | Activity master, `.xlsx`, promotion id label, tags | `75662bf`, `6f0b416`, `f43ac78`, `DB_Scripts/` |
| 2026-03-27 | Commit message "PLANNING MODULE \| REMOVAL" | `32ffa18`. Planning pages are still in `f06ff39`. What was removed is **Unknown / Requires Confirmation** without a line-by-line read of that commit's intent beyond the message. |
| 2026-04-16 | Commit message "Security Enhancements" | `bbeb55e`. Current code still concatenates SQL and ships `customErrors mode="Off"` with trace page output. |
| 2026-05 to 2026-08 | Planning save fix, activity refactor, audit pagination, pull request #1 | Commits through `f06ff39` |
| 2026-06-17 | Footer version 1.1.0 | `Admin.Master.vb` constant, not a Git tag |
| 2026-09-14 | Blank-cell and postback fixes on a side branch | `6b06854`, not on `master` |

No Git tags were inspected as release markers. `git tag` was not required to see that `origin/HEAD` is `master`.

## Implementation plan

There is no forward implementation plan in the repository.

The database scripts describe an "Item 3" sequence that the application code already assumes:

1. Phase 1 — create `promoActivity`, indexes, and nullable `dwfPromo.refActivityID`. The foreign key to `promoActivity` is present in the script and left commented out.
2. Phase 2 — copy distinct 2025 `dwfPromo` activity combinations into `promoActivity` and backfill `refActivityID`. The script says to back up Superbowl first. Whether Phase 1 and Phase 2 have been applied to each environment is **Unknown / Requires Confirmation**. The application queries `promoActivity` and `promoActivityType` unconditionally.
3. Tags script (2026-02-11) — add `promoActivity.strTags` varchar(500). Activity Details catches a missing column and shows empty tags.

## Known dependencies

- IIS with Windows authentication and ASP.NET 4.6.2.
- SQL Server database Superbowl, integrated security in `.env.example` (example only: localhost). Production server name is **Unknown / Requires Confirmation**.
- Tables owned or shared with the wider RGBC / Superbowl estate: users, brands, branches, customers, periods, company fiscal calendar, channel segments, rep managers.
- ClosedXML for Excel 2007+ workbooks.
- jQuery 1.4.1 and jQuery UI 1.8.6, vendored under `Scripts/` and `Styles/smoothness/`.

## Current project status

`master` at `f06ff39` is a maintained internal web application. Commits continued into August 2026. One later commit remains only on `#112_Promo-Planner-bugfixes`.

Home is an empty fieldset. The forecast report that `Branding.vb` can build is not shown.

Deployment is a local filesystem publish profile (`C:\Users\PJ\Desktop\pm`) plus unused-looking TFS 11 XAML templates. There is no pipeline in the repository. How the live site at `/promo_module/` is updated is **Unknown / Requires Confirmation**.

## Human confirmation

- Expansion of RGBC, and the production URL and host.
- Whether Phase 1, Phase 2, and the tags script have been applied to each Superbowl database, and whether the commented foreign key should be created.
- What user-group ids 4, 5, 6, and 7 are named in `mstUserGroupPromotion`. Two code comments disagree (see business rules).
- Whether `6b06854` should be merged.
- Whether `sonar-project.properties` and `sonarqube_scan.bat` on the 2026-09-28 scan host should be added to Git or ignored.
- Who deploys, and whether the TFS build templates or the `PJ` desktop publish path are still used.
