# Changelog

## 2.0.0 – 22 August 2026

- **New:** Documents now carry an explicit status – Not generated, Issued, or Voided – visible per document type on the order screen, without ever silently replacing a historic file.
- **New:** Added a "Regenerate" action that lets staff deliberately re-render an already-issued PDF using the order's current data. The previously issued file is renamed and retained rather than deleted or overwritten, and the action is logged with the acting user, timestamp, and an optional reason. This does not itself guarantee compliance with jurisdiction-specific invoicing or record-keeping laws.
- **New:** Added "Void" and "Unvoid" actions that change a document's status without modifying or deleting its archived PDF file, creating a metadata-only audit entry.
- **New:** Added a per-document history log showing issued, regenerated, voided, and unvoided events, including date, acting user, and document number, directly on the WooCommerce order screen.
- **New:** Added a System Status tab under Settings reporting PHP, WordPress, WooCommerce, and Dompdf versions, HPOS status, uploads/archive writability, active template, PHP memory limit, and execution limits without exposing customer data or secrets.
- **New:** Added settings import/export under Settings → System Status using JSON files. Imports are validated field-by-field against a strict whitelist, and exported files exclude the logo media attachment ID because WordPress attachment IDs are not portable between sites.
- **New:** Added optional custom font uploads under Settings → Brand & Styling. Only local `.ttf`, `.otf`, and `.woff` files are accepted, validated by both extension and binary file signature, with files stored inside the plugin's existing hardened uploads directory. Remote font URLs are not accepted.
- **New:** Added a "Has PDF documents" filter to the WooCommerce Orders screen for both legacy and HPOS/custom-order-table views, allowing administrators to quickly find orders with or without invoices or credit notes.
- **New:** Redesigned the entire admin experience around the shared Kitgenix design system, with a sticky topbar, brand navigation, and a quick link to the Kitgenix Hub from every screen.
- **New:** Added in-page settings search with "/" and Cmd/Ctrl+K shortcuts so administrators can quickly find a field or section without manually navigating through tabs.
- **New:** Added a light/dark theme toggle for the admin screens, with the selected preference remembered between visits and a sensible default based on the browser's preferred colour scheme.
- **New:** Added a responsive mobile navigation menu for Kitgenix admin screens on narrower displays.
- **Improved:** Settings sections now render as clearly separated cards with icons, while checkboxes have been replaced with toggle switches throughout Settings, the email attachment matrix, and document generation rules for clearer on/off states.
- **Improved:** Redesigned tables, notices, badges, and button groups across the Settings, Email Preview & Test Send, and Support screens for a more consistent Kitgenix admin experience.
- **Improved:** The Kitgenix Hub page now shares the same topbar and brand header as the plugin's settings screens and includes Image Optimizer alongside the other Kitgenix plugins that can be installed, activated, and managed from one place.
- **Improved:** The WooCommerce order screen meta box now displays invoice and credit note numbers as compact badges instead of plain text.
- **Improved:** The Log tab now displays entries in a searchable, paginated table containing time, context, outcome, and a plain-English note instead of a plain text block.
- **Improved:** Invoices or credit notes that fail to attach to an order email are now recorded in the Log tab, ensuring emails sent without their expected PDF attachment are visible to administrators.
- **Improved:** Batch invoice generation now distinguishes orders skipped because they are not eligible for a document from orders that genuinely failed to generate, with the reason recorded in the Log tab.
- **Improved:** Added a reference table to the Log tab explaining what each recorded category means and whether administrator action is required.
- **Improved:** The Support tab is now three focused cards – a donate card with a collapsible monthly-amount picker, a "what your support funds" summary, and a "get involved" panel for reviews and plugin links – replacing the previous stack of donate, trust, and community cards.
- **Improved:** Moved the Log tab directly before Support in the admin navigation for a more logical workflow.
- **Fix:** Credit note numbering is now keyed to the stable WooCommerce refund ID instead of the refund list's array position, preventing deleted or reordered refunds from desynchronising, skipping, or duplicating credit note numbers. Existing credit note history is migrated automatically.
- **Fix:** PDF generation errors, including memory exhaustion or execution time limits on very large orders, are now caught and logged instead of risking an uncaught fatal error while generating an invoice or credit note.
- **Fix:** Corrected the MultiStore plugin listing in the Kitgenix Hub, including its name, slug, and plugin file path, so install, activate, and open actions now target the correct plugin.
- **Fix:** Empty document download button rows are no longer rendered in the WooCommerce order meta box when no PDF downloads are available for the order.
- **Fix:** Admin notices rendered on the plugin settings page can now be dismissed using a close button.
- **Fix:** The "Preview email attachments" and "Send test email with PDFs" buttons now have appropriate spacing from the field above them.
- **Fix:** Number inputs, including the email preview Order ID field, are no longer cramped to a fixed 50px width.
- **Security:** Document numbers are now assigned through a dedicated database table using an atomic increment, closing a race condition where two simultaneous requests could previously receive the same supposedly unique invoice, receipt, or credit-note number under load. Existing counters are migrated automatically and idempotently, with no numbers reset or reused.
- **Security:** Archived PDF storage directories are now hardened with `index.php` and `.htaccess` guards when created, adding defence in depth alongside the existing nonce, order-key, and capability checks that protect every document download.
- **Security:** Order-scoped actions – including admin order actions, order meta box downloads, and admin-post document streaming – now also verify WooCommerce's object-aware `edit_shop_order` capability for the specific order in addition to the existing general capability checks.
- **Security:** Custom font uploads are restricted to validated local font files and checked using both their extension and binary file signature before being stored inside the plugin's hardened uploads directory.
- **Dev:** Refreshed dependencies using `composer install` and `composer audit`, including Dompdf 3.1.6, with no known security advisories detected. Dompdf and its dependencies' bundled licence files remain included for redistribution.
- **Dev:** Added a shared `kitgenix-admin-components.js` controller providing toast and inline save confirmations, collapsible cards, copy-to-clipboard controls, and live table search for consistent behaviour across Kitgenix plugins.
- **Dev:** Migrated hardcoded Kitgenix brand colours in the WooCommerce order meta box and admin stylesheets to shared CSS custom properties for consistent theming across plugins.
- **Dev:** Refreshed and reorganised the Kitgenix logo and icon asset set used throughout the admin UI and Kitgenix Hub.

## 1.1.3 – 26 May 2026

- **New:** Added a Log tab to the admin settings page. Records recent plugin activity (settings saves and key operations) with timestamps, context labels, and plain-English notes to aid troubleshooting.
- **Fix:** Activity log data is now fully cleaned up when the plugin is uninstalled.
- **Compatibility:** Confirmed compatibility with WordPress 7.0 and WooCommerce 10.x.

## 1.1.2 – 26 May 2026

- **Dev:** Skipped to be in line with other Kitgenix Plugins.

## 1.1.1 – 7 May 2026

- **Update:** Updated Composer dependencies.

## 1.1.0 – 7 May 2026

- **New:** Added localization, tax, and legal formatting packs for VAT, GST, and Sales Tax terminology, including regional document-title variations such as Tax Invoice and Adjustment Note in the bundled templates.
- **New:** Added no-code controls for tax-inclusive versus tax-exclusive amount display, custom document date formats, ISO currency-code suffixes, and tax-label overrides across invoices, receipts, credit notes, and packing slips.
- **New:** Added built-in Pro Forma Invoice, Delivery Note, and Statement document types that plug into the existing registry, admin downloads, batch ZIP exports, and template system.
- **New:** Added document-generation rules in settings so each built-in document type can be enabled or disabled, limited to specific WooCommerce order statuses, and restricted by paid/unpaid state.
- **New:** Added admin order-screen download actions and secured admin-post routes for Pro Forma Invoice, Delivery Note, and Statement PDFs.
- **New:** Added a visual template designer with no-code controls for header alignment, logo scale, layout density, information-panel styling, item-table presentation, totals emphasis, and footer alignment across the bundled PDF template packs.
- **New:** Added an Email Attachments preview and test-send workflow so admins can inspect mapped PDFs for a specific order, open live document previews, and send attachment-only test emails before using live WooCommerce email flows.
- **New:** Added field controls for SKU visibility, item meta, per-line tax details, payment/shipping metadata, tax totals, customer notes, and the latest internal WooCommerce order note across bundled PDF templates.
- **New:** Added settings-based custom order field rows using `meta_key|Label`, so stores can surface tracking numbers, fulfilment references, warehouse picks, and other order meta without overriding templates.
- **New:** Added advanced numbering controls for invoices, receipts, packing slips, and credit notes with configurable prefixes, token-based formats, sequence padding, and calendar-year or fiscal-year resets.
- **New:** Added fiscal-year and country-aware numbering tokens so stores can build region-specific compliance formats without editing plugin code.
- **New:** Added persistent archived PDF storage so generated documents can be reused as immutable copies for later downloads, emails, and batch exports.
- **New:** Added WooCommerce order-list bulk actions for exporting invoice, packing slip, receipt, and credit note ZIP batches.
- **Improvement:** Bundled document templates now use a shared localization/display helper so tax labels, document titles, date formatting, and amount presentation stay consistent across all built-in styles.
- **Improvement:** Invoice-style and packing-slip-style template packs now render document-type-aware titles, references, and dates so aliased document types display correctly without duplicate template stacks.
- **Improvement:** Receipt and credit note templates now support the same configurable line-item detail controls used by invoices and packing slips.
- **Improvement:** Credit notes now support refund-aware numbering formats while issued documents keep their first generated identifiers for immutable re-delivery and audit consistency.
- **Improvement:** Packing slip templates and the WooCommerce admin meta box now show stored document identifiers instead of assuming order-number-based document numbers.
- **Improvement:** Added packing slip archive identifiers and timestamps so stored packing slips stay stable after first generation.
- **Improvement:** Added shared batch archive generation on top of the existing on-demand PDF renderer so batch exports reuse the same document templates, numbering, and security rules.
- **Improvement:** Credit note batch exports now skip non-refunded orders automatically instead of generating empty credit note downloads.
- **Dev:** Added archive metadata on orders and developer hooks for controlling archive retention paths and off-site archive workflows.
- **Dev:** Added a developer filter for customizing generated batch ZIP filenames.

## 1.0.6 – 19 March 2026

- **UI:** Improved the Kitgenix admin header layout for better alignment and less clutter.
- **UI:** Social links in admin headers now render as compact icon buttons with accessible labels.
- **UI:** Added responsive header helpers so titles/descriptions and actions/links lay out consistently.
- **UI:** Admin tables inside Kitgenix pages now use Kitgenix styling for a more consistent branded look.
- **Fix:** Admin notices now display above the Kitgenix header using the WordPress standard notice area.
- **Fix:** Added defensive notice normalization to prevent notices being relocated into the header by other scripts.
- **Fix:** Restored consistent spacing between settings tabs and section cards.
- **Fix:** Added spacing between adjacent action links/buttons such as Edit/Delete.
- **Maintenance:** Updated the plugin Author URI to the public Kitgenix WordPress.org profile and replaced the old custom admin-menu icon CSS with the native Dashicons icon.

## 1.0.5 – 18 February 2026

- **UI:** Updated the Kitgenix Hub cards with Stock Sync for WooCommerce.
- **Fix:** Normalised Kitgenix Hub card output for consistent layout and navigation.
- **Dev:** Regenerated `/languages/kitgenix-pdf-invoicing-for-woocommerce.pot` translation template.
- **Docs:** Overhauled `readme.txt`.
- **Docs:** Updated WordPress.org screenshots.

## 1.0.4 – 27 January 2026

- **New:** Added additional template packs including Simple, Modern, and Business, plus a setting to choose the active template style.
- **New:** Added Receipt and Packing Slip actions to the admin order meta box for downloading and generating documents.
- **Improvement:** Added translation loading from the plugin's `/languages` directory.
- **Improvement:** Applied minor fixes and translation-loading improvements.
- **UI:** Added a label for the refunded email row in the Email Attachments table.
- **Fix:** Fixed Email Attachments settings not persisting when saving other settings tabs because the multi-form settings page could overwrite the attachment mapping.
- **Fix:** Fixed public document download permissions to allow guest access through valid WooCommerce `order_key` links, matching the documented behaviour.
- **Fix:** Fixed CSS injection for PDF rendering so valid CSS is not HTML-escaped, preventing broken selectors, while stripping tags and neutralising closing `</style>` sequences.
- **Fix:** Regenerated Composer autoload files to resolve a missing generated file mapping for `thecodingmachine/safe` and verified vendor autoload mappings.
- **Fix:** Resolved edge-case settings and template issues affecting PDF generation.
- **Change:** Declared PHP requirement as 8.1 to match bundled dependency requirements.
- **Change:** Harmonised admin Hub enqueue checks and admin branding, and shortened readme/header strings to conform to WordPress.org limits.
- **Cleanup:** Applied PHPCS, i18n, and security fixes across plugin files, including output escaping, translator comments, and optional nonce checks.
- **Cleanup:** Uninstall routine now also removes the anonymous PDF generation metrics option.

## 1.0.3 – 6 January 2026

- **Maintenance:** Updated Composer dependencies to the latest compatible versions.

## 1.0.2 – 6 January 2025

- **Fix:** Fixed a WooCommerce compatibility issue that could trigger a fatal error during PDF generation for receipt and invoice templates when `wc_get_order_item_totals()` is unavailable.
- **Fix:** Totals now use the order API through `WC_Order::get_order_item_totals()` with safe fallbacks to prevent admin order saves and transactional emails from failing.

## 1.0.1 – 1 January 2025

- **New:** Added a shared top-level “Kitgenix” admin menu and Hub, and moved PDF Invoicing settings beneath it.
- **New:** Added privacy-safe PDF generation counters, including totals and counts by document type, displayed in the Support tab.
- **Improvement:** Redesigned the settings UI with a new header and tabbed navigation for Settings, Brand & Styling, Email Attachments, Preview, and Support.
- **Improvement:** Improved admin styling with dark-mode-friendly variables and updated Kitgenix brand assets.
- **Improvement:** Improved settings behaviour so the WordPress colour picker is initialised only when relevant tabs are visible.
- **Improvement:** Improved the logo upload UI with cleaner preview markup and consistent show/hide behaviour for the remove button.
- **Improvement:** Hardened admin asset loading so it is scoped to the plugin settings page using hook-suffix tracking with safe fallbacks.

## 1.0.0 – 19 December 2025

- **New:** Initial release – generate PDF invoices, receipts, packing slips, and credit notes for WooCommerce orders.
- **New:** Included a standard template set and HTML wrapper with theme override support.
- **New:** Added secure Dompdf configuration with chrooted paths, remote fetching disabled by default, and PHP evaluation available only as an opt-in.
- **New:** Added WooCommerce email attachments with automatic temporary-file cleanup.
- **New:** Added an admin order meta box with preview, download/stream, and generate actions protected by nonces and capability checks.
- **New:** Added settings for branding, company details, document prefixes, and WooCommerce email attachment mapping.
- **New:** Added stable invoice numbering stored on first generation, with credit notes tied to WooCommerce refund history.
- **New:** Added developer-friendly filters and actions for templates, filenames, generated HTML, enablement, and module registration.
- **New:** Added translation-ready localisation support.