Commit Graph
26 Commits
Author SHA1 Message Date
Jeppe Bundgaard bea7e5697b Handle empty inputs in Redis and database operations, improve safety seal validation, and enhance related tests
- Return empty arrays for empty inputs in Redis `mget`, `db_object_t`, and `users_o` operations.
- Refactor safety seal validation logic to handle numeric strings and improve clarity.
- Add unit and API tests to verify handling of empty inputs and numeric safety seal strings.
2026-05-11 04:36:11 +02:00
Jeppe Bundgaard a71bde3211 Remove legacy booking completion forms and related logic
- Deleted `complete_booking_f` and `generate_booking_wash_certificate_f` classes.
- Updated tests to ensure legacy booking completion routes are disabled.
- Introduced tests for POST `/order-bookings/complete` to enforce POS-based booking completion management.
- Added `/collected-invoices/split-by-month` route with API and unit tests for splitting collections into monthly periods.
- Refactored impacted files to exclude legacy references and ensure continued compatibility with POS processes.
2026-05-06 14:02:48 +02:00
Jeppe Bundgaard 7d450e285e Remove outdated edge gateway object classes, add new agent implementation
Transitioned from obsolete gateway object classes (`edge_gateway_shell_action_jobs_o`, `edge_gateway_shell_events_o`, `edge_gateway_shell_sessions_o`, `edge_gateway_update_jobs_o`) to the new agent implementation (`edge-gateway-agent/agent.php`).
2026-04-21 14:13:17 +02:00
Jeppe Bundgaard 6b928cfce7 Add PreRenderDynamicImagesCron for dynamic image variant caching and idempotency guard for order bookings. 2026-03-18 13:59:48 +01:00
Jeppe Bundgaard 90acf50b55 Add idempotency handling for order booking creation using Redis to prevent duplicate requests. 2026-03-18 13:42:47 +01:00
Jeppe Bundgaard f265a83034 Refactor route_t and orderBookingRoute to simplify permission handling
- Add reusable helpers: `isOwnCustomerContext`, `resolveEffectiveCustomerNumber`, and `allowOwnOrDepartmentAccess` in `route_t` for streamlined permission checks.
- Replace inlined permission logic in `orderBookingRoute` with common helpers for creating, viewing, editing, and deleting bookings.
- Localize permission names, descriptions, and labels to Danish across relevant modules.
- Improve error handling and simplify context resolution for subuser and department-level permissions.
2026-02-12 15:43:02 +01:00
Jeppe Bundgaard cd894b4e3b Refactor orderBookingRoute to integrate subuser-specific permission checks
- Add dynamic authentication and subuser permission handling using `subusers_permission_node_key`.
- Refactor route-level permission logic for creating, viewing, editing, and deleting bookings to respect subuser context.
- Ensure proper error handling for unauthorized access and enforce departmental scope for admin-level actions.
2026-02-12 15:37:03 +01:00
Jeppe Bundgaard 497ef1496b Add subuser permission evaluation system and extend subuser-related route handling
- Introduce `hasPermission` method in `subusers_o` for permission checks tied to customer context.
- Update `/subusers/me` route to return subuser grants with normalized permissions and metadata.
- Add `get_subuser_customer_number_target` in `authentication` to resolve customer context from request headers.
- Refactor route-level permission checks to handle subuser grants dynamically.
- Introduce CLI test scripts for subuser grants and permission node mappings.
- Add test coverage for subuser grants and permission nodes in new test classes.
2026-02-12 15:29:43 +01:00
Jeppe Bundgaard 953067cba5 Extend subuser session handling and refactor permissions in order booking routes
- Add token creation for subusers in `subusers_o` during session generation.
- Refactor `orderBookingRoute` to use dynamic subuser permission definitions with `subusers_permission_node_key`.
2026-02-12 14:01:05 +01:00
Jeppe Bundgaard 4cada3c677 Add permissions for editing and deleting own order bookings in orderBookingRoute 2025-11-11 10:31:59 +01:00
Jeppe Bundgaard ff7f87475d Handle boolean conversion, null checks, and object sanitization in db_object_t and enhance parameter validation in orderBookingRoute
- Added boolean to integer conversion in `db_object_t` during database operations.
- Improved handling of null values, numeric types, and sanitized inputs in `db_object_t`.
- Enhanced safety seal parameter validation in `orderBookingRoute` with support for nullable integers.
- Updated `getTargetItems` to retrieve product names for each item in the order.
2025-11-11 09:50:18 +01:00
Jeppe Bundgaard 72c028c0fd Prevent editing of bookings with associated transactions
- Added transaction check in `orderBookingRoute` to block edits on bookings tied to transactions.
- Introduced `hasTransaction` method in `order_bookings_o` to verify transaction association.
2025-11-11 08:04:13 +01:00
Jeppe Bundgaard 5333d430c4 Add conditional check for self-request in userRoute and fix customer_number type in orderBookingRoute
- Updated `getUserId` logic in `userRoute` to allow users to fetch their own user ID without requiring additional permissions.
- Corrected `customer_number` type in `orderBookingRoute` to always return an array.
2025-11-10 17:11:29 +01:00
Jeppe Bundgaard a519478788 Implement wash certificate handling for bookings and order processing
- Added functionality to create and attach wash certificates during booking completion.
- Enhanced `completeBooking` to generate and associate wash certificates with orders based on booking items.
- Updated safety seal parameter handling in relevant methods.
- Integrated wash certificate PDF generation with customer branding and order attachment logic.
- Improved file retrieval logic in the `file_server` to handle missing certificates via alternative store lookup.
2025-11-10 15:45:24 +01:00
Jeppe Bundgaard ad55e97b54 Refactor completeBooking method call and add method skeleton in order_bookings_o
- Updated `completeBooking` method call to directly use `$user->id` without `value()` extraction.
- Added `completeBooking` method skeleton in `order_bookings_o` with placeholders for future implementation.
2025-11-10 12:09:22 +01:00
Jeppe Bundgaard d53dd7645b Add POST route for completing order bookings with authentication and permissions
- Introduced `/order-bookings/complete` route to allow marking bookings as complete.
- Implemented authentication checks and department-level access control.
- Added response handling for successful completion or non-existing bookings.
- Commented out Slack notification in machine button press route for future review.
2025-11-10 12:03:04 +01:00
Jeppe Bundgaard b76c4deaa9 Add notification functionality for new order bookings
- Implemented `onAfterNewBooking` and `notifyNewBooking` methods to handle post-booking notifications.
- Added Slack and SMS notifications for departments upon creating new bookings.
- Enhanced error handling and logging for failed encoding and notification delivery.
- Updated `db_object_t` to JSON encode objects and arrays before database operations.
2025-11-10 11:46:22 +01:00
Jeppe Bundgaard 76483313ec Add DELETE route for deleting order bookings with permission checks
- Introduced `/order-bookings` DELETE route to enable deletion of order bookings.
- Implemented robust permission checks for deleting own and departmental bookings.
- Included detailed access control and error handling for unauthorized operations.
- Ensured proper success and error response handling.
2025-11-10 11:05:52 +01:00
Jeppe Bundgaard c0b6ed6972 Add order_id handling in orderBookingRoute
- Added `order_id` extraction logic with validation in `getTargetOrderId` method.
- Included `order_id` in the data update process for order bookings.
- Updated `order_bookings_o` class to support `order_id` property.
2025-11-10 10:31:57 +01:00
Jeppe Bundgaard 7c7cb03641 Relax minimum length requirement for orderBookingRoute parameters to allow empty strings 2025-11-05 15:44:49 +01:00
Jeppe Bundgaard 6013288d05 Refactor orderBookingRoute parameter handling and validation
- Added optional `required` parameter to `getTarget*` methods for flexible parameter validation.
- Improved null handling and safety checks in parameter extraction processes.
- Enhanced error handling for non-existing order bookings with proper response codes.
- Fixed logical operator issue in permission checks for customer number validation.
2025-11-05 15:13:01 +01:00
Jeppe Bundgaard 7f3089f086 Refactor orderBookingRoute parameter extraction and data update logic
- Added default parameter `false` to all `getTarget*` methods for enhanced flexibility.
- Improved conditional checks before constructing update data array with `isset` for null safety.
- Enhanced parameter validation by ensuring customer number is not empty during permission checks.
2025-11-05 14:22:24 +01:00
Jeppe Bundgaard 0f1efd9306 Implement update functionality in /order-bookings PUT route
- Added parameter extraction and validation for updating order bookings.
- Enhanced permission checks for editing own and departmental bookings.
- Implemented detailed access control logic based on user permissions.
- Built logic for updating booking details with strict type handling.
2025-11-05 14:14:18 +01:00
Jeppe Bundgaard 50a1e5a7df Add PUT route for editing order bookings with permissions
- Introduced a new `/order-bookings` PUT route to enable editing of existing bookings.
- Added permission `edit_bookings` for access control.
- Adjusted parameter type handling with explicit casting for validation.
2025-11-05 14:03:03 +01:00
Jeppe Bundgaard b564d8d500 Add order bookings functionality with permissions and access control
- Introduced `order_bookings_o` class for interacting with the `order_bookings` database table.
- Added `hasDepartmentAccess` method to handle department-level permissions.
- Implemented new routes for creating and retrieving order bookings, including pagination support.
- Enhanced access control to differentiate between own and departmental bookings based on permissions.
- Updated input validation and improved error handling for order bookings.
2025-11-05 13:57:12 +01:00
Jeppe Bundgaard 0180523539 Add orderBookingRoute class for handling order bookings
- Introduced a new `orderBookingRoute` to process and validate order booking data.
- Added methods for parameter validation, customer and department identification, and item verification.
- Implemented functionality to handle booking details such as notes, PO numbers, pickup preferences, and datetime inputs.
2025-11-05 12:34:16 +01:00