Commit Graph
100 Commits
Author SHA1 Message Date
Jeppe Bundgaard dd57c945e6 Imported XLVask v1.yaml from https://api.xlwash.com/scalar/ 2026-01-06 09:17:59 +01:00
Jeppe Bundgaard ed53d16d6c Expand openapi.yaml with endpoints for superuser authentication, invoicing distributions, backup module management, and button press recording. 2026-01-05 13:14:37 +01:00
Jeppe Bundgaard f91b855545 Expand openapi.yaml with endpoints for order bookings, department daily reports, and related management operations. 2026-01-05 13:08:58 +01:00
Jeppe Bundgaard c58e385cfd Expand openapi.yaml with endpoints for notifications, Stripe payment processing, e-conomic integration, and Stripe terminal management. 2026-01-05 12:34:33 +01:00
Jeppe Bundgaard 7705fc8a09 Expand openapi.yaml with endpoints for orders, vehicles, departments, and economic statistics. 2026-01-05 12:12:00 +01:00
Jeppe Bundgaard c8b83c63d3 Expand openapi.yaml with endpoints for branding, roles, permissions, department management, and module operations. 2026-01-05 12:04:31 +01:00
Jeppe Bundgaard 5c0092125e Expand openapi.yaml with endpoints for role management, user permissions, customer data, and superuser operations 2026-01-05 12:03:45 +01:00
Jeppe Bundgaard 568ad065d9 Expand openapi.yaml with branding options management 2026-01-05 12:02:26 +01:00
Jeppe Bundgaard 756a8eca1a Expand openapi.yaml with new endpoints for department lanes, worker operations, license plate scanning, invoicing, and configuration management. 2026-01-05 11:50:36 +01:00
Jeppe Bundgaard 54c16b06e7 Send wash certificate email to the customer if a booking is associated 2026-01-02 11:18:10 +01:00
Jeppe Bundgaard bcca9dd319 Add getOrderBooking method to fetch linked booking object for orders 2026-01-02 11:18:06 +01:00
Jeppe Bundgaard e5c728f703 Cast department ID to integer and license plate to string in self-serve lane invoice creation 2025-12-18 11:09:58 +01:00
Jeppe Bundgaard 3115856fc8 Remove redundant return statement in Shelly relay control logic 2025-12-16 11:41:00 +01:00
Jeppe Bundgaard 3eef3b45c4 Add customer number validation and bypass mechanism for self-serve lane operations
- Introduced customer number validation during STOP command to ensure the lane's customer matches the provided customer number.
- Added a flag and methods to bypass customer number validation when authorized.
- Updated routes to set the bypass flag for users with appropriate permissions.
- Included customer number in command arguments for enhanced validation.
2025-12-16 11:40:41 +01:00
Jeppe Bundgaard b6371455ca Enforce command-specific permissions for self-serve lane operations and update related tests 2025-12-15 16:00:00 +01:00
Jeppe Bundgaard 46c7a2f2cd Add http-client.env.json for HTTP client test environment configuration 2025-12-15 10:34:48 +01:00
Jeppe Bundgaard fff5637fe6 Refactor self-serve.http tests to use dynamic variables for API URL, customer number, license plate, and lane ID 2025-12-15 10:34:42 +01:00
Jeppe Bundgaard 4e1404f070 Add invoices-pdf.http test for invoice PDF endpoint validation 2025-12-15 10:33:14 +01:00
Jeppe Bundgaard d0bd305b0b Add orders-potential-duplicates.http test for endpoint validation 2025-12-15 10:32:16 +01:00
Jeppe Bundgaard 761096495a Update numberplatescans.http to use dynamic variables for API URL, plate, bay ID, and authorization token 2025-12-15 10:30:59 +01:00
Jeppe Bundgaard 06e0f58ce2 Fix mismatched array brackets in plateScansRoute response structure 2025-12-15 10:25:47 +01:00
Jeppe Bundgaard 5a71889b26 Add support for optional bayId in license plate scans
- Updated `plateScansRoute` to handle an optional `bay_id` parameter in plate scan requests.
- Extended `plate_scans_o` object to include `bay_id` property and related database operations.
- Enhanced `add` method to validate and process `bayId` if provided.
2025-12-15 10:14:00 +01:00
Jeppe Bundgaard 9c9df0f1f4 Validate access and booking status for retrieving invoice PDFs
- Added validation to ensure the user owns the invoice and it has been booked before generating the PDF.
- Updated logic to retrieve and store booked invoice PDFs using the correct `booked_invoice_id`.
- Improved error handling for unauthorized access and unbooked invoices.
2025-12-10 14:22:37 +01:00
Jeppe Bundgaard f8af8cae46 Add lane management extensions to department functionality
- Introduced `getLanes` method in `departments_o` to retrieve associated lanes.
- Extended `department_lanes_o` with `getLaneStatus` and `getDepartmentLanes` methods for lane data handling.
- Updated guest route to support `include_lanes` parameter, enabling retrieval of lanes and their statuses for departments.
- Enhanced response structure with lane information when requested.
2025-12-09 14:38:59 +01:00
Jeppe Bundgaard 3cbce2a68f Add detailed customer booking notifications with message formatting
- Enhanced booking notifications to include comprehensive customer and booking details.
- Implemented message formatting for clarity: customer info, date, vehicle(s), items, references, PO, and pickup status.
- Improved notification structure by integrating branding name into messages.
2025-12-09 10:58:34 +01:00
Jeppe Bundgaard 68e93fdd9d Add relay_machine_id property to department_lanes_o object and extend related functionality
- Introduced `relay_machine_id` to `department_lanes_o` for managing Shelly relay associated with machines.
- Updated `add` method and database interactions to support the new property.
- Included `relay_machine_id` in `asArray` and field initialization logic.
- Enhanced `departmentLanesRoute` to handle `relay_machine_id` via API for creation and updates.
2025-12-09 10:26:32 +01:00
Jeppe Bundgaard 1b914b546e Add minute-based billing and lane management extensions to self-serve module
- Introduced `selfserve_lane_command_arguments` class for managing lane command parameters (e.g., customer number, license plate).
- Added traits for handling lane timer, invoice generation, license plate, and customer number management.
- Implemented minute-based billing logic with `selfserve_minute_product_c` configuration.
- Enhanced `selfserve_lane` with new behaviors: command arguments, invoicing, and time handling.
- Added `/modules/self-serve/lane/command` route for executing lane commands (START, STOP, RESET).
- Updated `/modules/self-serve/lane/status` route to include additional lane details (wash start, elapsed time, license plate, etc.).
- Improved Shelly device relay control for port management.
2025-12-08 23:05:35 +01:00
Jeppe Bundgaard cc6639e61b Introduce self-serve module with lane management functionality
- Added `selfserve_lane` class to handle self-serve lane operations.
- Implemented commands (START, STOP, RESET) and states (IDLE, IN_WASH, FAULT, etc.) for lane lifecycle.
- Introduced traits for managing lane status, mode, state, caching, and port control.
- Added enums for cohesive type definitions (`selfserve_lane_command`, `selfserve_lane_status`, `selfserve_lane_state`, etc.).
- Configured `/modules/self-serve/lane/status` route to expose lane state and status via API.
- Linked self-serve configuration via `selfserve_c` and `selfserve_enabled_c` for module toggling.
- Integrated lane caching logic with Redis for performance improvements.
- Updated `index.php` to include the self-serve module.
2025-12-08 15:34:40 +01:00
Jeppe Bundgaard d3d3657dfd Generate and attach wash certificate to orders
- Added `generateWashCertificate` method to `orders_o` for wash certificate PDF generation and attachment.
- Introduced `OTHER_TYPE_WASH_CERTIFICATE` constant in `attachment_content` for new attachment type.
- Added `/order/wash-certificate` route to provide wash certificate generation functionality via API.
2025-12-03 08:45:13 +01:00
Jeppe Bundgaard 3c46ee86ec Add routes for worker version management
- Introduced `/worker/version` route to retrieve current worker target version.
- Added `/worker/update-version` route to update worker target version with permission and parameter validation.
2025-12-01 15:01:25 +01:00
Jeppe Bundgaard b45e270fed Skip transactions not included in invoicing
- Updated `customer_vehicles_o` to exclude transactions not marked for invoicing during processing.
2025-12-01 13:20:07 +01:00
Jeppe Bundgaard d2f82b83ed Validate subscription price distribution and skip excluded transactions in invoicing
- Enforce validation to ensure department distribution matches total subscription price.
- Skip transactions not included in invoicing for improved accuracy.
- Uncomment permission checks in specific routes.
2025-12-01 13:19:59 +01:00
Jeppe Bundgaard d3a8d0d83d Add enabled property to accounts_o
- Introduced `$enabled` property to `accounts_o` for managing account status.
- Updated property initialization and `asArray` method to include `enabled`.
2025-11-28 10:48:59 +01:00
Jeppe Bundgaard ce51feb9ab Add caching logic to accounts_o and enhance asArray method
- Implemented cache invalidation in `objectChanged` method.
- Enhanced `asArray` method with caching support and type casting.
- Added cache expiration and retrieval logic to improve performance.
2025-11-28 10:44:03 +01:00
Jeppe Bundgaard 935af48b44 Add $asArrayCacheKey property to db_object_t for caching support
- Introduced `$asArrayCacheKey` as a dedicated property for `asArray` method caching.
2025-11-28 10:43:44 +01:00
Jeppe Bundgaard 1cdaa230d8 Add accounts_o object for account management
- Implemented `accounts_o` class with account properties (`phone`, `country_code`, `name`, etc.).
- Added `add` method for creating new account entries with input sanitization and default values.
- Introduced `asArray` method for converting object data into array format.
- Included property initialization in `getObjectProperties` for `accounts_o` object.
- Set up table structure and placeholders for caching logic in `objectChanged`.
2025-11-28 10:32:52 +01:00
Jeppe Bundgaard 8302b05028 Add cashier name retrieval and caching logic to orders processing
- Introduced `getCashierName` method in `users_o` for cashier name retrieval.
- Added caching for cashier names with dedicated expiration settings.
- Updated `ordersRoute` to include cashier names in order details.
- Added `$cashierNameCacheExpiration` property in `db_object_t` for centralized cache control.
2025-11-27 15:08:07 +01:00
Jeppe Bundgaard 542596b5a0 Refactor customer email retrieval logic in booking and email handling
- Replace direct wash certificate email retrieval with `getWashCertificateEmail` method.
- Fallback to default email if no certificate-specific email exists.
- Adjust email assignment in booking notifications to use consistent logic.
2025-11-27 10:50:49 +01:00
Jeppe Bundgaard 2ec936225c Refactor booking notifications and product restriction logic
- Enable department notification for new bookings.
- Enhance Slack notification details for bookings, including customer, vehicle, and items.
- Replace `isGuest` with `isProductDetailsRestricted` for better clarity in `productsRoute`.
- Adjust product parsing to handle restricted product details consistently.
2025-11-27 10:25:53 +01:00
Jeppe Bundgaard 667947fcda Add guest user handling and product filtering in productsRoute
- Implement guest-specific product redactions (e.g., hide names, reset prices).
- Refactor `parseProduct` to include guest context for dynamic response handling.
- Add authentication checks and guest user handling for accurate permission validation.
- Update logging to include guest or user context in actions.
- Adjust product and addon parsing for consistent guest visibility.
2025-11-26 13:29:53 +01:00
Jeppe Bundgaard 7961217a91 Add isAuthenticated method to route_t for user authentication check 2025-11-26 13:29:40 +01:00
Jeppe Bundgaard ecd44a455a - Add Redis mget method and cache management improvements
- Update cache expiration times for `economicCustomerName` and `isBooked` objects
- Introduce `getCachedForMultipleObjects` for batch cache retrieval
- Optimize `isBooked` with optional caching and update to store results
- Implement `getCustomerNames` in `users_o` with caching for bulk name retrieval
- Refactor customer transaction handling in `InvoicingPeriodRoute` for efficiency
- Filter orders excluded from invoicing in `collected_order_invoices_o`
2025-11-26 10:01:24 +01:00
Jeppe Bundgaard 7e9c456074 Deprecate book_wash_f methods with exception messages
- Added deprecation exceptions in `beforeSave` to guide users to the new booking page and updated booking object usage.
2025-11-25 15:27:56 +01:00
Jeppe Bundgaard 3dba2dedac Add isIncludedInInvoicing method and implement invoicing exclusions
- Introduced `isIncludedInInvoicing` in `orders_o` to check department-based invoicing exclusions.
- Updated routes and methods to skip orders excluded from invoicing.
- Refined transaction and order handling to respect invoicing settings, ensuring correct filtering.
2025-11-25 14:39:49 +01:00
Jeppe Bundgaard 537582e44d Add isExcludedFromInvoicing method to departments_o
- Introduced `isExcludedFromInvoicing` to check if a department is excluded from invoicing.
- Ensured selected department validation before retrieving exclusion status.
2025-11-25 13:04:57 +01:00
Jeppe Bundgaard 449908c833 Handle null values consistently and add deleted_at checks in vehiclesRoute queries
- Updated `db_object_t` to treat both `null` and string `'null'` as null values for filtering.
- Added `deleted_at IS NULL` condition in `vehiclesRoute` booking-related queries to exclude soft-deleted entries.
2025-11-24 15:48:15 +01:00
Jeppe Bundgaard 36d902d833 Add department-based filtering to vehicle search
- Introduced optional `department` parameter in `vehiclesRoute` for filtering booked registrations.
- Validated `department` input to ensure existence and access rights.
- Updated `getBookedRegs` to support dynamic filtering with department-specific criteria.
2025-11-24 13:23:44 +01:00
Jeppe Bundgaard 67927f8ab8 Refactor booking logic and table references for order_bookings
- Updated booking-related queries to use `order_bookings_o` for improved consistency and clarity.
- Replaced `regNrTraekker`/`regNrTrailer` with `reg_1`/`reg_2` in queries and results.
- Added `NULL` condition handling in `db_object_t` to support filtering by null field values.
- Enhanced booking data extraction with renamed fields (`reference_number` → `reference`, `notes` → `note`).
2025-11-20 15:54:00 +01:00
Jeppe Bundgaard 6d49befd22 Add /guest/departments endpoint for paginated department retrieval
- Introduced `GET /guest/departments` in `guestRoute` to fetch departments with pagination.
- Limited response to include only `id` and `name` fields for streamlined output.
2025-11-20 13:13:16 +01:00
Jeppe Bundgaard b4f208d30d Increase default pagination limit in customerSearchRoute from 10 to 100 2025-11-19 13:35:10 +01:00
Jeppe Bundgaard 0cf7b99440 Add conditional validation and default handling for email and phone parameters in authRoute
- Introduced parameter checks to ensure validation only occurs if fields are set and non-empty.
- Added default values for missing `email` and `phone` fields to improve robustness.
- Adjusted logic to use `companyPhone` and default email (`jb@truckwash.dk`) when applicable.
2025-11-19 13:28:29 +01:00
Jeppe Bundgaard eb1dec1d0e Refactor order update logic into updateOrder method
- Moved redundant order update logic to a centralized `updateOrder` method for better code reuse.
- Simplified route definitions in `ordersRoute` by delegating updates to the new `updateOrder` method.
- Added `NoReturn` attribute for improved type hinting and error handling.
2025-11-18 12:32:44 +01:00
Jeppe Bundgaard 32de29127a Fix product price typecasting and improve product parsing in productsRoute
- Corrected typecasting for product prices to ensure consistent integer values.
- Enhanced product parsing logic for better modularity and data handling in `productsRoute`.
2025-11-18 11:06:33 +01:00
Jeppe Bundgaard bdfce96500 Comment out permission check in /guest/cvr/search for future removal. 2025-11-17 18:24:11 +01:00
Jeppe Bundgaard dfeffed63f Optimize product retrieval by department categories and improve filtering in productsRoute
- Refactored `getAllProductInDepartmentCategories` in `departments_o` using `array_reduce` for cleaner and more efficient category loop.
- Enhanced `productsRoute` to filter department-specific products using IDs for stricter matching.
2025-11-17 14:17:05 +01:00
Jeppe Bundgaard 2d121c67cd Add product retrieval by department categories and typecasting fixes
- Added methods in `department_categories_o`, `departments_o`, and `categories_o` to retrieve products associated with department categories.
- Updated `productsRoute` and `superuserDepartmentRoute` to fetch department-specific products.
- Fixed typecasting in product price assignments for improved data consistency.
2025-11-17 14:10:25 +01:00
Jeppe Bundgaard 5b01644c0a Add CVR handling to guest and auth routes with virkdata integration
- Introduced `/guest/cvr/search` endpoint in `guestRoute` for company search using CVR.
- Added `/auth/register/cvr` endpoint in `authRoute` to handle CVR-based registration with validation.
- Enhanced `virkdata` with `searchCompanies` and improved response handling for search requests.
- Updated E-conomic integration to check for existing CVR registrations and create new customers where needed.
2025-11-17 13:20:12 +01:00
Jeppe Bundgaard a22fc3fab0 Add support for including additional product categories in exterior washes
- Adjusted `productsRoute` to include products from categories "1" and "3" when category "6" is requested.
- Merged additional products to ensure comprehensive category listings.
2025-11-13 12:32:15 +01:00
Jeppe Bundgaard 01528280a6 Add guest endpoint for validating customer number existence
- Introduced `POST /guest/validation/customer-number` in `guestRoute` to validate customer number existence.
- Implemented checks for required parameter format and range.
- Integrated `users_o` to verify if the customer number exists.
2025-11-13 10:02:58 +01:00
Jeppe Bundgaard e45ab68959 Add admin endpoint for fetching customer names and enhance order booking object with parsed product names
- Introduced `GET /admin/customer/name` endpoint in `userRoute` to retrieve customer names by user ID.
- Enhanced `order_bookings_o` with product name parsing for booking items.
- Added `customer_name` retrieval to `asArray` method in `order_bookings_o`.
- Implemented private `parseProductNames` method for item details parsing in `order_bookings_o`.
2025-11-12 13:21:22 +01:00
Jeppe Bundgaard 0b566ee725 Add validation for required file parameters in file_server.php
- Added checks for missing file name and file extension.
- Improved error handling with descriptive messages for missing parameters.
2025-11-11 15:39:03 +01:00
Jeppe Bundgaard 5193038bea Send wash certificate email to customers during order bookings
- Added `sendWashCertificateToCustomer` method in `order_bookings_o` to handle email sending for wash certificates.
- Implemented `sendWashCertificateEmailToCustomer` in `email` to generate and attach wash certificate PDFs.
- Updated attachment permission logic in `ordersRoute` and `db_object_t`.
- Changed `object_attachments_o` property types and handling for improved attachment processing.
2025-11-11 15:32:10 +01:00
Jeppe Bundgaard 65bf42d3e3 Update email recipient logic for wash certificate bookings
- Added conditional logic to prioritize `wash_certificate_email` if provided for customer notifications.
- Refactored email setup to use the selected email for wash certificate-related bookings.
2025-11-11 15:03:42 +01:00
Jeppe Bundgaard 8b2aa76070 Add methods to handle user notification preferences and update booking notification logic
- Introduced `wantsSmsNotifications`, `wantsEmailNotifications`, and `getWashCertificateEmail` methods in `users_o`.
- Updated `order_bookings_o` to incorporate user notification preferences for sending SMS and email confirmations.
2025-11-11 14:48:32 +01:00
Jeppe Bundgaard eca3b79f26 Add userNotificationsRoute to manage user notification settings
- Introduced new endpoint to update user notification preferences (email, SMS, wash certificate notifications).
- Enhanced `users_o` with new properties: `sms_notifications_enabled`, `email_notifications_enabled`, and `wash_certificate_email`.
- Added methods to set notification preferences in `users_o`.
2025-11-11 14:34:29 +01:00
Jeppe Bundgaard 664ed6410d Update email booking confirmation template to unify registration number labels 2025-11-11 13:38:35 +01:00
Jeppe Bundgaard ccb049519c Add support for customer booking notifications and phone number updates
- Introduced phone number update functionality in `userSecurityRoute`.
- Enhanced `order_bookings_o` to send booking confirmations to customers via SMS and email.
- Added `sendOrderBookingConfirmationEmail` method in `email` for HTML-based email notifications.
- Updated `notifyNewBooking` to include customer confirmation logic with SMS and email.
- Adjusted `users_o` to make phone and email properties public and added `setPhoneNumber` method.
- Optimized notification logic in `order_bookings_o` with department and customer-specific notifications.
2025-11-11 13:24:32 +01:00
Jeppe Bundgaard 7f838c0961 Refactor conditional logic in db_object_t and implement booking notifications in order_bookings_o
- Optimized conditional checks and improved value handling (null, boolean, numeric, strings) in `db_object_t`.
- Added `notifyNewBooking` method in `order_bookings_o` to handle department notifications for new bookings.
- Updated Slack message template for booking notifications.
2025-11-11 11:49:00 +01:00
Jeppe Bundgaard d58f61f80d Refactor attachment permissions in ordersRoute
- Introduced separate permissions for listing all order attachments and own order attachments.
- Added conditional logic to verify ownership of orders for `list_own_order_attachments` permission.
- Improved error responses for unauthorized access to order attachments.
2025-11-11 11:22:23 +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 a6d427e3d3 Enhance error handling in productsRoute for customer retrieval
- Added exception handling with logging when fetching customer by ID fails.
- Improved safety checks to ensure customer existence before returning the object.
- Return `null` in case of failure to prevent unhandled errors.
2025-11-10 16:59:41 +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 af70b11ad4 Fix logical issue in null value checks for db_object_t where clause construction
- Corrected conditional logic to handle 'is null' string case.
2025-11-10 12:34:40 +01:00
Jeppe Bundgaard ed7ace3a1b Update completeBooking method TODO to include price re-calculation for customer-specific adjustments 2025-11-10 12:13:38 +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 f206e7f4fb Add JSON type support in object property handling
- Added `json` to the list of valid types for object properties.
- Implemented JSON decoding for column values when the type is `json`.
2025-11-05 13:16:31 +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
Jeppe Bundgaard 6f1fc86656 Fix typo in collected order invoice logic comments 2025-11-04 16:58:52 +01:00
Jeppe Bundgaard fbce187787 Add Writerside-based API Reference setup for Bookings_OpenAPIv1
- Introduced new Writerside configuration files and topics for API documentation.
- Added build profiles, variables, and categories setup.
- Created API topics covering various endpoints including bookings, user operations, and administrative tasks.
2025-11-04 16:58:05 +01:00
Jeppe Bundgaard bfed2f231a Add new free subscription addon for "Undervognsskyld pr. enhed" in invoice collection logic 2025-11-04 13:53:01 +01:00
Jeppe Bundgaard dbc96fd0b4 Remove attribute for all associated customers if customer number exists; prevent re-adding exception in invoice collection logic. 2025-11-04 10:29:34 +01:00
Jeppe Bundgaard 6814dcd904 Update booking status logic based on wash certificate conditions
- Ensure `status` is set to `completed` if wash certificate PDF exists but status is not already `completed`.
- Update `washCertificateStatus` to `completed` when `status` is `completed` and it is initially `pending`.
- Adjust `wash_certificate_pdf` and `status` logic in the returned booking object.
2025-10-28 12:32:43 +01:00
Jeppe Bundgaard af6b89ff54 Enhance authentication logic for customers with default passwords
- Added a check to ensure customers with group ID other than 0 cannot use default passwords.
- Implemented logic to auto-set passwords to the last 4 digits of the customer number if no password is set.
- Updated method documentation to include an `@throws Exception` annotation.
2025-10-28 11:06:18 +01:00
Jeppe Bundgaard d06f0cedc3 Add new properties and routes for product and booking enhancements
- Added `virtual_cart` property in `bookings_o` and enhanced its structure method.
- Introduced `display_in_booking_form` and `order_priority` properties in `products_o` with updates to object structure, parsing, and routes.
- Enabled handling of product attributes `display_in_booking_form` and `order_priority` in `productsRoute`.
- Added `booked_invoice_id` reset logic in `collected_order_invoices_o`.
- Introduced `machineButtonPressRoute` to log button press incidents and send Slack notifications.
2025-10-28 09:58:29 +01:00
Jeppe Bundgaard 30b94e89d7 Add PO number support and enhance permissions for order management
- Introduced `po` property in `orders_o` for handling Purchase Order (PO) numbers, including API integration for retrieval and validation.
- Enhanced customer permissions to allow limited order editing (`po` updates) and attachment downloads for their own orders.
- Added new helper methods to `users_o` for attributes like `showPricesOnBookingPage` and `usePONumbers`.
- Improved order item listing logic with distinct permissions for customers' own orders and price visibility.
- Implemented numeric value casting in filters within `db_object_t`.
2025-10-22 11:38:35 +02:00
Jeppe Bundgaard b78d9e0e63 Add email blacklist check to prevent sending to specific addresses
- Added a static blacklist in `sendEmailMailerSend` to skip sending emails to blacklisted addresses.
- Implemented a return condition if the recipient email matches the blacklist.
2025-10-21 08:39:36 +02:00
Jeppe Bundgaard c83aa23312 Add department lanes object and API routes
- Created `department_lanes_o` object to handle department lane operations and data.
- Introduced `/department/lanes` routes for listing, adding, and updating department lanes.
- Integrated user permission checks and logging for route actions.
- Included pagination and filtering capabilities for data retrieval.
2025-10-16 09:42:26 +02:00