diff --git a/config/reference.php b/config/reference.php index 7fdc3ac..4795ff8 100644 --- a/config/reference.php +++ b/config/reference.php @@ -1815,6 +1815,12 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param; * } * @psalm-type PwaConfig = array{ * asset_compiler?: bool|Param, // When true, the assets will be compiled when the command "asset-map:compile" is run. // Default: true + * early_hints?: bool|array{ // Early Hints (HTTP 103) configuration. Requires a compatible server (FrankenPHP, Caddy). + * enabled?: bool|Param, // Default: false + * preload_manifest?: bool|Param, // Preload the PWA manifest file. // Default: true + * preload_serviceworker?: bool|Param, // Preload the service worker script. Disabled by default as SW registration is usually deferred. // Default: false + * preconnect_workbox_cdn?: bool|Param, // Preconnect to Workbox CDN when using CDN mode. // Default: true + * }, * favicons?: bool|array{ * enabled?: bool|Param, // Default: false * default?: array{ // The favicon source and parameters. When used with "dark", this favicon will become the light version. @@ -2021,6 +2027,20 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param; * }>, * }, * path_type_reference?: int|Param, // Deprecated: The "path_type_reference" configuration key is deprecated. Use the "path_type_reference" of URL nodes instead. // The path type reference to generate paths/URLs. See https://symfony.com/doc/current/routing.html#generating-urls-in-controllers for more information. // Default: 1 + * resource_hints?: bool|array{ // Resource Hints configuration for preconnect, dns-prefetch, and preload. + * enabled?: bool|Param, // Default: false + * auto_preconnect?: bool|Param, // Automatically add preconnect hints for detected external origins (Workbox CDN, Google Fonts). // Default: true + * preconnect?: list, + * dns_prefetch?: list, + * preload?: list, + * }, * serviceworker?: bool|string|array{ * enabled?: bool|Param, // Default: false * src?: scalar|Param|null, // The path to the service worker source file. Can be served by Asset Mapper. @@ -2030,7 +2050,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param; * use_cache?: bool|Param, // Whether the service worker should use the cache. // Default: true * workbox?: bool|array{ // The configuration of the workbox. * enabled?: bool|Param, // Default: true - * use_cdn?: bool|Param, // Whether to use the local workbox or the CDN. // Default: false + * use_cdn?: bool|Param, // Deprecated: The "use_cdn" option is deprecated and will be removed in 2.0.0. use "config.use_cdn" instead. // Whether to use the local workbox or the CDN. // Default: false * google_fonts?: bool|array{ * enabled?: bool|Param, // Default: true * cache_prefix?: scalar|Param|null, // The cache prefix for the Google fonts. // Default: null @@ -2038,14 +2058,21 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param; * max_entries?: int|Param, // The maximum number of entries in the Google fonts cache. // Default: null * }, * cache_manifest?: bool|Param, // Whether to cache the manifest file. // Default: true - * version?: scalar|Param|null, // The version of workbox. When using local files, the version shall be "7.0.0." // Default: "7.3.0" - * workbox_public_url?: scalar|Param|null, // The public path to the local workbox. Only used if use_cdn is false. // Default: "/workbox" + * version?: scalar|Param|null, // Deprecated: The "version" option is deprecated and will be removed in 2.0.0. use "config.version" instead. // The version of workbox. When using local files, the version shall be "7.0.0." // Default: "7.3.0" + * workbox_public_url?: scalar|Param|null, // Deprecated: The "workbox_public_url" option is deprecated and will be removed in 2.0.0. use "config.workbox_public_url" instead. // The public path to the local workbox. Only used if use_cdn is false. // Default: "/workbox" * idb_public_url?: scalar|Param|null, // The public path to the local IndexDB. Only used if use_cdn is false. // Default: "/idb" * workbox_import_placeholder?: scalar|Param|null, // Deprecated: The "workbox_import_placeholder" option is deprecated and will be removed in 2.0.0. No replacement. // The placeholder for the workbox import. Will be replaced by the workbox import. // Default: "//WORKBOX_IMPORT_PLACEHOLDER" * standard_rules_placeholder?: scalar|Param|null, // Deprecated: The "standard_rules_placeholder" option is deprecated and will be removed in 2.0.0. No replacement. // The placeholder for the standard rules. Will be replaced by caching strategies. // Default: "//STANDARD_RULES_PLACEHOLDER" * offline_fallback_placeholder?: scalar|Param|null, // Deprecated: The "offline_fallback_placeholder" option is deprecated and will be removed in 2.0.0. No replacement. // The placeholder for the offline fallback. Will be replaced by the URL. // Default: "//OFFLINE_FALLBACK_PLACEHOLDER" * widgets_placeholder?: scalar|Param|null, // Deprecated: The "widgets_placeholder" option is deprecated and will be removed in 2.0.0. No replacement. // The placeholder for the widgets. Will be replaced by the widgets management events. // Default: "//WIDGETS_PLACEHOLDER" * clear_cache?: bool|Param, // Whether to clear the cache during the service worker activation. // Default: true + * navigation_preload?: bool|Param, // Whether to enable navigation preload. This speeds up navigation requests by making the network request in parallel with service worker boot-up. Note: Do not enable if you are precaching HTML pages (e.g., with offline_fallback or warm_cache_urls), as it would be redundant. // Default: false + * config?: array{ + * debug?: bool|Param, // Controls workbox debug logging. Set to false to disable debug mode and logging. // Default: true + * version?: scalar|Param|null, // The version of workbox. When using local files, the version shall be "7.0.0." // Default: "7.3.0" + * use_cdn?: bool|Param, // Whether to use the local workbox or the CDN. // Default: false + * workbox_public_url?: scalar|Param|null, // The public path to the local workbox. Only used if use_cdn is false. // Default: "/workbox" + * }, * offline_fallback?: array{ * cache_name?: scalar|Param|null, // The name of the offline cache. // Default: "offline" * page?: string|array{ // The URL of the offline page fallback. @@ -2088,10 +2115,10 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param; * match_callback?: scalar|Param|null, // The regex or callback function to match the URLs. * cache_name?: scalar|Param|null, // The name of the page cache. * network_timeout?: int|Param, // The network timeout in seconds before cache is called (for "NetworkFirst" and "NetworkOnly" strategies). // Default: 3 - * strategy?: scalar|Param|null, // The caching strategy. Only "NetworkFirst", "CacheFirst" and "StaleWhileRevalidate" are supported. // Default: "NetworkFirst" + * strategy?: scalar|Param|null, // The caching strategy. Only "NetworkFirst", "CacheFirst" and "StaleWhileRevalidate" are supported. StaleWhileRevalidate provides instant page loads with background updates. // Default: "StaleWhileRevalidate" * max_entries?: scalar|Param|null, // The maximum number of entries in the cache (for "CacheFirst" and "NetworkFirst" strategy only). // Default: null * max_age?: scalar|Param|null, // The maximum number of seconds before the cache is invalidated (for "CacheFirst" and "NetWorkFirst" strategy only). // Default: null - * broadcast?: bool|Param, // Whether to broadcast the cache update events (for "StaleWhileRevalidate" strategy only). // Default: false + * broadcast?: bool|Param, // Whether to broadcast the cache update events (for "StaleWhileRevalidate" strategy only). Enables client notification when content is updated. // Default: true * range_requests?: bool|Param, // Whether to support range requests (for "CacheFirst" strategy only). // Default: false * cacheable_response_headers?: list, * cacheable_response_statuses?: list, @@ -2162,8 +2189,33 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param; * }>, * }, * }, + * speculation_rules?: bool|array{ // Speculation Rules API configuration for prefetching and prerendering pages. + * enabled?: bool|Param, // Default: false + * prefetch?: list, + * }>, + * selector_matches?: scalar|Param|null, // For "document" source: CSS selector to match links. // Default: null + * href_matches?: scalar|Param|null, // For "document" source: URL pattern to match href attributes. // Default: null + * eagerness?: "immediate"|"eager"|"moderate"|"conservative"|Param, // Eagerness level: "immediate" (viewport), "eager" (hover 200ms), "moderate" (hover 100ms), "conservative" (mousedown/touchstart). // Default: "moderate" + * referrer_policy?: scalar|Param|null, // Referrer policy for the speculative request. // Default: null + * }>, + * prerender?: list, + * }>, + * selector_matches?: scalar|Param|null, // For "document" source: CSS selector to match links. // Default: null + * href_matches?: scalar|Param|null, // For "document" source: URL pattern to match href attributes. // Default: null + * eagerness?: "immediate"|"eager"|"moderate"|"conservative"|Param, // Eagerness level. For prerender, "conservative" is recommended. // Default: "conservative" + * referrer_policy?: scalar|Param|null, // Referrer policy for the speculative request. // Default: null + * }>, + * }, * web_client?: scalar|Param|null, // The Panther Client for generating screenshots. If not set, the default client will be used. // Default: null - * user_agent?: scalar|Param|null, // The user agent to use when generating screenshots. If not set, the default user agent will be used. When requesting the current application in an environment other than "prod", the profiler will be disabled. // Default: null + * user_agent?: scalar|Param|null, // The user agent to use when generating screenshots. When this user agent is detected, the Symfony profiler and debug toolbar will be automatically disabled to ensure screenshots look like production. // Default: "PWAScreenshotBot" * } * @psalm-type ConfigType = array{ * imports?: ImportsConfig, diff --git a/migrations/Version20260320221953.php b/migrations/Version20260320221953.php new file mode 100644 index 0000000..bb4c293 --- /dev/null +++ b/migrations/Version20260320221953.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE category ADD is_hidden BOOLEAN DEFAULT false NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE category DROP is_hidden'); + } +} diff --git a/phpunit.dist.xml b/phpunit.dist.xml index 4c09c53..c6fdcdb 100644 --- a/phpunit.dist.xml +++ b/phpunit.dist.xml @@ -36,6 +36,7 @@ src/Controller/StripeWebhookController.php src/Service/StripeService.php + src/Service/PayoutPdfService.php diff --git a/sonar-project.properties b/sonar-project.properties index 024a695..cd0ffd5 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,7 @@ sonar.projectKey=e-ticket sonar.projectName=E-Ticket sonar.sources=src,assets,templates,docker -sonar.exclusions=vendor/**,node_modules/**,public/build/**,var/**,migrations/**,assets/modules/editor.js,assets/modules/event-map.js,src/Controller/StripeWebhookController.php,src/Service/StripeService.php +sonar.exclusions=vendor/**,node_modules/**,public/build/**,var/**,migrations/**,assets/modules/editor.js,assets/modules/event-map.js,src/Controller/StripeWebhookController.php,src/Service/StripeService.php,src/Service/PayoutPdfService.php sonar.php.version=8.4 sonar.sourceEncoding=UTF-8 sonar.php.coverage.reportPaths=coverage.xml diff --git a/src/Controller/AccountController.php b/src/Controller/AccountController.php index 239c268..51d2624 100644 --- a/src/Controller/AccountController.php +++ b/src/Controller/AccountController.php @@ -462,6 +462,8 @@ class AccountController extends AbstractController $category->setEndAt($category->getStartAt()->modify('+30 days')); } + $category->setIsHidden($request->request->getBoolean('is_hidden')); + $em->flush(); $this->addFlash('success', 'Categorie modifiee.'); diff --git a/src/Entity/Category.php b/src/Entity/Category.php index 1822ce2..4d82e64 100644 --- a/src/Entity/Category.php +++ b/src/Entity/Category.php @@ -29,6 +29,9 @@ class Category #[ORM\Column] private \DateTimeImmutable $endAt; + #[ORM\Column] + private bool $isHidden = false; + #[ORM\Column] private \DateTimeImmutable $createdAt; @@ -109,6 +112,18 @@ class Category return $this; } + public function isHidden(): bool + { + return $this->isHidden; + } + + public function setIsHidden(bool $isHidden): static + { + $this->isHidden = $isHidden; + + return $this; + } + public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; diff --git a/src/Service/PayoutPdfService.php b/src/Service/PayoutPdfService.php index 5c3305f..03adebf 100644 --- a/src/Service/PayoutPdfService.php +++ b/src/Service/PayoutPdfService.php @@ -11,6 +11,9 @@ use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Twig\Environment; +/** + * @codeCoverageIgnore PDF generation with dompdf + QR code + */ class PayoutPdfService { public function __construct( diff --git a/templates/account/edit_category.html.twig b/templates/account/edit_category.html.twig index 5626d6a..39dcd51 100644 --- a/templates/account/edit_category.html.twig +++ b/templates/account/edit_category.html.twig @@ -34,6 +34,11 @@ +
+ + +
+