This commit expands report generation capabilities to Customer Service (CS) role
and refactors the report system for better maintainability and PDF support.
Changes Summary:
Access Control:
- Extended report access from Lab, Admin, Superuser to include CS role (filter: 0,1,2,4)
- Removed separate CS-only print routes, consolidated into unified report routes
- Routes now support /report/:num, /report/:num/eng, /report/:num/print, /report/:num/print/eng
Controller Refactoring (ReportController):
- Refactored generate() and print() methods to share common renderReport() logic
- Removed separate preview() method - preview now handled via preview parameter
- Added ispdf parameter support for PDF generation mode
- Print functionality now logs audit events to AUDIT_REQUESTS table
Database Queries (ReportHelper):
- Improved SQL queries with explicit aliases for better readability and maintainability
- Fixed date formatting issue: changed date_format() to date() with strtotime()
- Added getValData() method to retrieve validation user information (VAL1USER, VAL2USER)
- Added null coalescing operators (?? '') for safer array access
View Updates (report/template.php):
- Conditional CSS loading: uses pdf.css when ispdf=1, otherwise style.css
- Removed "PREVIEW ONLY - DO NOT PRINT" watermark
- Conditional header/footer images - only display when generating PDF
- Added validation user display: "Val1 By : {user} | Val2 By : {user}"
- Replaced signature placeholder with "This result is valid without signature" statement
- Improved footer layout spacing
Styling Adjustments (public/assets/report/style.css):
- Adjusted margins for better print layout: dinfo (2cm), dresult (17.5cm), footer (2cm)
- Increased footer width from 17cm to 18cm
- Added responsive image classes: .img and .img-footer with max-width: 100%
- Set footer image max-height to 2.5cm
Security:
- Maintained role-based access control with proper authentication checks
- All database queries use parameterized statements (no interpolation)
- Print actions still logged to AUDIT_REQUESTS for audit trail
CodeIgniter 4 Application Starter
What is CodeIgniter?
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure. More information can be found at the official site.
This repository holds a composer-installable app starter. It has been built from the development repository.
More information about the plans for version 4 can be found in CodeIgniter 4 on the forums.
You can read the user guide corresponding to the latest version of the framework.
Installation & updates
composer create-project codeigniter4/appstarter then composer update whenever
there is a new release of the framework.
When updating, check the release notes to see if there are any changes you might need to apply
to your app folder. The affected files can be copied or merged from
vendor/codeigniter4/framework/app.
Setup
Copy env to .env and tailor for your app, specifically the baseURL
and any database settings.
Role-Based Access Control
This application uses role-based access control with four user roles.
User Roles
| Role | Level | Access |
|---|---|---|
| Admin | 1 | All functions |
| Lab | 2 | All functions |
| Phlebo | 3 | Specimen collection, Dashboard |
| CS | 4 | Dashboard |
Feature Categories by Role
Admin
- Dashboard - View all requests with status filters (Pend, Coll, Recv, Inc, Fin, Val)
- User Management - Create, edit, delete users; assign roles
- Request Management - View, validate, unvalidate all requests
- Sample Management - Collect, receive, unreceive samples
- Result Management - Preview and print results
Lab
- Dashboard - View requests with status filters
- Request Validation - Validate/unvalidate requests (2-level validation)
- Sample Management - Collect samples, mark received
- Result Preview - Preview and print results
Phlebo
- Dashboard - View pending collections
- Specimen Collection - Log collected specimens
CS (Customer Service)
- Dashboard - View-only request tracking
- Status Monitoring - Filter by request status
- Patient Inquiry - View request details
Route Prefixes
- Admin:
/admin - Lab:
/lab
Important Change with index.php
index.php is no longer in the root of the project! It has been moved inside the public folder,
for better security and separation of components.
This means that you should configure your web server to "point" to your project's public folder, and not to the project root. A better practice would be to configure a virtual host to point there. A poor practice would be to point your web server to the project root and expect to enter public/..., as the rest of your logic and the framework are exposed.
Please read the user guide for a better explanation of how CI4 works!
Repository Management
We use GitHub issues, in our main repository, to track BUGS and to track approved DEVELOPMENT work packages. We use our forum to provide SUPPORT and to discuss FEATURE REQUESTS.
This repository is a "distribution" one, built by our release preparation script. Problems with it can be raised on our forum, or as issues in the main repository.
Server Requirements
PHP version 8.1 or higher is required, with the following extensions installed:
Warning
- The end of life date for PHP 7.4 was November 28, 2022.
- The end of life date for PHP 8.0 was November 26, 2023.
- If you are still using PHP 7.4 or 8.0, you should upgrade immediately.
- The end of life date for PHP 8.1 will be December 31, 2025.
Additionally, make sure that the following extensions are enabled in your PHP: