=== Vollstart Repair Desk ===
Contributors: sasonikolov
Tags: repair management, workshop, repair tracking, service desk, repair shop
Requires at least: 6.2
Tested up to: 7.0
Stable tag: 1.0.4
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Repair tracking and customer notifications for workshops. QR code status page, work steps, photos, and email reminders — all in one plugin.

== Description ==

Vollstart Repair Desk helps repair shops manage jobs from intake to pickup. Customers get a QR code and check their repair status online — no more "Is it done yet?" phone calls.

**Built for real workshops.** Bike shops, electronics repair, cobblers, car workshops, phone repair — any business that takes items in, fixes them, and hands them back.

**No cloud, no monthly fees.** All data stays in your WordPress database. No external services required for core functionality.

**GDPR-friendly by design.** Customer data export, anonymization, and deletion built in.

**Pro version available.** A separate Vollstart Repair Desk Pro plugin with additional features is available at vollstart.com — see the Premium Features list below.

= Perfect for =

* **Bike shops** — track repairs, parts, and notify customers when ready
* **Electronics repair** — intake photos, work steps, QR status tracking
* **Cobblers and tailors** — simple repair tracking with pickup reminders
* **Car workshops** — device and vehicle management with recurring maintenance
* **Phone repair** — quick intake, status updates, QR code tracking
* **Any repair business** that needs to track jobs and communicate with customers

= Core Features =

* **Repair management** — create, edit, and track repairs with configurable status flow
* **Customer database** — contact info, repair history, customer numbers
* **Device tracking** — devices and products linked to customers and repairs
* **Repair types** — catalog with estimated duration, default pricing, and icon selection
* **Work steps** — checklists with time tracking, progress indicators, and auto-status
* **Photo uploads** — webcam, mobile camera, or file upload for intake documentation
* **QR code** — unique QR per repair, printable labels, camera scanner in admin
* **Public status page** — standalone URL or shortcode, customers check live status
* **PDF documents** — pickup receipts, device reports and customer reports (A4, ready to print)
* **Messaging** — communication between shop and customer per repair
* **Email notifications** — automatic emails on status change, new repair, customer messages, with customizable HTML bodies and subjects
* **Pickup reminders** — automatic email reminders after configurable days
* **CSV export and import** — repairs, customers, devices, repair types, work steps
* **GDPR tools** — data export, anonymization, and deletion per customer
* **Dashboard widget** — open and total repair counts on the WordPress dashboard
* **Bulk actions** — change status, print QR labels, or delete multiple repairs
* **Internal rating system** — staff rate customers, average shown on customer card
* **Device repair history** — every repair linked to a device, visible in one click
* **Mobile-friendly** — responsive admin interface, works on phones and tablets

= Premium Features =

Everything in the free version, plus:

* **Customer portal (PWA)** — installable web app, customers see all their repairs, devices and unread messages in one place
* **Cost tracking & billing** — parts catalog, work items, hourly rate per staff member, time-based pricing per work step, invoice summary
* **Invoice PDF** — full invoice with line items, tax, business header, sent by email or downloaded as PDF
* **PDF customization** — paper size, font, margins, RTL direction, show staff names + status timeline on documents
* **WooCommerce integration** — turn a repair billing summary into a WooCommerce order with one click
* **Parts inventory** — stock levels, usage tracking, low-stock email alerts
* **Global item catalog** — reusable parts and labor items with price history and per-item statistics
* **Warranty tracking** — expiry dates per repair and automatic reminder emails before they run out
* **Recurring maintenance** — service intervals per device with cron-driven reminder emails
* **Custom status definitions** — add your own workflow steps with colors and icons, fully integrated into the status flow
* **External rating system** — ask customers to rate the repair via email link or directly on the public status page / customer portal
* **Staff management** — multiple team members with auth tokens, intake PWA for walk-in reception

Premium features require the separate Pro add-on plugin, available at [vollstart.com](https://vollstart.com/shop/repair-desk-pro/).

= How It Works =

1. **Intake** — Create a repair, snap photos, assign a repair type with estimated duration
2. **Track** — Move through status flow, log work steps, communicate with customer
3. **Notify** — Customer gets automatic emails and checks QR code for live status
4. **Deliver** — Mark as done, send pickup reminder, track warranty

= Languages =

Vollstart Repair Desk is translated into 20 languages:

* English (default), German (DE/AT/CH), French, Spanish, Italian, Dutch, Portuguese (PT/BR), Hungarian, Polish, Czech, Swedish, Danish, Finnish, Greek, Romanian, Bulgarian, Chinese (Simplified), Japanese

All translations are included in the plugin. Community contributions welcome via the WordPress.org translation platform.

= Links =

* [Premium Add-on](https://vollstart.com/shop/repair-desk-pro/)
* [Support](mailto:support@vollstart.com)

= Third-Party Libraries =

This plugin includes the following third-party libraries, bundled locally within the plugin. No external CDN calls are made.

* **DataTables** v2.3.8 — Table sorting, filtering, and pagination — MIT License — [Source](https://github.com/DataTables/DataTablesSrc)
* **DataTables Responsive** v3.0.8 — Responsive table layout — MIT License — [Source](https://github.com/DataTables/Responsive)
* **QRCode.js** v1.0.0 — QR code generation in browser — MIT License — [Source](https://github.com/davidshimjs/qrcodejs)
* **html5-qrcode** v2.3.8 — QR/barcode scanner via camera — Apache 2.0 License — [Source](https://github.com/mebjas/html5-qrcode)
* **TCPDF** v6.11.3 — PDF generation — LGPL-3.0 License — [Source](https://github.com/tecnickcom/TCPDF)

== External Services ==

This plugin does not connect to any third-party or external services. All data is stored locally in your WordPress database. No customer data leaves your server.

The optional Pro add-on plugin (sold separately at [vollstart.com](https://vollstart.com/)) connects to vollstart.com solely for license validation and plugin update checks. The free plugin hosted on WordPress.org does not make any external connections.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install directly via the WordPress plugin search.
2. Activate through the "Plugins" menu in WordPress.
3. Go to "Repair Desk" in the admin menu.
4. Configure your repair status flow and business settings in the Options tab.
5. Create repair types for your most common jobs.
6. Start creating repairs — each one gets a unique QR code for customer tracking.

== Frequently Asked Questions ==

= Do customers need a WordPress account? =

No. Customers check their repair status by scanning the QR code or using a direct link. The public status page uses secure token URLs — no login required.

= Can I customize the repair status flow? =

The default flow covers most workshops: received, diagnosis, quote, waiting for parts, in progress, quality check, done, and delivered. With the Pro add-on, you can define your own custom statuses.

= How does the QR code work? =

Each repair gets a unique QR code. Print it as a label and attach it to the item. When the customer scans it, they see the current status, timeline, and any messages from your shop.

= Can reception staff use the plugin without a WordPress account? =

This is a Pro feature. The Pro add-on provides a staff management system with auth tokens and a mobile intake PWA, so reception staff can create repairs from their phone without a WordPress account. The free plugin requires staff to have a WordPress login.

= Does the plugin require WooCommerce? =

No. Vollstart Repair Desk works fully standalone. WooCommerce integration is available in the Pro add-on for creating orders from repair billing.

= Can I track parts and inventory? =

Parts and inventory tracking is available in the Pro add-on. You can manage stock levels per item and track which parts are used in each repair.

= Is customer data stored on my server? =

Yes. All data is stored in your WordPress database. No external services are used for core functionality. GDPR tools for export, anonymization, and deletion are included in the free version.

= Can customers communicate with my shop? =

Yes. The messaging system lets customers and staff exchange messages per repair. You can configure it as read-only, reply-only, or full two-way messaging.

== Screenshots ==

1. Repair dashboard — every job at a glance, filtered by status, with priority and unread-message badges
2. Repair detail — status flow, device and customer data, defect description and customer access code
3. Work steps — per-job checklist with time tracking and progress
4. Public status page — customers enter their code or scan the QR code to see live status and message the workshop
5. Device management — devices and vehicles linked to their owners and repair history

== Changelog ==

= 1.0.4 — 2026-07-24 =
* Fixed (PHP 7.4 compatibility): the five database wrapper methods in `db.php` declared their variadic argument as `mixed`, a type that only exists in PHP 8.0. On the plugin's stated minimum of PHP 7.4, `mixed` is read as a class name, so every database query threw a fatal "must be an instance of mixed" the moment it ran — which is immediately, on the first admin screen. The type hint has been removed (an untyped variadic accepts any value anyway), so the plugin now genuinely runs on PHP 7.4 as documented. No behaviour change on PHP 8.
* Housekeeping: corrected the bundled-library versions listed under Third-Party Libraries — DataTables 2.3.8 and DataTables Responsive 3.0.8 (the shipped files were already on these versions).

= 1.0.3 — 2026-07-06 =
* Settings that were previously only editable via the add-on are now built-in free options: PDF tax ID and label (Settings → General), and the body text of every email the plugin sends — status change, new repair, customer message, admin notification on customer message, and pickup reminder (Settings → Email Notifications and → Pickup Reminder). The PDF receipt and reports automatically pick them up.
* Fixed (WP.org review): removed `ini_set('display_errors', '0')` from the admin AJAX handler. A plugin must not change PHP's global error-reporting configuration — it would interfere with debugging on the site owner's server. Clean JSON responses are still guaranteed by `wpdb->hide_errors()` and the existing output buffer that strips any stray noise before the payload, so behaviour is unchanged.
* Fixed (WP.org review — SQL safety): `db.php` no longer suppresses the SQL-injection sniff file-wide. Every `$wpdb` query is built with `$wpdb->prepare()` and `%i`/`%s`/`%d` placeholders; the few unavoidable static-analysis false positives (a generic prepared-query wrapper whose template is a hardcoded internal literal) now each carry a narrowly scoped, justified `phpcs:ignore` on the exact line instead of a blanket `phpcs:disable`. No behaviour change.
* Cleanup: removed stray "(Premium)" wording from option descriptions, removed the unused `hasPremium()` method, and neutralized add-on/license references in code comments throughout the free plugin.
* Fixed: `ratingShowOnStatusPage` and `ratingAllowUpdate` are now registered in the free options schema — the public customer-rating widget on the status page is fully controllable without Pro.
* Fixed: ratings card in admin repair and customer views no longer requires Pro — shows based on the `enableRatings` option alone.
* Fixed: warranty_until field (display + edit form) and the Maintenance card in the device view were hidden behind a Pro gate, but the full implementation (DB column, PHP CRUD, dismiss-maintenance AJAX) is in the free plugin. Guard removed; all three now available without Pro.
* Fixed: maintenance warning badge in the repair view had the same gate — removed.
* Added: warrantyDefaultDays option in Settings → Warranty & Maintenance. When set > 0, a quick-fill button pre-fills the warranty date to today + N days.
* i18n: wrapped all remaining hardcoded user-facing strings in translation functions — AJAX error responses in the admin and public handlers, and every label, heading and table column in the receipt / device / customer report PDFs (with `translators:` comments on placeholders). Nothing user-visible is left untranslatable.
* Security: the data-URI (base64) image upload path now derives the real MIME type from the decoded bytes via `getimagesizefromstring()` / `finfo` instead of trusting the client-declared `data:` prefix, enforces the same 10 MB limit and image-type whitelist as the regular upload path, and rejects anything outside it.
* Cleanup: removed the empty `loadTextDomain()` stub and its `init` hook — WordPress 4.6+ loads translations for WordPress.org-hosted plugins automatically. `uninstall.php` now also removes the `vollstart_rd_first_activated_at` option.
* Added: `assets/js/libs/CREDITS.txt` documenting the bundled third-party JS/CSS libraries, their versions, licenses and upstream sources (WordPress.org guideline for minified bundled assets).
* Fixed (WP.org interface review — root cause of "Connection error"): on a fresh install the database schema builder skipped every timestamp column (created_at / changed_at / time on 13 tables) because the internal column-definition validator rejected the `:` in their `00:00:00` default, so the columns were never created. The very first admin screen query then ordered by the missing `repairs.created_at`, threw a fatal, and the resulting error page replaced the JSON — which the UI showed as "Connection error. Please try again." The validator now accepts time literals, the timestamp columns default to `CURRENT_TIMESTAMP` (valid on strict MySQL too), and the DB version was bumped so existing installs self-repair on update. Verified end to end on a clean install (activate → read → create → display).
* Fixed (WP.org interface review): as defense in depth, the admin screen is now also resilient to stray output corrupting its AJAX responses, which can surface as "Connection error. Please try again." Defense in depth: (1) the AJAX handler silences database error printing for the request (still logged via WP_DEBUG_LOG); (2) it buffers the response and strips any noise emitted before the JSON payload — e.g. a notice or echo from another active plugin on the site; (3) the admin JavaScript parses responses defensively, recovering the JSON payload even if something prepends or appends text to the body.
* Added: a "WP_DEBUG" indicator badge in the admin header so it is obvious at a glance when debug mode is active (mirrors the value already shown in Support Info).

= 1.0.2 — 2026-05-13 =
* WP.org compliance: removed all hard caps. The free plugin no longer enforces per-month repair limits, customer limits, repair-type limits, photo-per-repair limits, or staff limits — and the boot-data array that exposed those limits to JS is gone. The dashboard's Pro-features box no longer documents trialware-style caps.
* Migrated the License-Key field and the entire Staff system (CRUD, AuthTokens, Intake PWA, DB table) to the separate Vollstart Repair Desk Pro plugin at vollstart.com. The free plugin no longer ships any license or staff code.
* Migrated invoice-PDF generation (tax-rate / tax-label / VAT-ID rendering, ~300 LOC) from the free plugin to the Pro add-on. The free plugin retains the repair-receipt PDF and the device / customer report PDFs; their render helpers are now public so Pro can compose the invoice from the same building blocks.
* Options framework: switched to a section-based extension filter (`vollstart_rd_option_sections`) — Pro can inject options into existing Free sections by key (Tax under General, email-body templates under Email Notifications, pickup-reminder body under Pickup Reminder, customer-facing rating settings under Ratings) and register its own new sections (License at top, Invoice PDF, SMS, Cost Tracking, Billing, Catalog, Maintenance, Warranty, Customer Points, Staff Intake, Customer Portal, Branding). Options UI sticky-nav is alphabetical; the form content follows the array order so License lands at the top.
* New extension hooks for Pro: `vollstart_rd_enrich_repair`, `vollstart_rd_enrich_repair_response`, `vollstart_rd_enrich_status_log_entry`, `vollstart_rd_pdf_repair_data`, `vollstart_rd_handle_two_segment_route`, `vollstart_rd_query_vars`, `vollstart_rd_options_for_js`, `vollstart_rd_option_sections`, `vollstart_rd_support_info`.
* Security: new `VollstartRD::sanitizePostArray()` helper sanitizes `$_POST` at every AJAX entry point (wp_unslash + sanitize_text_field, with sanitize_textarea_field for declared textarea fields) before reaching manager methods.
* Security: all dynamic table/column names in `db.php` now use `%i` identifier placeholders in `$wpdb->prepare()` (WordPress 6.2+).
* Compatibility: switched the WooCommerce-detection checks from `class_exists('WooCommerce')` to `function_exists('WC')` so the check no longer triggers the WP 6.7 "translation loaded too early" notice.
* Frontend: the status-page QR-overlay URL no longer assumes `wp-admin/admin-ajax.php` location — uses `home_url('/')` via a new `siteUrl` localize key.
* Repair Receipt + basic PDF format options (paper size, font, margin, direction, the 8 receipt visibility toggles and footer text) live in Free again so the receipt PDF renders correctly without Pro installed.
* README: dropped the "Unlimited limits" trialware doc and scrubbed Pro features (Customer Portal, Repair Intake PWA, Staff Management) from the Core Features / Description / Screenshots so the free plugin only advertises features it actually ships.
* API: `VollstartRD_Options::makeOption()` is now public so add-on plugins can build option entries without duplicating the helper.
* API: `VollstartRD_Notifications` exposes `getBusinessEmail()`, `getBusinessName()`, `getBusinessPhone()` (new), `getCustomerForRepair()`, `replacePlaceholders()`, `sendHtmlEmail()`, `logEmail()` as public so add-on plugins can build their own notification emails without duplicating ~150 lines of helper code.

= 1.0.1 - 2026-05-05 =
* WP.org compliance: removed all premium feature gates and trialware locks. Limits are filterable defaults (`vollstart_rd_max_repairs_per_month`, `_max_customers`, `_max_repair_types`, `_max_photos_per_repair`, `_max_staff`) with neutral error messages, no "Upgrade to Pro" wording.
* Premium code extracted from free plugin: catalog/inventory, cost tracking & work items, billing summary, custom statuses, step materials, hourly rate / time-based pricing, customer portal (PWA), maintenance reminders, warranty tracking, WooCommerce integration, external rating system, PDF customization (paper, font, margins, RTL, show staff/timeline) and email body customization. The Pro add-on registers these via filters and a JS handler — the free plugin no longer ships unused premium code.
* PDF generation moved to the free plugin: receipts, device reports and customer reports work without Pro. PDF customization options and invoice PDFs (with cost tracking) remain Pro.
* Footer label: `VollstartRD::getFooterLabelHtml()` and `getFooterLabelText()` render an optional credit link on the status page, customer portal, and PDF footer — filtered through `vollstart_rd_footer_label_html` / `vollstart_rd_footer_label_text`. Shown only when the admin enables the `showFooterLabel` option (off by default).
* Admin shell rewritten: `renderPage()` ships only `<div id="rd-app">` with a centered spinner; JS `bootApp()` renders header, tabs, content, footer and roadmap overlay after the Pro JS has loaded. Pro extends through `_proHandler.getTabs/beforeRender/afterRender` callbacks.
* New extension filter `vollstart_rd_options` so the Pro plugin can register its own option rows + section headings without touching the free options class.
* Roadmap rewrite: PDF receipts/reports, repair intake PWA, device repair history and internal rating moved to free tier; customer portal, custom statuses, cost tracking, billing, WooCommerce, maintenance/warranty reminders, external rating remain premium.
* Removed silent Pro plugin auto-upgrade that was triggered when a license key was saved. Updates go through the standard WordPress plugin update flow.
* Library: TCPDF updated from 6.7.7 to 6.11.3. Single-source `getTcpdfVersion()` helper in support info shows the bundled version, plus a warning when a sister plugin has loaded a different copy ("6.11.3 (loaded: 6.4.4)").
* Security: hardened upload handler — `$_FILES` metadata is sanitized at the entry point and the mime type is always re-derived from the filename via `wp_check_filetype()` (no fallback to attacker-controlled `$_FILES[...]['type']`). Pro AJAX filter receives `wp_unslash()`-cleaned data.
* New: "First Activated" date in Support Info — shows when the plugin was first activated, included in the copyable support text. Marked as "(estimate)" for installs predating this version.
* UI: card-action buttons consistently right-aligned via `.rd-card-actions` wrapper; toolbar switched to `display: block` + `text-align: right`; new `.rd-info-box` helper with a single `infoBox(html)` JS function used at the top of Repair Types and Work Steps tabs. PDF footer now carries the branding link centered under the document code.
* Internal: added `vollstart_rd_pre_create_repair` / `post_create_repair`, `pre_update_repair` / `post_update_repair`, `pre_change_status` / `post_change_status`, `vollstart_rd_status_definitions`, `vollstart_rd_admin_boot_data`, `vollstart_rd_license_info`, `vollstart_rd_ajax_action` extension hooks for the Pro plugin.

= 1.0.0 - 2026-04-20 =
* Initial release
* Repair management with configurable status flow and timeline
* Customer database with contact info and repair history
* Device and product tracking linked to repairs and customers
* Repair types catalog with estimated duration and pricing
* Work steps with checklists, time tracking, and auto-progress
* Photo uploads for intake documentation
* QR code per repair with public status page
* Customer portal as progressive web app with secure token access
* Customer messaging system (configurable: read-only, reply, or full)
* Email notifications on status changes
* Pickup reminder emails via WP-Cron
* Staff management with auth tokens
* CSV export for repairs, customers, and devices
* GDPR tools: data export, anonymization, and deletion
* WordPress dashboard widget
* Bulk actions: status change, print QR labels, delete
* Rating system for internal staff rating and customer feedback
