Skip to content

Conversation

@lucs7
Copy link
Contributor

@lucs7 lucs7 commented Dec 17, 2025

This pull request introduces support for custom attribute scopes for ressources. Meaning based on specific resource or resource type custom attributes are shown similar to how its handled for reservation.

I previously committed this code but some final testing and changes were required
While going through the custom attributes I also added some types where suggested

Copilot AI review requested due to automatic review settings December 17, 2025 18:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces support for custom attribute scopes for resources, allowing attributes to be filtered by specific resources or resource types, similar to how it's handled for reservations. The PR also includes type annotation improvements throughout the codebase.

Key changes:

  • New GetResourceAttributes method in AttributeService to filter attributes based on resource ID and resource type ID
  • Enhanced template logic to display attributes conditionally based on secondary entity assignments
  • Type-safe comparison operators using strict equality (===) for CustomAttributeCategory comparisons

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tpl/Admin/Resources/manage_resources.tpl Implements conditional attribute rendering based on resource type and direct resource assignment
tpl/Admin/Attributes/manage_attributes.tpl Updates form fields with better labeling, tooltip help text, and visibility rules configuration
lib/Application/Attributes/AttributeService.php Adds GetResourceAttributes method with filtering logic and stub methods for interface compatibility
lib/Application/Schedule/ScheduleResourceFilter.php Updates type comparisons to use type-safe casting
lib/Application/Reservation/Validation/CustomAttributeValidationRule.php Converts loose equality to strict equality for category comparisons
Domain/CustomAttribute.php Extends WithSecondaryEntities to support RESOURCE category in addition to RESERVATION
Domain/Access/AttributeFilter.php Adds type casting for attribute type comparisons
Pages/Admin/ManageResourcesPage.php Updates attribute type comparison with type casting
Pages/Admin/ManageAttributesPage.php Adds SetCategoryVisibilityRules method to define field visibility per category
Presenters/Admin/ManageAttributesPresenter.php Calls SetCategoryVisibilityRules on page load
WebServices/Controllers/AttributeSaveController.php Updates validation with strict type comparisons and adds DATETIME type support
Web/scripts/admin/attributes.js Implements visibility rules and secondary category management (contains duplicate code)
tests/fakes/FakeAttributeService.php Adds stub implementations for new interface methods
tests/Presenters/Admin/ManageAttributesPresenterTest.php Adds comprehensive test cases for resource and resource type secondary entities
lang/*.php Adds help text translations for AdminOnly, Private, and LimitAttributeScope in 7 languages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lucs7 lucs7 force-pushed the feature/attribute-scope branch 2 times, most recently from c82fe7c to 18bf701 Compare December 17, 2025 19:44
Adds the scoping feature to resources by resource and resource type
Allows to collect custom attributes just for specific limited scopes

fix: scopefield on edit still visible
Better description of attribute properties and options in admin management page
…pes and CustomAttributeCategory

fixes phpstan issues for wrong type comparisson
@JohnVillalovos JohnVillalovos force-pushed the feature/attribute-scope branch from 18bf701 to f02596d Compare December 23, 2025 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant