Commit Graph
186 Commits
Author SHA1 Message Date
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 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 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
Jeppe Bundgaard 6f68713c7a Comment out invoiceAllOrdersIndividually attribute initialization in users_o 2025-10-08 12:53:15 +02:00
Jeppe Bundgaard c6713f6865 Return newly added customer note as array in API response
- Updated `addNote` in `users_o` to return the `customer_notes_o` object.
- Modified `customerNotes` endpoint to include note details in the success response.
- Introduced `asArray` method in `customer_notes_o` for structured API responses.
2025-10-07 23:41:57 +02:00
Jeppe Bundgaard f59852375f Refactor department handling in invoice drafting and order retrieval
- Simplified department retrieval in `economic_invoice_draft.php` by streamlining logic for default department usage.
- Enhanced `getDepartmentByOrderId` in `orders_o` to ensure correct department is fetched based on given `order_id`.
- Updated discount line logic to leverage appropriate department dimension values.
2025-10-06 12:28:35 +02:00
Jeppe Bundgaard 13ee541d57 Prevent environmental and oil fees for customer 999 with onlyTankCleaning attribute 2025-10-01 16:38:27 +02:00
Jeppe Bundgaard 8e6ad68253 Add environmental and oil fee calculation to invoice drafts
- Introduced `add_environmental_and_oil_fees` in `economic_invoices_draft_endpoint` to compute and add fees to drafts.
- Added `addEnvironmentalAndOilFeesToDraft` in `collected_order_invoices_o` to conditionally apply fees for customers with the `onlyTankCleaning` attribute.
2025-10-01 16:04:01 +02:00
Jeppe Bundgaard ed8a6454a6 Introduce subscription fallback mechanisms for vehicles with no transactions
- Added `attemptSubscriptionFallbacks` method in `InvoicingPeriodRoute` to handle vehicle subscription fallbacks through department-based strategies.
- Enhanced `customer_vehicles_o` with `getLastTransactions` for retrieving recent transactions.
- Updated `users_o` to support nullable return type for `getDefaultDepartment`.
2025-10-01 15:30:56 +02:00
Jeppe Bundgaard 86acc3a183 Add invoicing distribution endpoints and subscription processing features
- Introduced new endpoints for invoicing distribution: `/superuser/invoicing/period/distribution/fixed-pricing` and `/superuser/invoicing/period/distribution/wash-subscriptions`.
- Enhanced `customer_vehicles_o` with `getSubscriptionAppliedTransactionsFromList` method for transaction filtering based on subscriptions.
- Added `getNetAmountForOrderItemsOriginal` to `orders_o` for calculating the original net amount of order items.
- Introduced parsing utilities for department-based aggregation in invoicing.
- Extended `products_o` with `getSubscriptionMonthlyPrice` to calculate subscription pricing.
- Added `getFieldsWhereIn` to `db_object_t` for advanced database querying.
2025-10-01 10:21:58 +02:00
Jeppe Bundgaard 69625c4fe3 Ensure requireSelected is called in getEconomicCustomerDiscountPercentage 2025-09-30 15:55:04 +02:00
Jeppe Bundgaard dfc7738a62 Add handheld order processing indicator and caching functionality
- Introduced `is_handheld` field in order creation to identify orders from handheld devices.
- Added logic to set, cache, and expire pending handheld orders automatically at midnight.
- Enhanced `orders_o` class with `setPendingHandheldIndicator` and `isPendingHandheld` methods.
- Updated order processing flow to include `pending_handheld` indicator in responses.
2025-09-25 12:33:09 +02:00
Jeppe Bundgaard 4c7084ee7b Invalidate order cache on updates and adjust delete logic for order_items_o
- Added `objectChanged()` to notify the order object when items are updated or deleted.
- Refactored `delete()` method to ensure the order is informed before executing the database query.
2025-09-24 13:00:38 +02:00
Jeppe Bundgaard 538aa24dc7 Add order attachments module
- Implemented CRUD operations for order attachments, including adding, listing, downloading, and deleting.
- Updated `db_object_t` and `attachments` to enhance object-attachment interactions with new methods for formatting, creating, and managing attachments.
- Added new routes (`/orders/attachments` and `/attachments/upload`) for attachment-related functionality.
- Adjusted `file_server.php` to handle temp file downloads and attachment storage.
- Improved typing and error handling across attachment helper methods and classes.
2025-09-22 12:31:53 +02:00
Jeppe Bundgaard 33a26cffc5 Implement attachments module with CRUD operations and integration points
- Added `attachments` module for creating, reading, updating, and deleting attachments.
- Introduced new classes such as `attachments`, `attachment_store`, `attachment_content`, and `attachment_relation` to handle attachment operations and their relationships.
- Integrated `attachments` features into `db_object_t` for seamless object-attachment interactions.
- Added `attachments_i` interface for standardized attachments module operations.
- Created `attachmentsRoute` for defining endpoints related to attachments.
- Enabled module configuration through `attachments_enabled_c` for attachment management control.
2025-09-22 10:28:22 +02:00
Jeppe Bundgaard 102605f15b Add support for dynamic pricing in productsRoute
- Introduced methods to apply customer-specific discounts and department-based pricing to products and addons.
- Enhanced `productsRoute` to handle optional parameters (`customer_id`, `department_id`, `category`, `id`) for tailored pricing and filtering.
- Updated response generation to include adjusted prices for both products and options based on customer and department context.
- Added helper methods to streamline parameter validation and parsing in `productsRoute`.
- Extended `products_o` to support discount application logic for customer pricing.
2025-09-17 09:59:05 +02:00
Jeppe Bundgaard 5b00e47276 Add /vehicles/status route to retrieve vehicle status details
- Introduced a new route `/vehicles/status` to provide detailed vehicle status, including verification, booking, and last order information.
- Added `getLastOrderByPlate` method in `customer_vehicles_o` to retrieve the last order for a vehicle plate.
- Implemented validation for registration number and optional department parameter.
- Enhanced response with multiple status indicators like `verified`, `known`, `booked`, and `card`.
2025-09-15 11:58:32 +02:00
Jeppe Bundgaard 9ee4cf5ac8 Add water usage calculation to department daily reports
- Introduced `getTransactionsOnDateWaterUsage` method in `department_daily_reports_o` to calculate water usage based on transactions for a given date or date range.
- Updated department daily reports routes to include `water_usage` in the output.
2025-09-03 14:54:30 +02:00
Jeppe Bundgaard 97c448b5b6 Add is_wash field to products and support wash statistics in reports
- Introduced `is_wash` field to `products_o` for marking wash-related products.
- Updated `productsRoute` to handle `is_wash` in product creation and editing.
- Added `getTransactionsOnDateWashesCount` method in `department_daily_reports_o` for calculating wash-related transactions in reports.
- Adjusted department daily reports routes to include wash statistics output.
2025-09-03 14:03:02 +02:00
Jeppe Bundgaard 3dca3c8a24 Add support for date range in department daily reports
- Introduced optional `date_to` parameter across relevant routes and methods for handling date ranges in department daily reports.
- Added `getDate_to` method and refactored date validation logic into `validateDateLocally` for reuse and reduced redundancy.
- Updated SQL queries in `department_daily_reports_o` to support date range queries using `BETWEEN`.
- Enhanced error handling and parameter validation for date-related inputs.
- Cleaned up comments and redundant code for improved readability.
2025-09-03 12:52:03 +02:00
Jeppe Bundgaard c2a5bad0a8 Improve error handling for draft invoice lines and refine invoice collection logic
- Added detailed error handling in `economic_invoices_draft_endpoint` to throw exceptions with line-specific error messages when adding draft invoice lines fails.
- Removed unnecessary `echo` statement from `orderInvoicesRoute`.
- Updated `collected_order_invoices_o` to allow empty invoice collections for customers with fixed price agreements.
2025-09-02 15:49:39 +02:00
Jeppe Bundgaard 7a852f5b54 Add nullable return types and improve exception handling in MotorAPI
- Updated `getCachedResult` methods across `motorapi`, `motorapi_i`, and `motorapi_lookups_o` to return `?object` for nullable results.
- Enhanced error handling in `xlvask_parser_stor_bil` by wrapping `getLicensePlateInformation` in a try-catch block to handle API exceptions gracefully.
- Introduced `cleanJSON` method in `motorapi` to sanitize and validate JSON data, ensuring robust parsing of cached responses.
- Optimized `getCachedResult` logic to handle null and invalid JSON scenarios with detailed error reporting.
2025-08-31 13:33:10 +02:00
Jeppe Bundgaard 455cd14f22 Add latitude and longitude properties to departments
- Introduced `latitude` and `longitude` properties in `departments_o` for geographic data support.
- Updated department routes to handle latitude/longitude in responses and parameter updates.
- Adjusted serialization and object creation to include new properties.
2025-08-26 16:47:36 +02:00
Jeppe Bundgaard 5f400e1dd0 Add advanced invoice handling, cached result lookups, and customer-specific pricing
- Enhanced `orderInvoicesRoute` with `reset`, `unlink`, and `remove-special-arrangements` handlers for invoice actions, improving E-Conomic integration.
- Added `resetPricesOfItemsNotIncludedInInvoice`, `setAllItemsToBeIncludedInInvoice`, and `unlinkFromEconomic` methods in `collected_order_invoices_o` for robust invoice control.
- Introduced `getCustomerProductPrice` in `orders_o` to calculate customer-specific product pricing with discounts.
- Added `getCachedResultsBySubstring` in `motorapi_lookups_o` for efficient cached lookup based on result substrings.
2025-08-25 15:59:03 +02:00
Jeppe Bundgaard 2721ef6620 Update product options defaults and include price in output array
- Set default values for `min` and `max` when null (`0` and `-1` respectively).
- Added `price` property to the output array for enhanced product data completeness.
2025-08-19 14:19:52 +02:00
Jeppe Bundgaard 841062bfca Add product IDs to category array and update product count calculation 2025-08-13 17:21:51 +02:00
Jeppe Bundgaard f281b1c4d6 Skip orders without registration number and simplify order queries for department-based filtering 2025-08-07 12:19:15 +02:00
Jeppe Bundgaard f98ca5f199 Update getTransactionsForCustomersInDateRange to include exception handling for invalid date ranges and no transactions found 2025-08-04 11:47:29 +02:00
Jeppe Bundgaard c397c20ea7 Refactor discount calculation and integrate MotorAPI checks in XL Vask module
- Updated `orders_o` to use `round` for consistent discounted price calculations.
- Refined `xlvask_parser_stor_bil` with MotorAPI-based vehicle type validation and added `checkMotorAPI` method.
- Optimized `motorapi_lookups_o` license plate validation to streamline database queries.
2025-07-29 15:13:09 +02:00
Jeppe Bundgaard f5ba9dd891 Add product discount calculation and update handling for dynamic usage logs
- Introduced `getProductDiscountPercentage` method to calculate accurate discounts for users across products, categories, and global settings.
- Adjusted `importUsageLogs` to refine date modifier parameter and enhance `usage log` checks.
- Enhanced `orders_o` to include product discount logic with stricter type casting for consistency.
- Added `updateFieldsWhere` method for selective database updates based on specific conditions.
- Updated `customers_o` to handle updates for existing customers while adding new ones.
2025-07-23 09:31:43 +02:00
Jeppe Bundgaard 16198f49e6 Refactor XL Vask module for better null handling and primary item validation
- Improved null safety by updating product ID retrieval logic in parsers and usage logs.
- Enhanced primary wash item selection with stricter checks for valid product types.
- Adjusted import date modifier in `importUsageLogs` for extended range (`-7 day`).
- Streamlined product and user association in order creation with additional validations.
- Removed redundant checks and refined permission handling in import tasks.
2025-07-21 16:47:05 +02:00
Jeppe Bundgaard 4cc270e258 Refactor order creation to use addArray method and sanitize inputs
- Introduced `addArray` method in `orders_o` for streamlined order creation using an associative array.
- Updated `ordersRoute` to utilize `addArray`, replacing older implementation for better manageability.
- Improved input handling by trimming whitespaces from registration numbers.
- Enhanced product pricing by incorporating department-specific prices and discount percentages.
2025-07-21 13:10:15 +02:00
Jeppe Bundgaard af3b0666fb Add import tasks and new parsers to XL Vask module
- Introduced `runImportTasks` method for vehicle, user, and usage log imports.
- Added new product parsers: `ht_b_rstel_s`, `ht_turbo`, and `ikke_b_rster_p_kabinen`.
- Implemented simulation and duplicate detection for usage logs via order objects.
- Updated usage log handling to include default customer checks and user association.
- Enhanced request handling with fast-link functionality for usage orders.
2025-07-21 10:32:56 +02:00
Jeppe Bundgaard e057b225a6 Make importUsageLogs and getUsageLogsFromXLVask accept dynamic date modifiers 2025-07-16 13:59:08 +02:00
Jeppe Bundgaard 648a58b724 Add import usage logs functionality to XL Vask module 2025-07-16 10:38:06 +02:00
Jeppe Bundgaard 7a4c53df1b Add xlvask_usage_log_id property to wash item usage log 2025-07-16 10:02:17 +02:00
Jeppe Bundgaard 4e89d168de Add wash item usage log functionality to XL Vask module 2025-07-16 09:01:03 +02:00
Jeppe Bundgaard 6a696eeb71 Add usage logs functionality to XL Vask module 2025-07-16 09:00:51 +02:00
Jeppe Bundgaard f74a904738 Add import vehicles functionality to XL Vask module 2025-07-15 15:01:03 +02:00
Jeppe Bundgaard 026942f772 Add import customers functionality to XL Vask module 2025-07-15 14:25:40 +02:00
Jeppe Bundgaard fb28c7a7df Remove unused delete method from customer_vehicles_o class 2025-07-15 10:52:17 +02:00
Jepp9350 0f8ec71ffe Enhance orders_o: add wash ID, timestamp creation, and detailed debug logging for mismatched totals. Add new parsers (xlvask_parser_ikke_b_rster_mellom_bil_og_trailer, xlvask_parser_s_be_dysebom_tak) and integrate into xlvask_helpers. Set memory limit in moduleXLVaskRoute. 2025-07-06 19:31:07 +02:00
Jepp9350 7a8edd0f28 Enhance orders_o and InvoicingPeriodRoute: expand duplicate detection logic by including additional registration fields, refine duplicate filtering criteria, and update transaction handling flag for possible duplicates. Add new xlvask_parser_ikke_ht_dysebom_mellom_bil_trailer parser and integrate it into xlvask_helpers. 2025-07-06 13:38:34 +02:00
Jepp9350 bf6c2d711d Refactor getOrder in order_items_o: add explicit type casting for order_id to ensure proper ID handling. 2025-07-02 12:19:43 +02:00
Jepp9350 c429c359ea Refactor getOrdersWithPossibleDuplicates and InvoicingPeriodRoute: simplify duplicate order detection, enhance customer transaction handling, and streamline object construction for improved efficiency. 2025-07-01 13:51:31 +02:00
Jepp9350 f503a5379e Enhance orders_o, order_items_o, and InvoicingPeriodRoute: add transaction and calculation methods, implement debug execution timing, refine invoicing period handling, optimize order retrieval, improve caching, and expand database query logic. 2025-07-01 13:01:01 +02:00
Jepp9350 e583a269d0 Add getOrdersWithPossibleDuplicates method in orders_o and getPossibleDuplicates method in InvoicingPeriodRoute to identify and handle potential duplicate orders within a specified date range. 2025-06-30 17:39:11 +02:00
Jepp9350 6b80637208 Refactor InvoicingPeriodRoute and vehiclesRoute: streamline invoicing period data retrieval, enhance transaction handling across customer types, introduce new methods for efficient object construction, and add improved type validation in object_property. 2025-06-30 14:37:37 +02:00