Technical Documentation v1.0.0 WHMCS 9.1.x · PHP 8.2–8.4

Haikhavan Project Management & Feedback Hub

Complete architecture reference, installation guide, database schema, hooks, and troubleshooting.

Quick Installation

  1. Purchase the module and download haikhavan_project_management-ioncube-8.2-1.0.0-install.zip from your VPSrv Client Area Downloads.
  2. Upload and extract the ZIP into your WHMCS root directory so files land in modules/addons/haikhavan_project_management/.
  3. Verify PHP 8.2–8.4 with ionCube PHP Loader 14+ / 15.5+ is enabled on your server.
  4. Go to System Settings → Addon Modules in WHMCS Admin, click Activate next to Haikhavan Project Management & Feedback Hub, and assign administrator role access.

Complete client project delivery, Kanban task boards, live Start/Stop billable time tracking with 1-click WHMCS invoicing (localAPI('CreateInvoice')), Quote-to-Project automation, Client Milestone Approvals, Product Feedback Roadmap voting, and zero-CDN Canvas budget burn-rate & profitability analytics.


Haikhavan Project Management & Feedback Hub — Technical Documentation (v1.0.0)

Architecture, 8-table database schema, Quote-to-Project & Time-to-Invoice automation flows, WHMCS hooks, AJAX API specification, and security controls for haikhavan_project_management.


1. Architecture & File Inventory

modules/addons/haikhavan_project_management/
├── haikhavan_project_management.php     # WHMCS addon lifecycle (_config, _activate, _deactivate, _upgrade, _output, _clientarea)
├── hooks.php                      # 5 WHMCS hooks (ClientAreaPrimaryNavbar, QuoteStatusChange, InvoicePaid, AdminAreaClientSummaryPage, AdminHomeWidgets)
├── whmcs.json                     # Marketplace manifest (schema 1.0)
├── lib/
│   ├── Database.php               # 8-table Capsule schema DDL, settings loader & sample data seeder
│   ├── ProjectService.php         # Template spawner, progress engine, localAPI('CreateInvoice') time billing & profitability analytics
│   ├── AdminController.php        # 5-tab Admin Workspace + 15-op CSRF-protected AJAX router
│   └── ClientController.php       # 2-tab Client Projects & Roadmap Portal + 4-op CSRF-protected AJAX router
├── templates/
│   ├── admin/dashboard.php        # Analytics, Kanban, Live Time Tracker, Templates & Roadmap Moderation
│   └── client/portal.tpl          # Smarty Client Projects, Milestone Approval & Product Roadmap Voting
└── assets/
    ├── css/haikhavan_project_management.css             # Scoped .hk-pm-* stylesheet
    └── js/haikhavan_project_management.js               # Zero-CDN HTML5 Canvas bar charts + Admin/Client AJAX controller

2. Database Schema (8 Custom Tables)

Created idempotently via WHMCS\Database\Capsule::schema() in HaikhavanProjectManagement\Database::install(). Preserved on deactivation.

Table Purpose Key Columns & Indexes
mod_hk_pm_templates Reusable project templates with JSON task & milestone blueprints id (PK), name (UNIQUE), category, default_hourly_rate, default_budget, default_hours, auto_trigger_quote, tasks_json, milestones_json
mod_hk_pm_projects Client/Service/Ticket/Quote/Invoice-linked projects id (PK), code (UNIQUE), title, userid (IDX), service_id, ticket_id, quote_id, invoice_id, template_id, owner_admin_id, owner_name, status (IDX), priority, budget_amount, hourly_rate, estimated_hours, due_date, progress_pct, description, files_json
mod_hk_pm_tasks Kanban board tasks with weighted completion tracking id (PK), project_id (IDX), title, stage (backlog|in_progress|review|done, IDX), priority, assignee_name, due_date, estimated_hours, billable, sort_order
mod_hk_pm_milestones Client-approvable project milestones id (PK), project_id (IDX), title, due_date, amount, status (pending|ready_for_approval|approved|invoiced), approved_by_uid, approved_at
mod_hk_pm_timelogs Live Start/Stop and manual billable time logs id (PK), project_id (IDX), task_id, admin_id, staff_name, description, started_at, ended_at, duration_minutes, hourly_rate, billable, billed_invoice_id (IDX), is_running (IDX)
mod_hk_pm_messages Client & staff project discussion timeline id (PK), project_id (IDX), author_type (admin|client), author_id, author_name, body, is_internal, created_at
mod_hk_pm_feedback Product Feedback & Public Roadmap items id (PK), userid (IDX), author_name, title, category (feature|improvement|integration|bug), status (under_review|planned|in_progress|shipped, IDX), description, upvotes, admin_response
mod_hk_pm_feedback_votes Deduplicated per-client roadmap upvote ledger id (PK), feedback_id (IDX), userid (IDX), created_at, UNIQUE(feedback_id, userid)

3. Core Engines (ProjectService)

  • Weighted Progress Engine (recalculateProgress): Automatically computes progress_pct whenever tasks are added, moved, or deleted (done = 1.0, review = 0.70, in_progress = 0.35, backlog = 0.0).
  • 1-Click Time-to-Invoice Conversion (convertUnbilledTimeToInvoice): Selects all completed unbilled billable entries (billable=1 AND billed_invoice_id=0 AND is_running=0 AND duration_minutes > 0), builds itemized line items ([CODE] Description (Staff — X.XX hrs @ $Rate/hr)), invokes WHMCS localAPI('CreateInvoice', $params), stamps billed_invoice_id on every converted time log, and updates mod_hk_pm_projects.invoice_id.
  • Profitability & Utilization Analytics (computeAnalytics): Aggregates budget burn-rate (billable_value / budget_amount), billable utilization (billable_minutes / total_minutes), net margin (billable_value - (hours * internal_cost_rate)), and per-staff billable revenue for zero-CDN Canvas charts.

4. WHMCS Hooks (hooks.php)

  1. ClientAreaPrimaryNavbar — Adds Projects & Roadmap (index.php?m=haikhavan_project_management) under Services.
  2. QuoteStatusChange — When a WHMCS Quote transitions to Accepted, spawns a templated project via ProjectService::spawnFromTemplate() (idempotent on quote_id).
  3. InvoicePaid — Marks approved milestones on the linked project as invoiced.
  4. AdminAreaClientSummaryPage — Displays active project count & unbilled hours banner on clientssummary.php.
  5. AdminHomeWidgets — Registers Project Delivery, Time Billing & Roadmap 2-column dashboard widget.

5. AJAX API & Security Controls

  • CSRF Protection: Independent 48-hex-char session tokens ($_SESSION['hk_pm_admin_csrf'], $_SESSION['hk_pm_client_csrf']) verified with hash_equals() on all write AJAX operations (HTTP 403 on invalid/missing token).
  • Strict Client Ownership: approve_milestone and post_message verify mod_hk_pm_projects.userid === $_SESSION['uid'] before mutating records; toggle_upvote enforces one vote per (feedback_id, userid) via unique index.
  • Admin AJAX Ops (admin/addonmodules.php?module=haikhavan_project_management&ajax=1): create_project, delete_project, spawn_template, create_task, move_task, delete_task, create_milestone, update_milestone_status, post_message, start_timer, stop_timer, log_manual_time, convert_to_invoice, update_feedback, delete_feedback.
  • Client AJAX Ops (index.php?m=haikhavan_project_management&ajax=1): approve_milestone, post_message, submit_feedback, toggle_upvote.