Commit Graph
535 Commits
Author SHA1 Message Date
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