# Dadi Jan Sales — PHP 8.3 Migration

This package preserves the existing application routes, page layout, business
rules, database table names, reports, and branded PDF presentation while
updating the runtime compatibility and supported dependencies.

## Runtime requirements

- PHP 8.3.x
- MariaDB 10.6+ or MySQL 8.0+
- PHP extensions: `mysqli`, `fileinfo`, `gd`, `mbstring`, `iconv`, `zlib`,
  `openssl`, `session`, and `json`
- Apache 2.4 with `mod_rewrite`, `mod_headers`, and `.htaccess` overrides, or
  equivalent Nginx rules

## Configuration before deployment

1. Rotate the former database, hosting, FTP/SFTP, SMTP, and administrator
   credentials. The legacy archive contained production credentials.
2. Copy `classes/config.local.inc.php.example` to
   `classes/config.local.inc.php`.
3. Enter the newly rotated database and SMTP values in the local file, or set
   the corresponding server environment variables.
4. Keep `config.local.inc.php` outside source control and exclude it from
   future support ZIP files.
5. Confirm that `admin/employeepics` and `admin/product_wording` are writable
   by PHP but cannot execute scripts.

## Dependency versions

| Component | Migrated version | Compatibility decision |
| --- | ---: | --- |
| PHP | 8.3 | Target runtime |
| PHPMailer | 7.1.1 | Compatibility aliases preserve legacy calls |
| FPDF | 1.86 | Existing logo headers and page footers retained |
| jQuery | 3.7.1 | jQuery Migrate 3.4.1 included for legacy plugins |
| Bootstrap | 3.4.1 | Latest Bootstrap 3 release preserves theme markup |
| DataTables | 1.13.11 | Latest 1.x API-compatible release |
| Chart.js | 2.9.4 | Latest 2.x API-compatible release |
| Materialize theme | Existing customized build | Retained to prevent visual/markup changes |

Major UI upgrades such as Bootstrap 5, Materialize 1.x, DataTables 2.x, or
Chart.js 4.x were intentionally not applied because they require markup and API
changes and would violate the requirement to preserve the current design.

## Malware cleanup

The five obfuscated `index.php` loaders were removed from `bucket-ico-fonts`,
`classes`, `css`, `fpdf`, and `js`. The archive does not contain the referenced
hidden disguised payload, but that payload must also be removed from the live
server's `sales-old/css` directory and from any other hosting paths.

The public `phpinfo.php`, PHPMailer development tests, obsolete fake mail/POP
shell scripts, DataTables unit tests, and unused legacy jQuery copies were also
excluded from this production package.

## Database validation scope

The supplied SQL dump contains 38 core tables and matches the export system's
main invoice, payment, stock, production, attendance, salary, customer, and
reporting models. It does not contain `employee_mart`, `loan_mart`, or
`salary_mart`; those modules require a newer database backup for complete
database-backed regression testing.

## Deployment sequence

1. Deploy to a password-protected staging subdomain.
2. Import a copy of the current production database.
3. Configure the new credentials.
4. Test login, user permissions, customers, products, purchases, invoices,
   payments, refunds, stock, production, attendance, loans, salary, reports,
   PDF output, and email delivery.
5. Check PHP and web-server logs with `display_errors=Off` and
   `log_errors=On`.
6. Switch production only after the staging checklist passes.
