Files
orderPRO/database/migrations/20260322_000058_create_print_tables.sql
Jacek Pyziak 02d06298ea feat(19-ui-integration): przycisk Drukuj, bulk print, kolejka wydruku
- Przycisk "Drukuj" w prepare.php i show.php z AJAX + duplikat protection
- Bulk print z listy zamówień (checkboxy + header action)
- Kolejka wydruku w Ustawienia > Drukowanie (filtr statusu, retry)
- POST /api/print/jobs/bulk endpoint (package_ids + order_ids)
- ensureLabel() auto-download przez ShipmentProviderRegistry
- Apaczka carrier_id = nazwa usługi, kolumna Przewoznik
- Tab persistence (localStorage), label file_exists check
- Fix use statement ApaczkaApiClient, redirect po utworzeniu przesyłki
- Phase 17 (receipt duplicate guard) + Phase 18 (print queue backend) docs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 21:16:54 +01:00

29 lines
1.3 KiB
SQL

-- Print API keys for remote printing authentication
CREATE TABLE IF NOT EXISTS print_api_keys (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(128) NOT NULL,
key_hash VARCHAR(128) NOT NULL,
key_prefix VARCHAR(8) NOT NULL,
is_active TINYINT(1) NOT NULL DEFAULT 1,
last_used_at DATETIME NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE INDEX print_api_keys_hash_unique (key_hash),
INDEX print_api_keys_active_idx (is_active)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Print jobs queue for remote label printing
-- No FK constraints: order_id/package_id types may vary across environments
CREATE TABLE IF NOT EXISTS print_jobs (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
order_id BIGINT UNSIGNED NOT NULL,
package_id BIGINT UNSIGNED NOT NULL,
label_path VARCHAR(255) NOT NULL,
status ENUM('pending', 'printing', 'completed', 'failed') NOT NULL DEFAULT 'pending',
created_by INT UNSIGNED NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
completed_at DATETIME NULL,
INDEX print_jobs_status_idx (status),
INDEX print_jobs_order_idx (order_id),
INDEX print_jobs_package_idx (package_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;