Commit Graph
709 Commits
Author SHA1 Message Date
Jeppe Bundgaard 7aa397acda Add historical invoicing endpoint and enhance permission checks
- Introduce `/superuser/invoicing/period/distribution/wash-subscriptions/historical` endpoint to retrieve historical subscription orders with detailed processing, filtering, and summary calculations.
- Reinstate permission checks for invoicing period distribution endpoints.
- Add Slack notifications for subscription price distribution summaries.
- Refine department ID handling by excluding automatic department (ID 10) during processing.
2026-02-03 09:24:58 +01:00
Jeppe Bundgaard c6cbdea3ee Add getObjectsWhereClause method to db_object_t with deprecation notice
- Introduce `getObjectsWhereClause` for fetching objects using custom where clauses.
- Mark the method as deprecated due to its vulnerability to SQL injection; recommend safer alternatives (`getFieldsWhere`, `getFieldsWhereIn`).
2026-02-03 09:24:07 +01:00
Jeppe Bundgaard ecd40e0b4f Update date handling logic and add isEmpty method in collected_order_invoices_o
- Refactor date calculation to use `closed_at` for determining monthly ranges.
- Fix SQL query to use `closed_at` instead of `created_at` for filtering orders.
- Add `isEmpty` method to check if an invoice collection has any orders.
2026-02-03 09:22:40 +01:00
Jeppe Bundgaard 4778486dac Add SSL mode support for database backups and enhance directory creation checks
- Introduce SSL mode configuration (`ssl_mode`) for `mysqldump` to support secure database backups.
- Update database backup logic to handle SSL options (`DISABLED`, `PREFERRED`, `REQUIRED`, `VERIFY_CA`, `VERIFY_IDENTITY`).
- Improve directory creation checks in backup logic with additional error handling.
- Update `config.example.php` to include `ssl_mode` configuration.
2026-02-02 14:24:28 +01:00
Jeppe Bundgaard 08077df618 Add getOrderItemObjects and getProduct methods, and enhance Slack notifications in invoicing routes
- Introduce `getOrderItemObjects` in `orders_o` to retrieve item objects for an order.
- Add `getProduct` in `order_items_o` for product retrieval by item.
- Enhance Slack notification logic in invoicing routes for better error reporting and fixed pricing summaries.
- Temporarily comment out permission checks in certain invoicing endpoints for debugging purposes.
2026-02-02 12:57:27 +01:00
Jeppe Bundgaard c591439240 Refactor goals_progress_alert_renderer to separate period department lines from totals
- Introduce `periodLines` array for improved clarity and logic separation.
- Update total expression to include period label for better formatting.
- Move department lines and blanks to `periodLines` and merge into output at the end of each period.
2026-02-02 11:25:45 +01:00
Jeppe Bundgaard 4816075041 Add total progress summary line in goals_progress_alert_renderer
- Include total progress calculations across departments for each period.
- Add percentage comparison against target when applicable.
2026-02-02 10:42:33 +01:00
Jeppe Bundgaard 17325f565e Update Slack notification logic and refine COUNT_ONLY summary rendering
- Swap `send_message` with `send_webhook_message` to fix departmental Slack notification issues.
- Adjust `COUNT_ONLY` in `renderDanishPeriodSummary` to exclude targets for raw count-focused alerts.
2026-01-29 20:31:05 +01:00
Jeppe Bundgaard 4f9c91dceb Refactor goals_progress_alert_renderer for improved date handling and department target calculations
- Replace immutable/mutable `DateTime` conversions with safer handling in target and progress calculations.
- Update `getDailyTarget` to normalize timeframes and improve operating day computations.
- Refine department-specific target calculation logic for enhanced accuracy in multi-department setups.
2026-01-29 20:24:47 +01:00
Jeppe Bundgaard cd2190d976 Refactor goals_progress_alert_renderer for enhanced department summary rendering
- Simplify multi-period department progress calculations by restructuring logic to render by period first.
- Add support for daily target calculations and timeframe-based target adjustments in `goals_criteria`.
- Introduce `countOperatingDaysInTimeframe` and related helper methods for improved alert scheduling and progress tracking.
2026-01-29 20:20:05 +01:00
Jeppe Bundgaard b3b12b58fd Refactor goals_criteria and goals_progress_alert_renderer for improved department filtering and summary rendering
- Add cloning logic in `withDepartmentFilter` to avoid mutating original `goals_criteria` objects.
- Rename method parameter in `render` and refactor `renderDanishPeriodSummary` for enhanced readability and flexibility.
- Introduce helper methods for date range and criteria window adjustments to streamline department progress calculations.
2026-01-29 19:42:03 +01:00
Jeppe Bundgaard 84bfbdad25 Refactor Slack notifications and enhance departmental progress calculation
- Replace `send_webhook_message` with `send_message` for improved Slack notification rendering using `goals_progress_alert_renderer`.
- Add methods for calculating and retrieving departmental progress and distribution in `goals_criteria`.
- Update `renderDanishPeriodSummary` and Slack cron logic to support departmental-specific summaries.
- Include departmental progress in serialized goal objects for better reporting.
2026-01-29 18:30:04 +01:00
Jeppe Bundgaard 8972db3469 Add optional crop functionality to drawCropOutLine in machine_1
- Update `drawCropOutLine` to accept a `crop` parameter for conditional cropping alongside outline rendering.
- Adjust crop outline coordinates for improved alignment.
- Introduce logic to calculate and apply crop dimensions when `crop` is enabled.
2026-01-29 16:03:32 +01:00
Jeppe Bundgaard 71e2519e8b Add drawLine method and refactor crop outline rendering in machine_1
- Introduce `drawLine` method in `dynamicimages_image_t` for drawing lines with customizable styles (color, thickness, dash patterns).
- Update `drawCropOutLine` in `machine_1` to use a dynamic configuration for rendering top, left, right, and bottom crop outlines.
- Refactor crop outline logic for better readability and maintainability.
2026-01-29 15:48:18 +01:00
Jeppe Bundgaard 9e58370e94 Add crop outline rendering and step counter refinement in machine_1
- Implement `drawCropOutLine` method for rendering horizontal crop outlines in machine images.
- Refactor `drawStepCounterOnButton` with dynamic font sizing and fallback handling for better text alignment.
- Add step counter rendering in top-right position for enhanced button visuals.
- Update `exampleRoute` debugging logic to integrate new `machine_1` functionality.
- Replace old debug assets with new button highlight state assets.
2026-01-29 15:18:37 +01:00
Jeppe Bundgaard db99b293de Reset current_step to 0 and update comments in machine_1 button highlighting logic 2026-01-28 19:06:04 +01:00
Jeppe Bundgaard 5171d55e1f Add only_generate_current_step logic to machine_1 rendering
- Introduce `only_generate_current_step` property to conditionally skip non-relevant button highlights during rendering.
- Update button rendering methods to respect the `only_generate_current_step` flag for improved efficiency.
- Adjust logic in `drawHighlightedButtons` and related functions to check current step before drawing assets.
2026-01-28 19:02:30 +01:00
Jeppe Bundgaard 7247da5e21 Add start button rendering and update highlighted button logic in machine_1
- Introduce `drawHighlightedStartButton` method for dynamic rendering of the start button with step indicators.
- Add new constants for `IMAGE_BUTTON_HIGHLIGHTED_GREEN`, `IMAGE_BUTTON_HIGHLIGHTED_GREY`, and `IMAGE_BUTTON_HIGHLIGHTED_COMPLETED`.
- Refactor `getHighlightedAssetName` to provide conditional asset selection based on step completion.
- Implement `drawStepThumb` for rendering step indicators on the washing thumb.
- Adjust highlighted button logic to dynamically incorporate step counts and completion states.
- Add new assets for highlighted button states (`completed`, `green`, `grey`).
2026-01-28 18:11:52 +01:00
Jeppe Bundgaard 0357c478b4 Remove debug guides and finalize badge positioning in machine_1
- Remove temporary debug crosshair overlays after calibration.
- Refine badge positioning with calibrated inset adjustments.
- Confirm optical centering for better visual alignment.
2026-01-28 16:47:36 +01:00
Jeppe Bundgaard ab7bd4c2da Calibrate badge positioning and add debug guides in machine_1
- Adjust badge center calculations for improved alignment based on asset layout.
- Temporarily disable optical nudge calibration for badge centering.
- Add debug crosshair overlays to validate badge and text anchor points during rendering.
2026-01-28 16:46:04 +01:00
Jeppe Bundgaard 220eda5cb5 Refactor step counter rendering for machine_1 buttons
- Redesign badge positioning with dynamic calculations for better alignment.
- Implement optical centering and text-size adjustments based on badge dimensions.
- Improve font size optimization with iterative refinement and fallback handling.
2026-01-28 16:35:34 +01:00
Jeppe Bundgaard 790e0fbeec Normalize color handling and enhance text overlay logic
- Add `normalizeColor` method in `dynamicimages_asset_t` for consistent color input handling across strings, arrays, and defaults.
- Update text overlay to use the new `normalizeColor` method, improving flexibility and robustness.
- Refactor `machine_1` button step counter to calculate font size dynamically and use RGBA colors.
- Adjust `drawStepCounterOnButton` to improve text alignment and styling.
2026-01-28 16:16:53 +01:00
Jeppe Bundgaard 24b1d410c0 Add text overlay support and enhance font handling in dynamicimages
- Introduce `addTextOverlay` method in `dynamicimages_asset_t` for adding customizable text overlays with alignment and styling options.
- Add `getFontPath` method in `dynamicimages_image_t` for resolving font paths under the shared assets directory.
- Refactor `machine_1` to use `drawStepCounterOnButton` for adding dynamic step counters to buttons.
- Rename and relocate `AlfaSlabOne-Regular.ttf` under `assets/fonts`.
2026-01-28 16:07:03 +01:00
Jeppe Bundgaard f158fa7120 Add reset button rendering and refine highlighted button logic in machine_1
- Introduce `drawHighlightedResetButton` method for dynamically rendering the reset button with text overlay.
- Add `IMAGE_BUTTON_HIGHLIGHTED_BLUE` constant and update asset usage for reset button rendering.
- Refine highlighted button positioning with per-row spacing adjustments and configurable highlight states.
- Add `getNextButtonStepCount` method for tracking button steps during rendering.
2026-01-28 15:56:50 +01:00
Jeppe Bundgaard 3fcccd8e5a Add AlfaSlabOne-Regular.ttf font to dynamicimages module 2026-01-28 15:56:38 +01:00
Jeppe Bundgaard d03151c426 Add highlighted button rendering to machine_1 layout
- Introduce `drawHighlightedButtons` method for drawing button grids based on configurable rows, columns, and spacing.
- Add new constants for button size, spacing, and grid dimensions.
- Update asset usage to include `machine_1_button_highlighted_transparent`.
2026-01-28 14:57:44 +01:00
Jeppe Bundgaard a2dc4da2bf Refactor machine_1 rendering logic and add new assets
- Replace `IMAGE_WASH_PROGRAMS` with `IMAGE_PROGRAMS_WHEEL` and add `IMAGE_BUTTON_HIGHLIGHTED`.
- Introduce `drawProgramWheel` and `drawThumb` methods for improved modularity.
- Adjust thumb properties (`$thumb_position`, `$thumb_size`) and refine positioning logic.
- Update asset loading to include the new `machine_1_button_highlighted_transparent` asset.
2026-01-28 14:27:06 +01:00
Jeppe Bundgaard 43eeb14099 Update machine_1 default thumb position and adjust thumb X-coordinate positioning
- Set `$thumb_position` default value to `10` for improved alignment.
- Tweak thumb X-coordinate from `620` to `650` for better rendering consistency.
2026-01-27 15:04:17 +01:00
Jeppe Bundgaard 2e7376f00a Add centered asset drawing support and refine image transformations
- Introduce `drawAssetCentered` method in `dynamicimages_image_t` for drawing assets visually centered on specified coordinates.
- Reset virtual canvas/page after image rotation in both `dynamicimages_asset_t` and `dynamicimages_image_t` to ensure consistent positioning.
- Update `machine_1` logic to use `drawAssetCentered` for improved thumb drawing and dynamic pivot alignment.
- Adjust thumb rotation calculations and positioning logic for better visual rendering.
2026-01-27 14:56:58 +01:00
Jeppe Bundgaard 493b4a2d6e Add resize method to dynamicimages_asset_t and enhance machine_1 thumb rendering
- Introduce `resize` method in `dynamicimages_asset_t` for resizing assets in memory with or without aspect ratio preservation.
- Refine `machine_1` rendering logic to dynamically calculate and apply thumb width based on height.
2026-01-27 14:10:45 +01:00
Jeppe Bundgaard ee305757f2 Implement in-memory asset manipulation and enhance machine_1 drawing logic
- Add in-memory asset handling to `dynamicimages_asset_t` with methods for loading, rotating, cloning, and clearing `Imagick` instances.
- Update `dynamicimages_image_t` to use in-memory images when available for dynamic asset composition.
- Replace thumb reference in `machine_1` with new `machine_1_wash_programs_thumb_standalone_transparent` asset.
- Enhance `machine_1` to resize rotated thumb dynamically while drawing.
2026-01-27 12:35:50 +01:00
Jeppe Bundgaard 3cea9659cb Add servePicture method to dynamicimages_image and update machine_1 with thumb rotation logic
- Introduce `servePicture` method to `dynamicimages_image_t` and its interface.
- Add `$thumb_position` property and `getRotationThumbPosition` method to `machine_1`.
- Update `drawAsset` logic in `machine_1` to apply rotated thumb for dynamic rendering.
2026-01-27 12:22:13 +01:00
Jeppe Bundgaard d7705b8f34 Add support for dynamic image composition with Imagick in dynamicimages module
- Update `Dockerfile` to install `Imagick` dependencies and enable the extension.
- Enhance `dynamicimages_image_t` with canvas lifecycle methods (`initImageCanvas`, `clearImage`, etc.), transformations (`resize`, `crop`, `rotate`, etc.), and explicit asset compositing.
- Extend `dynamicimages_image_i` interface with corresponding method signatures.
- Refactor `machine_1` to utilize dynamic image canvas and layered asset drawing.
2026-01-27 12:05:53 +01:00
Jeppe Bundgaard e2521e222f Enhance dynamicimages module with refined asset management and image path configuration
- Update `dynamicimages_asset` constructor to prepend working directory to paths.
- Add helper methods (`getPath`, `getWidth`, `getHeight`) to `dynamicimages_asset`.
- Extend `dynamicimages_image_t` trait with debugging and path configuration utilities.
- Refactor asset path handling in `machine_1` with constants for image files.
- Load `dynamicimages` interfaces, traits, classes, helpers, and configurations in `index.php`.
2026-01-27 11:21:07 +01:00
Jeppe Bundgaard f1f7ba1d46 Introduce dynamicimages module for managing dynamic image assets
- Add core `dynamicimages_c` class for module configuration and management.
- Implement asset management with `dynamicimages_asset` class and related interface/traits.
- Add support for image operations via `dynamicimages_tool` enum.
- Include `dynamicimages_image` class for handling grouped assets with path configuration.
- Introduce `machine_1` image example with associated assets under `dynamicimages`.
2026-01-27 11:07:30 +01:00
Jeppe Bundgaard 8528dd82f4 Add GoalsProgressAlertsCron for scheduled department goal progress notifications
- Introduce a new cron job to send progress alerts for department goals based on criteria.
- Support alert destinations: Slack (with fallback webhook), Email, and SMS (currently manual only).
- Evaluate frequency rules (daily, weekly, monthly, or change-based) with configurable time-of-day and weekdays.
- Deduplicate notifications using Redis keys for each goal and alert slot.
- Implement detailed alert scheduling, rendering, and dispatch logic.
2026-01-27 10:15:40 +01:00
Jeppe Bundgaard 5a8bcfad90 Introduce Slack-specific bold formatting for Danish header keys in goals_progress_alert_renderer
- Add `applySlackBoldKeys` method to bold select headers and periods for Slack alerts.
- Update rendering logic to apply Slack-specific formatting when destination is Slack.
2026-01-27 10:04:15 +01:00
Jeppe Bundgaard d01bdb7ea3 Enhance Slack notifications and pluralize Danish labels in goals_progress_alert_renderer
- Add support for sending Slack notifications to multiple department webhooks.
- Adjust Danish label pluralization based on counts for departments, customers, and products.
2026-01-27 09:57:13 +01:00
Jeppe Bundgaard 6d1e10d564 Update customer name resolution in goals_progress_alert_renderer
- Prefer economic customer name via `getCustomerNames` when available.
- Add fallback to `display_name` and customer number.
2026-01-27 09:46:28 +01:00
Jeppe Bundgaard 5536475102 Add multi-line progress alert rendering and support for department, customer, and product names
- Introduce `renderDanishPeriodSummary` to display detailed progress (daily, weekly, monthly) with optional targets.
- Add `commaNamesFromObjects` helper to extract and format names for departments, customers, and products.
- Update alert composition logic to differentiate between single-line and multi-line rendering.
- Extend `progress_alert_format` to support new tokens `{department_names}`, `{customer_names}`, and `{product_names}`.
2026-01-27 09:43:23 +01:00
Jeppe Bundgaard 1a5084891d Refactor progress_alert_format parsing in goals_criteria to support object structures and update enum mapping in goals_criteria_progress_alert_style 2026-01-27 09:20:27 +01:00
Jeppe Bundgaard 7fd4ac888a Add POST endpoint /goals/department/progress-alert/test to send test progress alerts
- Define alert destinations (Slack, Email, SMS) with customizable parameters.
- Implement OpenAPI specification and validate permissions, goal existence, and configuration.
2026-01-27 09:11:17 +01:00
Jeppe Bundgaard 6468bcb481 Add endpoint to send test progress alerts for department goals
- Implement `/goals/department/progress-alert/test` POST endpoint to send test progress alerts.
- Support email, SMS, and Slack as alert destinations with customizable parameters.
- Validate user permissions, goal existence, and alert configuration before dispatch.
- Extend alert rendering logic with destination-specific delivery methods.
2026-01-27 09:09:10 +01:00
Jeppe Bundgaard 9d34decbb6 Add missing helper files for progress alert customization in goals module
- Include `goals_criteria_progress_alert_destination`, `goals_criteria_progress_alert_progress_type`, `goals_criteria_progress_alert_style`, and `goals_criteria_progress_alert_weekday` helpers in `index.php`.
2026-01-27 09:00:32 +01:00
Jeppe Bundgaard 043382c6f4 Add support for weekday-specific and time-of-day progress alerts in goals_criteria
- Introduce `progress_alert_weekdays` and `progress_alert_time_of_day` fields with parsing, validation, and sanitization logic.
- Add `goals_criteria_progress_alert_weekday` enum for supported weekdays.
- Update `toArray` and OpenAPI specification to support new fields and maintain backward compatibility.
2026-01-27 08:52:12 +01:00
Jeppe Bundgaard 4eacd04c2a Update OpenAPI spec: Add progress alert customization fields to goals_criteria schema
- Introduce `progress_alert_destination`, `progress_alert_progress_type`, `progress_alert_style`, and `progress_alert_format` fields with descriptions, examples, and enum values.
- Ensure backward compatibility with support for camelCase inputs.
2026-01-27 08:46:14 +01:00
Jeppe Bundgaard 2f6ae98d42 Add support for progress alert rendering in goals module
- Implement `goals_progress_alert_renderer` service to compose and render progress alert messages based on destination, progress type, and style.
- Add format classes (`sms_progress_alert_format`, `email_progress_alert_format`, `slack_progress_alert_format`) with length constraints.
- Extend `goals_criteria` to include alert customization properties (`progress_alert_destination`, `progress_alert_progress_type`, `progress_alert_style`, `progress_alert_format`) with parsing and validation logic.
- Update `toArray` and `fromJson` methods to support new fields.
2026-01-27 08:44:44 +01:00
Jeppe Bundgaard 845bd0c6c6 Add enums and trait for progress alert customization in goals module
- Introduce `goals_criteria_progress_alert_style`, `goals_criteria_progress_alert_progress_type`, and `goals_criteria_progress_alert_destination` enums to define alert styles, progress types, and destinations.
- Add `goals_criteria_progress_alert_format_t` trait, including rendering and JSON serialization capabilities.
2026-01-27 08:34:52 +01:00
Jeppe Bundgaard ad0277ff17 Enhance input validation, unicode handling, and sanitization across department goal criteria
- Add `validateAndSanitize` method to `goals_criteria` for input validation and defaulting incorrect values.
- Ensure JSON encoding in `response` and database interactions respects Unicode (`JSON_UNESCAPED_UNICODE`).
- Sanitize and validate input for `department_goals_o::add` and criteria usage.
- Fix header character encoding in response (`Content-Type: application/json; charset=utf-8`).
- Update criteria `label` sanitization with trimming, length limits, and safe character handling.
2026-01-27 08:20:33 +01:00
Jeppe Bundgaard f5e715d113 Preserve unicode characters in goals_criteria JSON encoding for department goals 2026-01-27 07:51:58 +01:00