== Changelog ==

= 0.9.10.5 =
* Improved the front-end Invoices, Customers, and Services lists on tablet and smaller screens: secondary columns (Issue Date/Total on Invoices, Contact Person/Email on Customers, Type/Taxable on Services) now hide progressively as the screen narrows instead of forcing horizontal scrolling, and the Actions column now wraps its links in a proper container that stacks one link per line with real tap targets instead of wrapping awkwardly mid-row.
* The Invoices list's Actions column now shows a "Record Payment" link (jumping straight to that invoice's Record a Payment section) in place of Delete, which is still available from the invoice's own Actions area. Also added a matching "Record a Payment" quick link under Due Date on the invoice edit screen (wp-admin and front end).
* The front-end page now uses more of the available width on large screens (1600px and 1920px breakpoints) instead of staying capped at 1200px wide.

= 0.9.10.4 =
* The Customers screen's "Company Name" field now reads "Company/Job Name" when the record is a Job (i.e. "This is a Job of" has a parent selected), on the front end and in wp-admin, since that field holds the Job's own name rather than a separate company.
* Added a video tour and Helpful Links (official website, GitHub wiki) to this file's description, and added "billing" to the plugin's Tags.

= 0.9.10.3 =
* Fixed: saving a customer, receiving a payment, or any other action that redirects back to a front-end record-edit screen (`KCRM_Controller_Base::redirect()`, used by every controller's save/delete/payment/import handler) could land on "This link has expired" -- the redirect itself never carried the nav nonce that 0.9.10.2 started requiring. `redirect()` now always includes it.
* Hardening: `KCRM_Company_Transfer::import()` now runs every imported customer, service, invoice, line-item, and payment field through the same sanitizers as the normal save screens (previously only the company profile was sanitized) -- so a hand-edited export file can't store unescaped markup, an invalid country, or a malformed date. Imported line-item amounts are recomputed from quantity x rate rather than trusted from the file. Per WordPress.org Plugin Review Team feedback.
* Hardening: `GET` parameters read through `sanitize_key()` are now unslashed first, and three admin-post download handlers gained the standard nonce-verification comment, for Plugin Check compliance. No behavior change.

= 0.9.10.2 =
* Fixed: the front-end customer profile's `id` query arg now fails closed instead of open when its nav nonce is missing or invalid -- previously it silently fell back to "Customer not found," which is what add-ons linking into that screen without the nonce (e.g. Karks CRM Packages' "Log Usage" flow) hit after this plugin's nonce hardening. Now shows an explicit "link has expired" message instead, and `KCRM_Front::nav_nonce()`/`nav_nonce_args()` are available for add-ons to build valid links.
* Corrected "Tested up to" (7.0 -> 7.1).

= 0.9.10.1 =
* Hardening: replaced inline `<script>` blocks in the Company Profile, Invoice, and Appearance screens (wp-admin and front end) with properly enqueued/inlined scripts via `wp_enqueue_script()`/`wp_add_inline_script()`, per WordPress.org Plugin Review Team feedback.
* Corrected the Contributors field in this file (karkovack -> karks88).

= 0.9.10.0 =
* Added an extension point for add-ons: a new `kcrm_front_tools_after_sections` action fires at the end of the front-end Tools screen (see the wiki's Hooks and Filters page).
* `KCRM_Company_Transfer::import()` gained an optional second parameter to restore a company's data in place (for the upcoming Karks CRM Backups add-on); the existing Import feature's behavior (always creates a new company) is unchanged.
* Fixed: the front end's h3 subheading spacing (added so a section's own subheading has visible separation from unrelated content above it) was being applied even when an h3 immediately follows its own h2 -- e.g. "Companies" under the Tools screen's "Tools" heading -- pushing it down and adding an unwanted divider line right below the section title it belongs to.

= 0.9.9.7 =
* Hardening: the Email Invoice merge tags ({{first_name}}, {{last_name}}, {{customer}}, {{service}}) now strip any HTML from customer/service data before substituting into the email template, so a customer record can't inject markup into an outbound email regardless of which code path sends it.

= 0.9.9.6 =
* The front-end customer profile's "Invoices & Payments" tab now shows a count badge for open/partially-paid invoices (the same $0.00 exclusion as the Open Balance export), matching the existing "Jobs" tab badge.

= 0.9.9.5 =
* Fixed: the bundled Dompdf library (`vendor/`) actually required PHP 8.1+ despite this plugin declaring "Requires PHP: 7.4" -- a transitive dependency had drifted to a version with a higher floor than intended. Re-pinned so the bundled library genuinely supports PHP 7.4 again, matching what's declared.

= 0.9.9.4 =
* Reliability: if a database update ever fails partway (e.g. a hosting/permissions issue), the plugin no longer silently marks it "done" -- it keeps retrying and shows a persistent notice to site administrators until it's resolved, instead of leaving the database in an inconsistent state unnoticed.

= 0.9.9.2 =
* Corrected "Tested up to" in this file back to a major version only (7.0.4 -> 7.0) -- this field doesn't support minor/patch versions.

= 0.9.9.1 =
* Confirmed compatible with WordPress 7.0.4.
* New "Other Payment Instructions" field on the Company profile (wp-admin and front end) -- checking "Other" as an Accepted Payment Type now reveals a text field for it, the same way "Check" reveals "Make Checks Payable To". Shown on invoices and PDFs whenever "Other" is accepted and this field is filled in.

= 0.9.8 =
* New Country field on the Company and Customer profiles (wp-admin and front end), for tracking international customers. Defaults to United States for existing records. The invoice PDF's From/Bill To addresses now show the country when it's set to anything other than the United States, and the front-end Customers CSV export includes a Country column.
* New Street Address 2 field on the Company and Customer profiles, for apartment/suite/unit numbers or a second address line. Shows up wherever Street Address does: both edit screens, the invoice PDF, and the Customers CSV export.

= 0.9.7 =
* The front-end invoice edit screen's "Update Invoice"/"Create Invoice" button now stands out more -- larger, bolder, with a drop shadow and extra spacing above it -- instead of blending in with the page's other buttons.
* The Company Switcher is now hidden if you only have one company, since there's nothing to switch to.
* The Company Profile's Recent Actions feed now includes payments received, alongside invoices created/emailed and customers added.

= 0.9.6 =
* New "Log Out" link in the front-end nav, for CRM Manager users who don't have the wp-admin toolbar available to log out from.
* The front-end nav now collapses to a hamburger menu on narrow screens (768px and below), and uses smaller, tighter-spaced tabs on tablet-width screens (769px-1100px).

= 0.9.5 =
* The front-end customer profile is now tabbed (Home, Jobs, Invoices & Payments) instead of one long stacked page. The active tab lives in the URL, so a link or bookmark to a customer's invoices lands on the right tab; the Invoices screen's links into a customer's profile now point straight at Invoices & Payments.
* New `kcrm_customer_profile_tabs` filter so an add-on can contribute its own tab on the customer profile (see the Hooks and Filters wiki page).
* New CSV exports for the Customers, Services, and Invoices screens (front end), respecting whatever filter is currently applied (e.g. active-only customers, the selected invoice statuses).
* The front-end Tools screen can now export a company as a JSON file (previously wp-admin only), with a tooltip explaining what it's for.
* Removed the redundant "Open Balance" card from the front-end Customers list.

= 0.9.4 =
* Revenue report: each month on the 12-month chart now shows its total (with the company's currency symbol) under the month label, in the theme's primary color -- not just on hover.
* The front-end Company Profile is simpler: the full Customers and Invoices tables are gone, replaced by a "Search Customers" box that jumps straight to the Customers list already filtered to your search. The stat cards now link to the real Customers/Invoices screens instead of on-page sections that no longer exist.
* Fixed: an invoice line item's description always copied the selected Service's Name, even though Services have their own separate Description field -- it's now used instead (falling back to the Name only if a service has no description set).
* Fixed: the Company Profile's Recent Actions could show a slightly wrong "last 2 days" window depending on the server's PHP timezone setting.

= 0.9.3 =
* The front-end login form (shown to logged-out visitors on the CRM page) is now styled to match the rest of the front end instead of appearing as a bare, unstyled form.
* The Reports overview now has a short "Choose a report below:" description under the heading, and each report card has its own title (Revenue/Aging/Customer Report).
* Karks CRM's wp-admin menu order: "Companies" now sits right under "Getting Started" instead of near the bottom of the list.

= 0.9.2 =
* Negative line-item amounts (e.g. a discount) now display in parentheses -- e.g. "(50.00)" -- instead of a plain minus sign, everywhere an invoice's line items, totals, or balance due are shown: the edit screen, the Invoices list, the customer profile, and both PDFs.
* New "Preview" button next to "Download PDF" opens the invoice as a plain HTML page in a new tab -- same layout as the PDF, for a quick look without downloading anything. Internal use only for now, not yet a link meant for sharing with customers.
* The Invoices screen (list and edit screen) now links every customer name directly to that customer's profile.
* Fixed: typing raw HTML (e.g. a hand-typed link) directly into the "Email Invoice Template" or "Invoice Footer" field's Visual tab could silently corrupt straight quotes into curly quotes, breaking the HTML. Both fields are now a plain HTML/Quicktags editor instead of a rich-text (TinyMCE) one, which avoids this entirely.
* New "BCC Invoice Emails" company setting (off by default) -- BCCs a configured address on every "Email Invoice" send, e.g. to keep your own copy.
* Fixed: the PDF wasn't actually attached to invoice emails on sites where a mail-sending integration (e.g. Mailgun) replaces WordPress's own mail-sending internals. Also fixed hand-typed line breaks in the Email Invoice Template/Invoice Footer not showing up in the sent email/PDF (a side effect of the Visual-tab fix above).

= 0.9.1 =
* Invoices screen: a "Customers with Multiple Jobs" section groups a customer's own invoices together with all of its Jobs' invoices (sorted by issue date), instead of scattering them through the regular sorted list; wp-admin also gets a Customer filter to narrow the list down to one customer (+ its Jobs).
* New "Send Invoices To" fields on the customer profile (Name + Email, optional) -- when set, the Email Invoice form defaults to this contact instead of the primary one.
* Email Invoice now has a CC field. It starts blank, with one-click suggestions for any other email addresses on file for that customer; "Last emailed to X on Y" now also shows who was CC'd.
* New "Open Balance" PDF/CSV export for a customer (+ its Jobs), available from the customer profile and the per-customer Report; the Customers list also shows a company-wide Open Balance total.

= 0.9.0 =
* New "Receive Payment" section on the customer profile (front end): split one payment across several open invoices for a customer and its Jobs in a single entry, with an oldest-invoice-first auto-fill you can still adjust per invoice before saving.
* Pagination Previous/Next links (Customers, Invoices, and a customer's Payments Received list) now jump back to that list instead of scrolling to the top of the page.

= 0.8.0 =
* The front-end Dashboard is no longer a separate landing screen -- visiting the CRM page now goes straight to the current company's Profile. Its "Add a Company" button and the all-companies overview table moved to a new Tools tab at the end of the navigation.
* PDF invoices now color-code the status badge (Paid/Partially Paid/Open/Void/Draft), matching the front end's existing status colors, so a Paid invoice stands out at a glance.
* Fixed the Company Profile's Recent Actions "Show more" toggle not working on the first click.
* Performance: added database indexes for the most common invoice, payment, and customer lookups; batched dozens of duplicate per-row database queries across the Dashboard, Company Profile, Customers, Invoices, and Reports screens; added pagination to the Customers and Invoices screens (200 per page) instead of always loading every row.
* Fixed a bug where adding a new front-end URL could silently 404 until Permalinks was manually re-saved.

= 0.7.2 =
* PDF invoice downloads/attachments and the default "Email Invoice" subject line now use a "{Customer Name} - {Type} Invoice" pattern instead of just the invoice number.

= 0.7.1 =
* Instant, client-side search added to the Customers and Invoices screens (wp-admin and front end).
* Paid invoices are now hidden from the Invoices screen by default (Draft, Open, and Partially Paid show unless you choose otherwise).
* Recent Actions area added to the Company Profile, showing recent invoice and customer activity.
* Various security hardening fixes identified via the WordPress Plugin Check tool.

= 0.6.1 =
* Fixed a 404 on every front-end link (Customers, Invoices, Services, Reports, etc.) when the CRM page is set as the site's homepage under Settings -> Reading. Self-heals automatically, the same way the front end already recovers after a site clone/restore.

= 0.6.0 =
* Company Name, Status, Invoice #, Issue Date, Due Date, and Balance Due columns are now sortable on the Customers and Invoices screens (wp-admin and front end).
* Invoices screen: filter the list down to specific statuses (Draft, Open, Partially Paid, Paid, Void) instead of always seeing everything.
* Fixed a contrast gap where a sortable column header's link (e.g. Status) could fall back to the page's default link color instead of the WCAG-checked header text color, on the front end's dark table headers.

= 0.5.0 =
* Front-end interface at /crm/, with a new "CRM Manager" role/capability for using it without wp-admin access.
* Reports tab (front-end only): Revenue with a 12-month chart, a per-customer report, and an Aging report, each with CSV export.
* Export a full company (profile, customers, services, invoices, payments) as a JSON file and import it into another site.
* CSV import for services, and Product/Service mapping (with automatic service creation) when importing invoices.
* Taxable services: mark a service (and its invoice line items) as taxable; invoice totals now only tax the marked lines.
* User-managed Invoice Types (Karks CRM -> Invoice Types), replacing the previously hardcoded list.
* Custom Appearance colors are now checked against WCAG 2.1 AA contrast automatically, with an option to disable the front end's stylesheet entirely.
* Delete button added to the invoice edit screen.
* New Getting Started screen (Karks CRM -> Getting Started).
* Self-healing rewrite rules: the front end no longer requires manually re-saving Permalinks after cloning or restoring a site.

= 0.4.0 =
* Customers screen and customer CSV import.

= 0.1.0 =
* Initial release.
