mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-10-31 09:18:24 +00:00 
			
		
		
		
	Compare commits
	
		
			542 Commits
		
	
	
		
			issue357_f
			...
			issue435_n
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| cc1e2fde1f | |||
| 61cf838458 | |||
| e028c1ca2b | |||
| 7dd6cd04ba | |||
| 1072f539dc | |||
| 9bcf4cce9f | |||
| 9223beac47 | |||
| 62c78e650f | |||
| e7d0c1cac6 | |||
| b859283766 | |||
| e595500cb8 | |||
| f34847f9f6 | |||
| 0fa119c984 | |||
| 270d00c1e8 | |||
| 983c5f3c6a | |||
| c6141e473f | |||
| c30cb5879d | |||
| 29e384ada5 | |||
| c8e5ba4738 | |||
| bf0b7f1bb2 | |||
| d6cc69b919 | |||
| ac33c6aad8 | |||
| 89383a5ec4 | |||
| 0fd26da299 | |||
| 6fa99655b2 | |||
| a387305ef8 | |||
| e0c7daf3fd | |||
| 4304baeca5 | |||
| d2a567c79e | |||
| 3c04ced1a3 | |||
| a28d8a7287 | |||
| 1c055e842e | |||
| dea283d655 | |||
| 58c8373c81 | |||
| a1ccfadac1 | |||
| 632b1262f9 | |||
| e157624479 | |||
| 3a2370d536 | |||
| 981c94906d | |||
| adce90c151 | |||
| 83f8402081 | |||
| 22417ee9f9 | |||
| 3c5d269ece | |||
| 42579b5752 | |||
| 15023d348a | |||
| fbf777e134 | |||
| 450277f32a | |||
| 93128cb61b | |||
| d3d655293e | |||
| 0592601aa6 | |||
| a17f5948fb | |||
| 6578f66fec | |||
| 3f2a19a6f0 | |||
| d5160ead4c | |||
| a6e9cbdece | |||
| 657bf7075b | |||
| f1c3e8dc1b | |||
| a9624b36f7 | |||
| db4aec9a18 | |||
| c34ce48a53 | |||
| 93345c09a1 | |||
| b5a1985fa1 | |||
| 9b4c350213 | |||
| 199a441593 | |||
| f42d106e3c | |||
| 13eddbfc5b | |||
| 7c30126fed | |||
| e3c5f6f95f | |||
| a86f1a05ac | |||
| 9ba0cb0c2a | |||
| add8588767 | |||
| a083a320ae | |||
| 64fa7f2e00 | |||
| c7a830ee28 | |||
| 9aa51406fa | |||
| 344981cf99 | |||
| 28c4d6b92f | |||
| ef2ab5faf6 | |||
| 54dbf711f9 | |||
| 60951231c4 | |||
| ece30b63c3 | |||
| 94503505f7 | |||
| 48589f3368 | |||
| 1e04c178dc | |||
| 37ed703abe | |||
| 7ed20d2fc5 | |||
| 5fe2a8e737 | |||
|  | 861abe708b | ||
|  | f43e216e13 | ||
| 5210e7985f | |||
| ddabdff206 | |||
| 5a692db30f | |||
| 659983fef1 | |||
| aca5a3c731 | |||
| 406cfc86cd | |||
| 90da067fbd | |||
| e7a6742964 | |||
| 3ffeaf419a | |||
| ce2f64acd0 | |||
| 08f544f6ea | |||
| 4e862cc585 | |||
| 05d2c3b2e8 | |||
| 513207e510 | |||
| dee6ed6707 | |||
| d60095987c | |||
| b4f9be0d92 | |||
| a2a0f6af44 | |||
| 7fa0353d8c | |||
| 9256c71715 | |||
| 5520f3df50 | |||
| a6c0d8b219 | |||
| f6e667700e | |||
| f94ef0798a | |||
| 7bd7476200 | |||
| a2752765af | |||
| 1e81256404 | |||
| 6b571e87b4 | |||
| 4314823a70 | |||
| dc08ced6c9 | |||
| 9d660311f0 | |||
| b3e65f0733 | |||
| 03007370bc | |||
| f9b514c869 | |||
|  | 91ba08dfa1 | ||
|  | 06142797c3 | ||
|  | 4185b660cc | ||
| ad46776164 | |||
| 2343a4a334 | |||
| 3f83c323be | |||
| 9a9ed64298 | |||
|  | a0cadb46db | ||
|  | f139af8b6f | ||
|  | 1f0ef6e187 | ||
|  | 4afea55465 | ||
|  | 3d5723facb | ||
| 211ecf1c3e | |||
| 796b4ff76b | |||
| 9553e18d83 | |||
| 02d9a713de | |||
| 6cc4fa582e | |||
| b8d43f36eb | |||
| 06b3d63133 | |||
| 232e71f46c | |||
| 0b5a0e65a8 | |||
| ef42227e6c | |||
| 2af3de4f61 | |||
| 8bafa37fe1 | |||
|  | a83b0326d7 | ||
| 53e03395f2 | |||
| 5fef4048a4 | |||
| d8929a6222 | |||
| 33af7f36a0 | |||
| 3f2454cead | |||
| 0ac9f2df8c | |||
| 333224a9d5 | |||
| 496e5f0259 | |||
| f2a62822a4 | |||
| 7879a99197 | |||
| 72d8cc297f | |||
| 1a0674a20b | |||
| 572aa2c14e | |||
| bc4b2c4e86 | |||
| a227e88e79 | |||
| d9e9f472fb | |||
| fcff4bf863 | |||
| 79b82e09e1 | |||
|  | a78f29cffc | ||
| e98b1b049b | |||
| 99efa51794 | |||
| 76932e6e8c | |||
| 97d2e3d5b5 | |||
| a2063ab13b | |||
| 2bb718f3ea | |||
| c6373a075d | |||
| 46337ef25d | |||
| 2f5fecf414 | |||
| 5d2cb8c712 | |||
| 460502a1f2 | |||
| cdd7a16d18 | |||
| ec29758547 | |||
| c5cbdd97ff | |||
| 05fc5a1829 | |||
| c3de3c6c39 | |||
| 1530e9d13a | |||
| a986b4ae98 | |||
| 0854b7fc6a | |||
| 730199cca4 | |||
| de1dddbb85 | |||
| a612d7dd9f | |||
| 50e722e637 | |||
| e4d5e40a8b | |||
| 479ec25d99 | |||
| 930b6ff77e | |||
| 7d8bd089a2 | |||
|  | ebdcc5a07d | ||
|  | 0f31a49890 | ||
| 2c566bb21c | |||
| a0bc6c7604 | |||
| a4457664d4 | |||
| b42ae76bdf | |||
| 2eb1ebd263 | |||
| b79885cd21 | |||
| 69dd920fd6 | |||
| 0689ca366d | |||
| af1c268784 | |||
| 1162c436c1 | |||
| 170ce2d51c | |||
| 571a8a0edc | |||
| bdbb83ab85 | |||
| 971789d5cf | |||
| 72815e4b70 | |||
| 44183957b8 | |||
| 434d672d8a | |||
| 5f6cffa08a | |||
| e21ff588ae | |||
| 0383571a9e | |||
| f358e78734 | |||
| 43ef31b93f | |||
| 222dae3c32 | |||
| 08c13b8c98 | |||
| 1bc2500b28 | |||
| f648a9351b | |||
| ffe466a334 | |||
|  | 3978e7c959 | ||
|  | 2eb5c45a4d | ||
| 15393d9da9 | |||
| 695d22adba | |||
|  | fefe208260 | ||
| bc1a63354c | |||
| c14101714c | |||
| faebb0fe30 | |||
| 8ec5636c57 | |||
| 68d99050bc | |||
| fba7060a91 | |||
| 6894fa7101 | |||
| 41fa1d9ca6 | |||
| f4bca2f410 | |||
| 6198891202 | |||
| c806c06279 | |||
| e04c02055c | |||
| 4fa1bb4341 | |||
| ac5675933d | |||
| e7db71b0f3 | |||
|  | 1967fc4bed | ||
|  | befd5dac42 | ||
| 186b8847d9 | |||
| 90d0cbc3b1 | |||
| ac3d39b151 | |||
| efb5bd64b4 | |||
| 76a7b019eb | |||
| 739540af64 | |||
| 230d73498e | |||
|  | a68a43adc0 | ||
|  | 5a75e38f33 | ||
| 1c02eb23fd | |||
| 1ba5df1280 | |||
| 73c4a5d39d | |||
| 0a58c43952 | |||
| a3b823d33f | |||
| de45555c5a | |||
| 0add020e57 | |||
| 84a76d2c76 | |||
| d88207132b | |||
| 932d0e86d9 | |||
| 671f1223b5 | |||
| 1a04d903fc | |||
| 125dd4d980 | |||
| 2ddab027ed | |||
| 1724400d7c | |||
| d1a0934bb1 | |||
| bc90664480 | |||
| 99dc7490cb | |||
| 5ac485e06e | |||
| dc184762d6 | |||
| 86e7b0f007 | |||
| fdafe7c82b | |||
| d285d84068 | |||
| da22532587 | |||
| b83ad77fd8 | |||
| 00ac6aa1b9 | |||
| 318c001904 | |||
| e2d406b97b | |||
|  | efff496f7a | ||
| fe4eaa92be | |||
| cb17a7e8a5 | |||
| ad4153a07e | |||
| e95093f144 | |||
| 59cdf07c7e | |||
| 292c9380ad | |||
| 701ad17299 | |||
| 7f41f14959 | |||
| fcd5fba13e | |||
| 2c57eab4d2 | |||
| 2cd51eed2e | |||
| 72e306b583 | |||
| 917dd49d07 | |||
| 71ca912749 | |||
| 4620e32b82 | |||
| 0cda5d637d | |||
| 646f39b9ed | |||
|  | 105fe16122 | ||
|  | 4d1a553474 | ||
| 5bfdee0c28 | |||
| ae33392ad0 | |||
| 0e0fe90277 | |||
| 792eafce72 | |||
| 616d01a6c9 | |||
|  | 21edc74ada | ||
| ab23290599 | |||
| 1a2e1eaf2a | |||
| feaee8a0b1 | |||
| 0a26e7f326 | |||
| ebf85d4e4d | |||
| 72cffd7a3d | |||
| 65418b17ce | |||
|  | 8432c215a3 | ||
|  | 87e1f8f077 | ||
|  | 33f393203e | ||
| 6aa1e136b4 | |||
| 10a9b6c909 | |||
| ce912e4405 | |||
| ab11d3e8b3 | |||
|  | 445fe0cee4 | ||
| 7c6c8de456 | |||
| 0378df42b6 | |||
| ad8d40cb1c | |||
| f4516f8369 | |||
| 5b25f82963 | |||
| 8720cc730e | |||
| 44d1535bfb | |||
| 8d663cdee6 | |||
| 7c8b08c3a7 | |||
| 6df570d96c | |||
| 3ce650eea6 | |||
| 6ef7d9b47b | |||
| af3847366b | |||
| d70f8aa712 | |||
| 14463dcd38 | |||
| b9c2d63a53 | |||
| 3fd4c6339a | |||
| 4d76de5f9f | |||
| 0a92ad905b | |||
| 7af7135971 | |||
| c70a4dc664 | |||
| dc0fae7549 | |||
| b38924cc3d | |||
| 58c4e37116 | |||
| 3656825d20 | |||
| 39a7cecd24 | |||
| 6d382f93e8 | |||
| 6e554e74ab | |||
| 4c125865cf | |||
| 12c68a4c9f | |||
| 66ac5c7435 | |||
| e4b46a188c | |||
| 7a78e8a6a7 | |||
| 4496836cb2 | |||
| 88d1fe24b4 | |||
| 0ea1708fe9 | |||
| a9b7cf93e9 | |||
| 5d36e56641 | |||
| f00dfad98e | |||
| 7943c22ae7 | |||
| d365fcea39 | |||
| 9f9f9d7881 | |||
| 20f814766c | |||
| ed00a882af | |||
| 5d7501d36e | |||
| ab5f9923a6 | |||
| 1a5e8b9d7b | |||
| f7f2bb0caa | |||
| bf7fcfa41a | |||
| 9056ea8449 | |||
| f0e349a2b0 | |||
| 2ccc6f1976 | |||
| cf041cf49e | |||
| 72d593e416 | |||
| 287dca07aa | |||
| 910f9a7e8e | |||
| 9457483a6b | |||
| 6d07168529 | |||
| 420f81ea24 | |||
| 416b62fc60 | |||
| ecae7dab44 | |||
| 126bd1a4eb | |||
| 450792e446 | |||
| ec155b1d67 | |||
| 02b2af7d51 | |||
| 0a6a2c968c | |||
| 4b188e2df6 | |||
| d6bf1988f6 | |||
| 94c9505c05 | |||
| 4a5a1440ff | |||
| b31cc460fa | |||
| 48c3432191 | |||
| 7b4405f6fe | |||
| ce3a74326d | |||
| 51ab013bd7 | |||
| 41a6366efe | |||
| c3c2fd30f0 | |||
| 1952e4aa5a | |||
| 1e1311b7c8 | |||
| fc1ed8b71e | |||
| 2144b247b3 | |||
| e4629ed599 | |||
| f27dca6fb5 | |||
| 8c27ec0720 | |||
| 8392e2e6bd | |||
| 963b0b1ed2 | |||
|  | 7513187a6d | ||
|  | 990fc0e484 | ||
| 8fce27a128 | |||
| 55c2c41cea | |||
| 0bd10b6dfa | |||
| 8cd01d4317 | |||
| 71293e3378 | |||
| cb58afa44a | |||
| 7b3e9cb490 | |||
| fb720a382f | |||
| a4bfa1cb16 | |||
| 502f2aceed | |||
|  | eb9cc0b63f | ||
|  | 7ee554b48d | ||
|  | 2e6d281bfc | ||
|  | 4b1bf7ce23 | ||
|  | 2d574fea2e | ||
| 0e2772336f | |||
| 320d11671a | |||
| 6ef5390a26 | |||
| dec26e2ba4 | |||
| 514d75fa5f | |||
| 0ac51da31a | |||
| 90d43b0bd3 | |||
| 5fe0790912 | |||
| ff66aa5590 | |||
| 8e2d3616b5 | |||
| c046824ea3 | |||
| a9b216b16b | |||
| f866eae581 | |||
|  | 21d4e49fce | ||
| 17b887160a | |||
| c7dbaae8d6 | |||
|  | 25ee11e4ff | ||
|  | df661fc7c4 | ||
|  | 6b78c06dfb | ||
| daff4e4200 | |||
| 53b3f98bba | |||
| 2b47868d88 | |||
| 54c2b92962 | |||
|  | d087f051f0 | ||
|  | b3edba3abe | ||
|  | 02d8ceba25 | ||
|  | 741043c177 | ||
| c42f62de4c | |||
| e23ef35b75 | |||
| eccc75aecf | |||
| 7e2fbf93f9 | |||
| 6ab8f95f7d | |||
| ad05b3bf05 | |||
| 1faa9812db | |||
| a786578cbe | |||
| c08bd76e4b | |||
| 20a4950c60 | |||
| cdbae1eade | |||
| 45f3bb00d6 | |||
| 2b9f0e5177 | |||
| fcf2ae364f | |||
| 92788ccdc0 | |||
| 84993ca05b | |||
| 972657b38e | |||
| b26d0905a3 | |||
| 4ab0a28f7d | |||
| 52009bd7c6 | |||
| 7acd6c7fc3 | |||
| f26cba415b | |||
| 8a2e588190 | |||
| d63d9c2f4e | |||
| dcdee1d6e3 | |||
| dd589af1be | |||
|  | ce594692b3 | ||
|  | 17076024f7 | ||
|  | 61607fee3d | ||
|  | 25ebeebdfb | ||
|  | 343b2a6f2f | ||
|  | d4efe81dbb | ||
|  | 9d6afc4bb2 | ||
| 2bdf116698 | |||
| 96dc711b4f | |||
| c736c2b5bb | |||
|  | d1918e4be0 | ||
| b3aca957ff | |||
| 03bd4d1942 | |||
|  | 040c5f8847 | ||
|  | 9b5990916f | ||
|  | 74e94637b9 | ||
|  | 216c035bac | ||
|  | 16c86daafb | ||
|  | 175fa7bf2f | ||
|  | 9f7f6e33e8 | ||
|  | 3471bdec0d | ||
| 409cd40460 | |||
| 2811e61439 | |||
| 2ff34688bb | |||
| 8133dd7385 | |||
|  | 256dab3739 | ||
| 532a751509 | |||
|  | f0a7565302 | ||
| 64c4f1ece2 | |||
|  | ad983d80d2 | ||
| 001e2f9622 | |||
| 58ac4b01ef | |||
| 6e4bfd45c6 | |||
| ff0b0678a5 | |||
| 3b56cc818b | |||
| 21d5f974eb | |||
| 59b2b07a21 | |||
| eaf9f72fdd | |||
| 169442decc | |||
| cf8e25e823 | |||
| 96b1f31665 | |||
| 2ad798c0bf | |||
| 7e932e838f | |||
| 41354097f3 | |||
| 9a3f35703b | |||
| 5423de3bd9 | |||
| 5e3d421b56 | |||
| 71ca033b08 | |||
|  | 2c774e814e | ||
| 3034ba411f | |||
| ce6e51df87 | |||
|  | 6843b4cb2a | ||
| dcbce270ad | |||
| 3f5a6c6b15 | |||
| d806551477 | |||
| 120ce40dbe | |||
| 22022e5143 | |||
| 20fcaa5428 | |||
| 819017112d | |||
| d7d7fb5693 | |||
| 650e0d79be | |||
| 0afccd12a9 | |||
| 7abe3e1b2d | 
							
								
								
									
										64
									
								
								.env
									
									
									
									
									
								
							
							
						
						
									
										64
									
								
								.env
									
									
									
									
									
								
							| @@ -1,64 +0,0 @@ | ||||
| ## | ||||
| ##  Manually dump .env files in .env.local.php with | ||||
| ## `$ composer symfony:dump-env prod` | ||||
| ## | ||||
|  | ||||
| ## Project environment | ||||
| APP_ENV=dev | ||||
|  | ||||
| ## Enable debug | ||||
| APP_DEBUG=true | ||||
|  | ||||
| ## Locale | ||||
| LOCALE=fr | ||||
|  | ||||
| ## Framework secret | ||||
| APP_SECRET=ThisTokenIsNotSoSecretChangeIt | ||||
|  | ||||
| ## Symfony/swiftmailer | ||||
| MAILER_TRANSPORT=smtp | ||||
| MAILER_HOST=smtp | ||||
| MAILER_PORT=1025 | ||||
| MAILER_CRYPT= | ||||
| MAILER_AUTH= | ||||
| MAILER_USER= | ||||
| MAILER_PASSWORD= | ||||
| MAILER_URL=${MAILER_TRANSPORT}://${MAILER_HOST}:${MAILER_PORT}?encryption=${MAILER_CRYPT}&auth_mode=${MAILER_AUTH}&username=${MAILER_USER}&password=${MAILER_PASSWORD} | ||||
|  | ||||
| ## Notifications | ||||
| NOTIFICATION_HOST=localhost:8001 | ||||
| NOTIFICATION_FROM_EMAIL=admin@chill.social | ||||
| NOTIFICATION_FROM_NAME=Chill | ||||
|  | ||||
| ## Gelf | ||||
| GELF_HOST=gelf | ||||
| GELF_PORT=12201 | ||||
|  | ||||
| ## OVH OpenStack Storage User/Role | ||||
| OS_USERNAME= | ||||
| OS_PASSWORD= | ||||
| OS_TENANT_ID= | ||||
| OS_REGION_NAME=GRA | ||||
| OS_AUTH_URL=https://auth.cloud.ovh.net/v2.0/ | ||||
|  | ||||
| ## OVH OpenStack Storage Container | ||||
| ASYNC_UPLOAD_TEMP_URL_KEY= | ||||
| ASYNC_UPLOAD_TEMP_URL_BASE_PATH= | ||||
| ASYNC_UPLOAD_TEMP_URL_CONTAINER= | ||||
|  | ||||
| ## Redis Cache | ||||
| REDIS_HOST=redis | ||||
| REDIS_PORT=6379 | ||||
| REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT} | ||||
|  | ||||
| ## Twilio | ||||
| TWILIO_SID=~ | ||||
| TWILIO_SECRET=~ | ||||
|  | ||||
| ## DOCKER IMAGES REGISTRY | ||||
| #IMAGE_PHP= | ||||
| #IMAGE_NGINX= | ||||
|  | ||||
| ## DOCKER IMAGES VERSION | ||||
| #VERSION=test | ||||
| VERSION=prod | ||||
							
								
								
									
										117
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										117
									
								
								CHANGELOG.md
									
									
									
									
									
								
							| @@ -9,12 +9,127 @@ and this project adheres to | ||||
| * date versioning for test releases | ||||
|  | ||||
| ## Unreleased | ||||
| * AddPersons: remove ul-li html tags from AddPersons (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/419) | ||||
|  | ||||
| <!-- write down unreleased development here --> | ||||
|  | ||||
| * fix normalisation of accompanying course requestor api (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/378) | ||||
| * [person] add a returnPath when clicking on some Person or ThirdParty badge (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/427) | ||||
| * [person] accompanying course work: fix on-the-fly update of thirdParty  | ||||
| * [on-the-fly] close modal only after validation | ||||
| * [person] correct thirdparty PATCH url + add email and altnames in AddPerson and serializer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/433) | ||||
| * change order for accompanying course work list | ||||
| * [parcours]: Mes parcours brouillon added to user menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/440) | ||||
| * [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414) | ||||
| * [person]: style fix in parcours listing per person. (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/432) | ||||
| * [household]: display address of current household (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/415) | ||||
| * ajoute un ordre dans les localisation (api) | ||||
| * [pick entity]: fix translations in modal (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/419) | ||||
| * [homepage_widget]: fix translation on emergency badge (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/440) | ||||
| * [person]: create person and household added to button dropdown (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/454) | ||||
| * display full address in address.text in normalization. Adapt AddressRenderBox | ||||
| * [address]: Correction residential address 'depuis le' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/459) | ||||
| * [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414) | ||||
| * [Thirdparty_contact]: address blurred if confidential in view page (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/450) | ||||
|  | ||||
| ## Test releases | ||||
|  | ||||
| ### test release 2021-02-01 | ||||
|  | ||||
| * renommer "dossier numéro" en "parcours numéro" dans les résultats de recherche | ||||
| * renomme date de début en date d'ouverture dans le formulaire parcours | ||||
| * [homepage widget] improve content tables, improve counter pluralization with style on number | ||||
| * [notification lists] add comments counter information | ||||
| * [workflows] fix popover header with previous transition | ||||
| * [parcours]: validation + message for closing parcours adjusted. | ||||
| * [household]: household composition double edit button replaced by a delete action (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/426) | ||||
| [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413 | ||||
| [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc. | ||||
| * [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421) | ||||
| * [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424) | ||||
| * [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429) | ||||
| * [person_resource]: Onthefly button added to view person/thirdparty and badge differentiation for a contact-thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/428) | ||||
| * [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal | ||||
| * [AddAddress] disable multiselect search, and rely only on most pertinent Cities and Street computed backend | ||||
| * [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413 | ||||
| * [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc. | ||||
|  | ||||
| ### test release 2021-01-31 | ||||
|  | ||||
| * [person] accompanying course: optimisation: do not fetch some resources for the banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/409) | ||||
| * [person] accompanying course: close modal when edit participation (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/420) | ||||
| * [person] accompanying course: treat validation error when editing on-the-fly entities (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/420) | ||||
| * [activity] show activity attendee (présence) in the activity list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/412) | ||||
| * [activity] admin: change validation rule for social action visible field (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/413) | ||||
| * [parcours]: component added to change the opening date of a parcours (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/411) | ||||
| * [search]: listing of parcours display changed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/410) | ||||
| * [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) | ||||
| * [person] age added to renderstring + renderbox/ vue component created to display person text (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/389) | ||||
| * [household member editor] allow to push to existing household | ||||
|  | ||||
|  | ||||
| ### test release 2021-01-28 | ||||
|  | ||||
| * [person] improve filiations vis graph: disable physics, use chill colors for persons-households-course, increase label of relations, remove labels on household arrows and other improvements (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/286, https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/362) | ||||
| * [activity] Order activity by date and by id (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/364) | ||||
| * [main] increase length of 4 Address fields (change to TEXT, no size limits) (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/277) | ||||
| * [main] Add confidential option for address, in edit and view (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/165) | ||||
| * [person] name suggestions within create person form when person is created departing from a search input (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/377) | ||||
| * [person] Add residential address entity, form and list for each person | ||||
| * [aside_activity]: dynamicUserPickerType used (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/399) | ||||
| * dispatching list | ||||
|  | ||||
|  | ||||
| ### test release 2021-01-26 | ||||
|  | ||||
| * [parcours] comments truncated if too long + link added (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/406) | ||||
| * [person]: possibility to add person resources (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/382) | ||||
| * [person ressources]: module added | ||||
|  | ||||
|  | ||||
| ### test release 2022-01-24 | ||||
|  | ||||
| * [person] name suggestions within create person form when person is created departing from a search input (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/377) | ||||
| * [notification: formulaire création] descend la box avec la description dans le bas du formulaire | ||||
| * [notification for activity]: fix link to activity | ||||
| * [notification] add "URGENT" before accompanying course with emergency = true | ||||
| * [notification] add a "read more" button on system notification | ||||
| * [notification] add `[Chill]` in the subject of each notification, automatically | ||||
| * [notification] add a counter for notification in activity list and accompanying period list, and search results | ||||
| * [parcours] bugfix if deathdate is not defined (eg. for a thirdparty) parcours is still displayed. Gave error before. | ||||
| * [workflow] add breadcrumb to show steps | ||||
| * [popover] add popover html popup mechanism (used by workflow breadcrumb) | ||||
| * [templates] improve updatedBy macro in item metadatas | ||||
| * [parcours]: bug fix when comment is pinned all other comments remain in the collection (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/385) | ||||
| * [workflow] | ||||
|   * add My workflow section with my opened subscriptions | ||||
|   * apply workflow on documents, accompanyingCourseWork and Evaluations | ||||
| * [wopi-link] a new vue component allow to open wopi link in a fullscreen chill-themed modal | ||||
|  | ||||
| ### test release 2022-01-19 | ||||
| * vuejs: add dead information on all on-the-fly person render boxes, in vis graph and other templates (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/271) | ||||
| * [thirdparty] fix bug in 3rd party view: types was replaced by thirdPartyTypes | ||||
| * [main] location form type: fix unmapped address field (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/246) | ||||
| * [activity] fix wrong import of js assets for adding and viewing documents in activity (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/83 & https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/176) | ||||
| * [person]: space added between deathdate and age in twig renderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/380) | ||||
| * [forms] dynamic picker types for user/person/thirdparty types created (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/386) | ||||
|  | ||||
| ### test release 2022-01-17 | ||||
|  | ||||
| * [main] Add editableByUser field to locationType entity, adapt the admin template and add this condition in the location-type endpoint (see https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/297) | ||||
| * [main] Add mainLocation field to User entity and add it in user form type | ||||
| * rewrite page which allow to select activity | ||||
| * [main] Add mainLocation field to User entity and add it in user form type | ||||
| * [course list in person context] show full username/label for ref | ||||
| * [accompanying period work] remove the possibility to  generate document from an accompanying period work | ||||
| * vuejs: add validation on required fields for AddPerson, Address and Location components | ||||
| * vuejs: treat 422 validation errors in locations and AddPerson components | ||||
| * [person]: space added between deathdate and age in twig renderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/380) | ||||
|  | ||||
| ## Test releases | ||||
| * vuejs: add validation on required fields for AddPerson, Address and Location components | ||||
| * vuejs: treat 422 validation errors in locations and AddPerson components | ||||
| * [person]: space added between deathdate and age in twig renderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/380) | ||||
|  | ||||
| ### test release 2022-01-12 | ||||
|  | ||||
| * fix thirdparty normalizer on telephone field: https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/322 | ||||
|   | ||||
| @@ -52,9 +52,6 @@ | ||||
|         "twig/string-extra": "^3.3", | ||||
|         "twig/twig": "^3.0" | ||||
|     }, | ||||
|     "conflict": { | ||||
|         "symfony/symfony": "*" | ||||
|     }, | ||||
|     "require-dev": { | ||||
|         "doctrine/doctrine-fixtures-bundle": "^3.3", | ||||
|         "drupol/php-conventions": "^5", | ||||
| @@ -71,23 +68,17 @@ | ||||
|         "symfony/var-dumper": "^4.4", | ||||
|         "symfony/web-profiler-bundle": "^4.4" | ||||
|     }, | ||||
|     "config": { | ||||
|         "bin-dir": "bin", | ||||
|         "optimize-autoloader": true, | ||||
|         "sort-packages": true, | ||||
|         "vendor-dir": "tests/app/vendor", | ||||
|         "allow-plugins": { | ||||
|             "composer/package-versions-deprecated": true, | ||||
|             "phpstan/extension-installer": true, | ||||
|             "ergebnis/composer-normalize": true, | ||||
|             "phpro/grumphp": true | ||||
|         } | ||||
|     "conflict": { | ||||
|         "symfony/symfony": "*" | ||||
|     }, | ||||
|     "autoload": { | ||||
|         "psr-4": { | ||||
|             "Chill\\ActivityBundle\\": "src/Bundle/ChillActivityBundle", | ||||
|             "Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src", | ||||
|             "Chill\\BudgetBundle\\": "src/Bundle/ChillBudgetBundle", | ||||
|             "Chill\\CalendarBundle\\": "src/Bundle/ChillCalendarBundle", | ||||
|             "Chill\\CustomFieldsBundle\\": "src/Bundle/ChillCustomFieldsBundle", | ||||
|             "Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle", | ||||
|             "Chill\\DocStoreBundle\\": "src/Bundle/ChillDocStoreBundle", | ||||
|             "Chill\\EventBundle\\": "src/Bundle/ChillEventBundle", | ||||
|             "Chill\\FamilyMemberBundle\\": "src/Bundle/ChillFamilyMemberBundle", | ||||
| @@ -96,9 +87,6 @@ | ||||
|             "Chill\\ReportBundle\\": "src/Bundle/ChillReportBundle", | ||||
|             "Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle", | ||||
|             "Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle", | ||||
|             "Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src", | ||||
|             "Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle", | ||||
|             "Chill\\CalendarBundle\\": "src/Bundle/ChillCalendarBundle", | ||||
|             "Chill\\WopiBundle\\": "src/Bundle/ChillWopiBundle/src" | ||||
|         } | ||||
|     }, | ||||
| @@ -111,10 +99,10 @@ | ||||
|     "config": { | ||||
|         "allow-plugins": { | ||||
|             "composer/package-versions-deprecated": true, | ||||
|             "phpstan/extension-installer": true, | ||||
|             "ergebnis/composer-normalize": true, | ||||
|             "ocramius/package-versions": true, | ||||
|             "phpro/grumphp": true, | ||||
|             "ocramius/package-versions": true | ||||
|             "phpstan/extension-installer": true | ||||
|         }, | ||||
|         "bin-dir": "bin", | ||||
|         "optimize-autoloader": true, | ||||
| @@ -123,8 +111,8 @@ | ||||
|     }, | ||||
|     "scripts": { | ||||
|         "auto-scripts": { | ||||
|             "cache:clear": "symfony-cmd", | ||||
|             "assets:install %PUBLIC_DIR%": "symfony-cmd" | ||||
|             "assets:install %PUBLIC_DIR%": "symfony-cmd", | ||||
|             "cache:clear": "symfony-cmd" | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,3 +0,0 @@ | ||||
| add npm/yarn dependency in package.json : | ||||
|  | ||||
| "select2-bootstrap-theme": "0.1.0-beta.10", | ||||
| @@ -80,11 +80,6 @@ parameters: | ||||
| 			count: 1 | ||||
| 			path: src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php | ||||
|  | ||||
| 		- | ||||
| 			message: "#^Foreach overwrites \\$action with its value variable\\.$#" | ||||
| 			count: 1 | ||||
| 			path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php | ||||
|  | ||||
| 		- | ||||
| 			message: "#^Foreach overwrites \\$action with its value variable\\.$#" | ||||
| 			count: 1 | ||||
|   | ||||
| @@ -30,36 +30,6 @@ parameters: | ||||
|             count: 2 | ||||
|             path: src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php | ||||
|  | ||||
|         - | ||||
|             message: "#^Parameter \\$action of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:buildQueryBySocialActionWithDescendants\\(\\) has invalid type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\SocialAction\\.$#" | ||||
|             count: 1 | ||||
|             path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php | ||||
|  | ||||
|         - | ||||
|             message: "#^Parameter \\$action of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:countBySocialActionWithDescendants\\(\\) has invalid type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\SocialAction\\.$#" | ||||
|             count: 1 | ||||
|             path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php | ||||
|  | ||||
|         - | ||||
|             message: "#^Undefined variable\\: \\$action$#" | ||||
|             count: 1 | ||||
|             path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php | ||||
|  | ||||
|         - | ||||
|             message: "#^Undefined variable\\: \\$limit$#" | ||||
|             count: 1 | ||||
|             path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php | ||||
|  | ||||
|         - | ||||
|             message: "#^Undefined variable\\: \\$offset$#" | ||||
|             count: 1 | ||||
|             path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php | ||||
|  | ||||
|         - | ||||
|             message: "#^Undefined variable\\: \\$orderBy$#" | ||||
|             count: 1 | ||||
|             path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php | ||||
|  | ||||
|         - | ||||
|             message: "#^Variable variables are not allowed\\.$#" | ||||
|             count: 4 | ||||
|   | ||||
| @@ -408,24 +408,6 @@ parameters: | ||||
| 			count: 1 | ||||
| 			path: src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php | ||||
|  | ||||
| 		- | ||||
| 			message: | ||||
| 				""" | ||||
| 					#^Call to deprecated method getReachableScopes\\(\\) of class Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\: | ||||
| 					Use getReachableCircles$# | ||||
| 				""" | ||||
| 			count: 1 | ||||
| 			path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php | ||||
|  | ||||
| 		- | ||||
| 			message: | ||||
| 				""" | ||||
| 					#^Parameter \\$translator of method Chill\\\\DocStoreBundle\\\\Controller\\\\DocumentPersonController\\:\\:__construct\\(\\) has typehint with deprecated interface Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\: | ||||
| 					since Symfony 4\\.2, use Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface instead$# | ||||
| 				""" | ||||
| 			count: 1 | ||||
| 			path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php | ||||
|  | ||||
| 		- | ||||
| 			message: | ||||
| 				""" | ||||
| @@ -927,15 +909,6 @@ parameters: | ||||
| 			count: 1 | ||||
| 			path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php | ||||
|  | ||||
| 		- | ||||
| 			message: | ||||
| 				""" | ||||
| 					#^Parameter \\$trans of method Chill\\\\PersonBundle\\\\Controller\\\\AccompanyingCourseWorkController\\:\\:__construct\\(\\) has typehint with deprecated interface Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\: | ||||
| 					since Symfony 4\\.2, use Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface instead$# | ||||
| 				""" | ||||
| 			count: 1 | ||||
| 			path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php | ||||
|  | ||||
| 		- | ||||
| 			message: | ||||
| 				""" | ||||
|   | ||||
| @@ -400,11 +400,6 @@ parameters: | ||||
| 			count: 1 | ||||
| 			path: src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php | ||||
|  | ||||
| 		- | ||||
| 			message: "#^Method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:buildQueryBySocialActionWithDescendants\\(\\) has invalid return type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\QueryBuilder\\.$#" | ||||
| 			count: 1 | ||||
| 			path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php | ||||
|  | ||||
| 		- | ||||
| 			message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" | ||||
| 			count: 3 | ||||
|   | ||||
| @@ -31,15 +31,17 @@ use DateTime; | ||||
| use Doctrine\ORM\EntityManagerInterface; | ||||
| use InvalidArgumentException; | ||||
| use Psr\Log\LoggerInterface; | ||||
| use RuntimeException; | ||||
| use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||||
| use Symfony\Component\EventDispatcher\EventDispatcherInterface; | ||||
| use Symfony\Component\Form\Extension\Core\Type\HiddenType; | ||||
| use Symfony\Component\Form\Extension\Core\Type\SubmitType; | ||||
| use Symfony\Component\Form\FormInterface; | ||||
| use Symfony\Component\HttpFoundation\Request; | ||||
| use Symfony\Component\HttpFoundation\Response; | ||||
| use Symfony\Component\Security\Core\Role\Role; | ||||
| use Symfony\Component\Serializer\SerializerInterface; | ||||
|  | ||||
| use Symfony\Component\Serializer\SerializerInterface; | ||||
| use function array_key_exists; | ||||
|  | ||||
| final class ActivityController extends AbstractController | ||||
| @@ -199,12 +201,36 @@ final class ActivityController extends AbstractController | ||||
|             'role' => new Role('CHILL_ACTIVITY_UPDATE'), | ||||
|             'activityType' => $entity->getActivityType(), | ||||
|             'accompanyingPeriod' => $accompanyingPeriod, | ||||
|         ])->handleRequest($request); | ||||
|         ]); | ||||
|  | ||||
|         if ($form->has('documents')) { | ||||
|             $form->add('gendocTemplateId', HiddenType::class, [ | ||||
|                 'mapped' => false, | ||||
|                 'data' => null, | ||||
|                 'attr' => [ | ||||
|                     // required for js | ||||
|                     'data-template-id' => 'data-template-id', | ||||
|                 ], | ||||
|             ]); | ||||
|         } | ||||
|  | ||||
|         $form->handleRequest($request); | ||||
|  | ||||
|         if ($form->isSubmitted() && $form->isValid()) { | ||||
|             $this->entityManager->persist($entity); | ||||
|             $this->entityManager->flush(); | ||||
|  | ||||
|             if ($form->has('gendocTemplateId') && null !== $form['gendocTemplateId']->getData()) { | ||||
|                 return $this->redirectToRoute( | ||||
|                     'chill_docgenerator_generate_from_template', | ||||
|                     [ | ||||
|                         'template' => $form->get('gendocTemplateId')->getData(), | ||||
|                         'entityClassName' => Activity::class, | ||||
|                         'entityId' => $entity->getId(), | ||||
|                     ] | ||||
|                 ); | ||||
|             } | ||||
|  | ||||
|             $this->addFlash('success', $this->get('translator')->trans('Success : activity updated!')); | ||||
|  | ||||
|             $params = $this->buildParamsToUrl($person, $accompanyingPeriod); | ||||
| @@ -255,7 +281,7 @@ final class ActivityController extends AbstractController | ||||
|         if ($person instanceof Person) { | ||||
|             $this->denyAccessUnlessGranted(ActivityVoter::SEE, $person); | ||||
|             $activities = $this->activityACLAwareRepository | ||||
|                 ->findByPerson($person, ActivityVoter::SEE, 0, null); | ||||
|                 ->findByPerson($person, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']); | ||||
|  | ||||
|             $event = new PrivacyEvent($person, [ | ||||
|                 'element_class' => Activity::class, | ||||
| @@ -268,7 +294,7 @@ final class ActivityController extends AbstractController | ||||
|             $this->denyAccessUnlessGranted(ActivityVoter::SEE, $accompanyingPeriod); | ||||
|  | ||||
|             $activities = $this->activityACLAwareRepository | ||||
|                 ->findByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE); | ||||
|                 ->findByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']); | ||||
|  | ||||
|             $view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig'; | ||||
|         } | ||||
| @@ -392,12 +418,36 @@ final class ActivityController extends AbstractController | ||||
|             'role' => new Role('CHILL_ACTIVITY_CREATE'), | ||||
|             'activityType' => $entity->getActivityType(), | ||||
|             'accompanyingPeriod' => $accompanyingPeriod, | ||||
|         ])->handleRequest($request); | ||||
|         ]); | ||||
|  | ||||
|         if ($form->has('documents')) { | ||||
|             $form->add('gendocTemplateId', HiddenType::class, [ | ||||
|                 'mapped' => false, | ||||
|                 'data' => null, | ||||
|                 'attr' => [ | ||||
|                     // required for js | ||||
|                     'data-template-id' => 'data-template-id', | ||||
|                 ], | ||||
|             ]); | ||||
|         } | ||||
|  | ||||
|         $form->handleRequest($request); | ||||
|  | ||||
|         if ($form->isSubmitted() && $form->isValid()) { | ||||
|             $this->entityManager->persist($entity); | ||||
|             $this->entityManager->flush(); | ||||
|  | ||||
|             if ($form->has('gendocTemplateId') && null !== $form['gendocTemplateId']->getData()) { | ||||
|                 return $this->redirectToRoute( | ||||
|                     'chill_docgenerator_generate_from_template', | ||||
|                     [ | ||||
|                         'template' => $form->get('gendocTemplateId')->getData(), | ||||
|                         'entityClassName' => Activity::class, | ||||
|                         'entityId' => $entity->getId(), | ||||
|                     ] | ||||
|                 ); | ||||
|             } | ||||
|  | ||||
|             $this->addFlash('success', $this->get('translator')->trans('Success : activity created!')); | ||||
|  | ||||
|             $params = $this->buildParamsToUrl($person, $accompanyingPeriod); | ||||
| @@ -471,20 +521,21 @@ final class ActivityController extends AbstractController | ||||
|  | ||||
|     public function showAction(Request $request, int $id): Response | ||||
|     { | ||||
|         $view = null; | ||||
|         $entity = $this->activityRepository->find($id); | ||||
|  | ||||
|         [$person, $accompanyingPeriod] = $this->getEntity($request); | ||||
|         if (null === $entity) { | ||||
|             throw $this->createNotFoundException('Unable to find Activity entity.'); | ||||
|         } | ||||
|  | ||||
|         $accompanyingPeriod = $entity->getAccompanyingPeriod(); | ||||
|         $person = $entity->getPerson(); | ||||
|  | ||||
|         if ($accompanyingPeriod instanceof AccompanyingPeriod) { | ||||
|             $view = 'ChillActivityBundle:Activity:showAccompanyingCourse.html.twig'; | ||||
|         } elseif ($person instanceof Person) { | ||||
|             $view = 'ChillActivityBundle:Activity:showPerson.html.twig'; | ||||
|         } | ||||
|  | ||||
|         $entity = $this->activityRepository->find($id); | ||||
|  | ||||
|         if (null === $entity) { | ||||
|             throw $this->createNotFoundException('Unable to find Activity entity.'); | ||||
|         } else { | ||||
|             throw new RuntimeException('the activity should be linked with a period or person'); | ||||
|         } | ||||
|  | ||||
|         if (null !== $accompanyingPeriod) { | ||||
| @@ -493,8 +544,7 @@ final class ActivityController extends AbstractController | ||||
|             $entity->personsNotAssociated = $entity->getPersonsNotAssociated(); | ||||
|         } | ||||
|  | ||||
|         // TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période | ||||
|         // $this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity); | ||||
|         $this->denyAccessUnlessGranted(ActivityVoter::SEE, $entity); | ||||
|  | ||||
|         $deleteForm = $this->createDeleteForm($entity->getId(), $person, $accompanyingPeriod); | ||||
|  | ||||
|   | ||||
| @@ -12,7 +12,7 @@ declare(strict_types=1); | ||||
| namespace Chill\ActivityBundle\Entity; | ||||
|  | ||||
| use Chill\ActivityBundle\Validator\Constraints as ActivityValidator; | ||||
| use Chill\DocStoreBundle\Entity\Document; | ||||
| use Chill\DocStoreBundle\Entity\StoredObject; | ||||
| use Chill\MainBundle\Entity\Center; | ||||
| use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; | ||||
| use Chill\MainBundle\Entity\HasCenterInterface; | ||||
| @@ -67,7 +67,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType") | ||||
|      * @Groups({"read"}) | ||||
|      * @Groups({"read", "docgen:read"}) | ||||
|      * @SerializedName("activityType") | ||||
|      * @ORM\JoinColumn(name="type_id") | ||||
|      */ | ||||
| @@ -75,16 +75,19 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence") | ||||
|      * @Groups({"docgen:read"}) | ||||
|      */ | ||||
|     private ?ActivityPresence $attendee = null; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_") | ||||
|      * @Groups({"docgen:read"}) | ||||
|      */ | ||||
|     private CommentEmbeddable $comment; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="datetime") | ||||
|      * @Groups({"docgen:read"}) | ||||
|      */ | ||||
|     private DateTime $date; | ||||
|  | ||||
| @@ -100,6 +103,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="boolean", options={"default": false}) | ||||
|      * @Groups({"docgen:read"}) | ||||
|      */ | ||||
|     private bool $emergency = false; | ||||
|  | ||||
| @@ -107,13 +111,13 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac | ||||
|      * @ORM\Id | ||||
|      * @ORM\Column(name="id", type="integer") | ||||
|      * @ORM\GeneratedValue(strategy="AUTO") | ||||
|      * @Groups({"read"}) | ||||
|      * @Groups({"read", "docgen:read"}) | ||||
|      */ | ||||
|     private ?int $id = null; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location") | ||||
|      * @groups({"read"}) | ||||
|      * @groups({"read", "docgen:read"}) | ||||
|      */ | ||||
|     private ?Location $location = null; | ||||
|  | ||||
| @@ -124,42 +128,45 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person") | ||||
|      * @Groups({"read"}) | ||||
|      * @Groups({"read", "docgen:read"}) | ||||
|      */ | ||||
|     private ?Collection $persons = null; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason") | ||||
|      * @Groups({"docgen:read"}) | ||||
|      */ | ||||
|     private Collection $reasons; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope") | ||||
|      * @Groups({"docgen:read"}) | ||||
|      */ | ||||
|     private ?Scope $scope = null; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="string", options={"default": ""}) | ||||
|      * @Groups({"docgen:read"}) | ||||
|      */ | ||||
|     private string $sentReceived = ''; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction") | ||||
|      * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction") | ||||
|      * @Groups({"read"}) | ||||
|      * @Groups({"read", "docgen:read"}) | ||||
|      */ | ||||
|     private Collection $socialActions; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue") | ||||
|      * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue") | ||||
|      * @Groups({"read"}) | ||||
|      * @Groups({"read", "docgen:read"}) | ||||
|      */ | ||||
|     private Collection $socialIssues; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty") | ||||
|      * @Groups({"read"}) | ||||
|      * @Groups({"read", "docgen:read"}) | ||||
|      */ | ||||
|     private ?Collection $thirdParties = null; | ||||
|  | ||||
| @@ -170,12 +177,13 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") | ||||
|      * @Groups({"docgen:read"}) | ||||
|      */ | ||||
|     private User $user; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User") | ||||
|      * @Groups({"read"}) | ||||
|      * @Groups({"read", "docgen:read"}) | ||||
|      */ | ||||
|     private ?Collection $users = null; | ||||
|  | ||||
| @@ -191,7 +199,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac | ||||
|         $this->socialActions = new ArrayCollection(); | ||||
|     } | ||||
|  | ||||
|     public function addDocument(Document $document): self | ||||
|     public function addDocument(StoredObject $document): self | ||||
|     { | ||||
|         $this->documents[] = $document; | ||||
|  | ||||
| @@ -302,6 +310,18 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac | ||||
|         return $this->documents; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @Groups({"docgen:read"}) | ||||
|      */ | ||||
|     public function getDurationMinute(): int | ||||
|     { | ||||
|         if (null === $this->durationTime) { | ||||
|             return 0; | ||||
|         } | ||||
|  | ||||
|         return (int) round(($this->durationTime->getTimestamp() + $this->durationTime->getOffset()) / 60.0, 0); | ||||
|     } | ||||
|  | ||||
|     public function getDurationTime(): ?DateTime | ||||
|     { | ||||
|         return $this->durationTime; | ||||
| @@ -402,6 +422,18 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac | ||||
|         return $this->travelTime; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @Groups({"docgen:read"}) | ||||
|      */ | ||||
|     public function getTravelTimeMinute(): int | ||||
|     { | ||||
|         if (null === $this->travelTime) { | ||||
|             return 0; | ||||
|         } | ||||
|  | ||||
|         return (int) round(($this->travelTime->getTimestamp() + $this->travelTime->getOffset()) / 60.0, 0); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @deprecated | ||||
|      */ | ||||
| @@ -425,7 +457,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac | ||||
|         return $this->getEmergency(); | ||||
|     } | ||||
|  | ||||
|     public function removeDocument(Document $document): void | ||||
|     public function removeDocument(StoredObject $document): void | ||||
|     { | ||||
|         $this->documents->removeElement($document); | ||||
|     } | ||||
|   | ||||
| @@ -12,6 +12,7 @@ declare(strict_types=1); | ||||
| namespace Chill\ActivityBundle\Entity; | ||||
|  | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
| use Symfony\Component\Serializer\Annotation as Serializer; | ||||
|  | ||||
| /** | ||||
|  * Class ActivityPresence. | ||||
| @@ -31,11 +32,14 @@ class ActivityPresence | ||||
|      * @ORM\Id | ||||
|      * @ORM\Column(name="id", type="integer") | ||||
|      * @ORM\GeneratedValue(strategy="AUTO") | ||||
|      * @Serializer\Groups({"docgen:read"}) | ||||
|      */ | ||||
|     private ?int $id; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="json") | ||||
|      * @Serializer\Groups({"docgen:read"}) | ||||
|      * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) | ||||
|      */ | ||||
|     private array $name = []; | ||||
|  | ||||
|   | ||||
| @@ -13,8 +13,10 @@ namespace Chill\ActivityBundle\Entity; | ||||
|  | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
| use InvalidArgumentException; | ||||
| use Symfony\Component\Serializer\Annotation as Serializer; | ||||
| use Symfony\Component\Serializer\Annotation\Groups; | ||||
| use Symfony\Component\Validator\Constraints as Assert; | ||||
| use Symfony\Component\Validator\Context\ExecutionContextInterface; | ||||
|  | ||||
| /** | ||||
|  * Class ActivityType. | ||||
| @@ -118,6 +120,7 @@ class ActivityType | ||||
|      * @ORM\Id | ||||
|      * @ORM\Column(name="id", type="integer") | ||||
|      * @ORM\GeneratedValue(strategy="AUTO") | ||||
|      * @Groups({"docgen:read"}) | ||||
|      */ | ||||
|     private ?int $id; | ||||
|  | ||||
| @@ -133,7 +136,8 @@ class ActivityType | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="json") | ||||
|      * @Groups({"read"}) | ||||
|      * @Groups({"read", "docgen:read"}) | ||||
|      * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) | ||||
|      */ | ||||
|     private array $name = []; | ||||
|  | ||||
| @@ -190,7 +194,6 @@ class ActivityType | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) | ||||
|      * @Assert\EqualTo(propertyPath="socialIssuesVisible", message="This parameter must be equal to social issue parameter") | ||||
|      */ | ||||
|     private int $socialActionsVisible = self::FIELD_INVISIBLE; | ||||
|  | ||||
| @@ -260,6 +263,23 @@ class ActivityType | ||||
|      */ | ||||
|     private int $userVisible = self::FIELD_REQUIRED; | ||||
|  | ||||
|     /** | ||||
|      * @Assert\Callback | ||||
|      * | ||||
|      * @param mixed $payload | ||||
|      */ | ||||
|     public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload) | ||||
|     { | ||||
|         if ($this->socialIssuesVisible !== $this->socialActionsVisible) { | ||||
|             if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) { | ||||
|                 $context | ||||
|                     ->buildViolation('The socialActionsVisible value is not compatible with the socialIssuesVisible value') | ||||
|                     ->atPath('socialActionsVisible') | ||||
|                     ->addViolation(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get active | ||||
|      * return true if the type is active. | ||||
|   | ||||
| @@ -307,6 +307,7 @@ class ActivityType extends AbstractType | ||||
|                 'allow_add' => true, | ||||
|                 'button_add_label' => 'activity.Insert a document', | ||||
|                 'button_remove_label' => 'activity.Remove a document', | ||||
|                 'empty_collection_explain' => 'No documents', | ||||
|             ]); | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -9,8 +9,9 @@ div.new-activity-select-type { | ||||
|       display: flex; | ||||
|       flex-direction: row; | ||||
|       flex-wrap: wrap; | ||||
|       justify-content: center; | ||||
|       justify-content: flex-start; | ||||
|       gap: 12px; | ||||
|       margin-bottom: 30px; | ||||
|  | ||||
|       div.bloc { | ||||
|          width: 200px; | ||||
| @@ -27,26 +28,28 @@ div.new-activity-select-type { | ||||
| // precise dashboard specific details | ||||
|  | ||||
| p.date-label { | ||||
|     display: inline-block; | ||||
|     margin: 0 0.5em 0 0; | ||||
|     font-weight: 700; | ||||
|     font-size: 18pt; | ||||
|    display: inline-block; | ||||
|    margin: 0 0.5em 0 0; | ||||
|    font-weight: 700; | ||||
|    font-size: 18pt; | ||||
| } | ||||
| div.dashboard, | ||||
| h4.badge-title, | ||||
| h3.badge-title, | ||||
| h2.badge-title { | ||||
|     ul.list-content { | ||||
|         font-size: 70%; | ||||
|         list-style-type: none; | ||||
|         padding-left: 0; | ||||
|         margin: 0; | ||||
|         li { | ||||
|             margin-bottom: 0.2em; | ||||
|             // exception: change bg color for action badges above dashboard | ||||
|             .bg-light { | ||||
|                 background-color: $chill-light-gray !important; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|    ul.list-content { | ||||
|       font-size: 70%; | ||||
|       list-style-type: none; | ||||
|       padding-left: 0; | ||||
|       margin: 0; | ||||
|       li { | ||||
|          margin-bottom: 0.2em; | ||||
|          // exception: change bg color for action badges above dashboard | ||||
|          .bg-light { | ||||
|                background-color: $chill-light-gray !important; | ||||
|          } | ||||
|       } | ||||
|    } | ||||
| } | ||||
|  | ||||
| //// ACTIVITY SHOW AND FORM PAGES | ||||
|   | ||||
| @@ -11,7 +11,7 @@ import Location from './components/Location.vue'; | ||||
|  | ||||
| export default { | ||||
|    name: "App", | ||||
|     props: ['hasSocialIssues', 'hasLocation', 'hasPerson'], | ||||
|    props: ['hasSocialIssues', 'hasLocation', 'hasPerson'], | ||||
|    components: { | ||||
|       ConcernedGroups, | ||||
|       SocialIssuesAcc, | ||||
|   | ||||
| @@ -1,45 +1,52 @@ | ||||
| <template> | ||||
|     <teleport to="#add-persons" v-if="isComponentVisible"> | ||||
|    <teleport to="#add-persons" v-if="isComponentVisible"> | ||||
|  | ||||
|         <div class="flex-bloc concerned-groups" :class="getContext"> | ||||
|             <persons-bloc | ||||
|                 v-for="bloc in contextPersonsBlocs" | ||||
|                 v-bind:key="bloc.key" | ||||
|                 v-bind:bloc="bloc" | ||||
|                 v-bind:blocWidth="getBlocWidth" | ||||
|                 v-bind:setPersonsInBloc="setPersonsInBloc"> | ||||
|             </persons-bloc> | ||||
|         </div> | ||||
|         <div v-if="getContext === 'accompanyingCourse' && suggestedEntities.length > 0"> | ||||
|             <ul class="list-suggest add-items inline"> | ||||
|                 <li v-for="(p, i) in suggestedEntities" @click="addSuggestedEntity(p)" :key="`suggestedEntities-${i}`"> | ||||
|                     <span>{{ p.text }}</span> | ||||
|                 </li> | ||||
|             </ul> | ||||
|         </div> | ||||
|       <div class="flex-bloc concerned-groups" :class="getContext"> | ||||
|          <persons-bloc | ||||
|                v-for="bloc in contextPersonsBlocs" | ||||
|                v-bind:key="bloc.key" | ||||
|                v-bind:bloc="bloc" | ||||
|                v-bind:blocWidth="getBlocWidth" | ||||
|                v-bind:setPersonsInBloc="setPersonsInBloc"> | ||||
|          </persons-bloc> | ||||
|       </div> | ||||
|       <div v-if="getContext === 'accompanyingCourse' && suggestedEntities.length > 0"> | ||||
|          <ul class="list-suggest add-items inline"> | ||||
|                <li v-for="(p, i) in suggestedEntities" @click="addSuggestedEntity(p)" :key="`suggestedEntities-${i}`"> | ||||
|                   <person-text v-if="p.type === 'person'" :person="p"></person-text> | ||||
|                   <span v-else>{{ p.text }}</span> | ||||
|                </li> | ||||
|          </ul> | ||||
|       </div> | ||||
|  | ||||
|         <add-persons | ||||
|             buttonTitle="activity.add_persons" | ||||
|             modalTitle="activity.add_persons" | ||||
|             v-bind:key="addPersons.key" | ||||
|             v-bind:options="addPersonsOptions" | ||||
|             @addNewPersons="addNewPersons" | ||||
|             ref="addPersons"> | ||||
|         </add-persons> | ||||
|       <ul class="record_actions"> | ||||
|          <li class="add-persons"> | ||||
|             <add-persons | ||||
|                buttonTitle="activity.add_persons" | ||||
|                modalTitle="activity.add_persons" | ||||
|                v-bind:key="addPersons.key" | ||||
|                v-bind:options="addPersonsOptions" | ||||
|                @addNewPersons="addNewPersons" | ||||
|                ref="addPersons"> | ||||
|             </add-persons> | ||||
|          </li> | ||||
|       </ul> | ||||
|  | ||||
|     </teleport> | ||||
|    </teleport> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import { mapState, mapGetters } from 'vuex'; | ||||
| import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue'; | ||||
| import PersonsBloc from './ConcernedGroups/PersonsBloc.vue'; | ||||
| import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue'; | ||||
|  | ||||
| export default { | ||||
|    name: "ConcernedGroups", | ||||
|    components: { | ||||
|       AddPersons, | ||||
|       PersonsBloc | ||||
|       PersonsBloc, | ||||
|       PersonText | ||||
|    }, | ||||
|    data() { | ||||
|       return { | ||||
|   | ||||
| @@ -1,21 +1,29 @@ | ||||
| <template> | ||||
|    <li> | ||||
|       <span :title="person.text"> | ||||
|          <span class="chill_denomination" @click.prevent="$emit('remove', person)">{{ textCutted }}</span> | ||||
|          <span class="chill_denomination" @click.prevent="$emit('remove', person)"> | ||||
|             <person-text :person="person" :isCut="true"></person-text> | ||||
|          </span> | ||||
|       </span> | ||||
|    </li> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue'; | ||||
|  | ||||
|  | ||||
| export default { | ||||
|    name: "PersonBadge", | ||||
|    props: ['person'], | ||||
|    computed: { | ||||
|       textCutted() { | ||||
|          let more = (this.person.text.length > 15) ?'…' : ''; | ||||
|          return this.person.text.slice(0,15) + more; | ||||
|       } | ||||
|    components: { | ||||
|       PersonText | ||||
|    }, | ||||
|    // computed: { | ||||
|    //    textCutted() { | ||||
|    //       let more = (this.person.text.length > 15) ?'…' : ''; | ||||
|    //       return this.person.text.slice(0,15) + more; | ||||
|    //    } | ||||
|    // }, | ||||
|    emits: ['remove'], | ||||
| } | ||||
| </script> | ||||
|   | ||||
| @@ -24,7 +24,7 @@ | ||||
|                     v-model="location" | ||||
|                 > | ||||
|                 </VueMultiselect> | ||||
|                 <new-location v-bind:locations="locations"></new-location> | ||||
|                 <new-location v-bind:availableLocations="availableLocations"></new-location> | ||||
|             </div> | ||||
|         </div> | ||||
|     </teleport> | ||||
|   | ||||
| @@ -18,15 +18,6 @@ | ||||
|                 </template> | ||||
|                 <template v-slot:body> | ||||
|                     <form> | ||||
|                         <div class="form-floating mb-3"> | ||||
|                             <p v-if="errors.length"> | ||||
|                                 <b>{{ $t('activity.errors') }}</b> | ||||
|                                 <ul> | ||||
|                                     <li v-for="error in errors" :key="error">{{ error }}</li> | ||||
|                                 </ul> | ||||
|                             </p> | ||||
|                         </div> | ||||
|  | ||||
|                         <div class="form-floating mb-3"> | ||||
|                             <select class="form-select form-select-lg" id="type" required v-model="selectType"> | ||||
|                                 <option selected disabled value="">{{ $t('activity.choose_location_type') }}</option> | ||||
| @@ -62,6 +53,12 @@ | ||||
|                             <input class="form-control form-control-lg" id="email" v-model="inputEmail" placeholder /> | ||||
|                             <label for="email">{{ $t('activity.location_fields.email') }}</label> | ||||
|                         </div> | ||||
|  | ||||
|                         <div class="alert alert-warning" v-if="errors.length"> | ||||
|                             <ul> | ||||
|                                 <li v-for="(e, i) in errors" :key="i">{{ e }}</li> | ||||
|                             </ul> | ||||
|                         </div> | ||||
|                     </form> | ||||
|                 </template> | ||||
|                 <template v-slot:footer> | ||||
| @@ -81,7 +78,8 @@ | ||||
| import Modal from 'ChillMainAssets/vuejs/_components/Modal.vue'; | ||||
| import AddAddress from "ChillMainAssets/vuejs/Address/components/AddAddress.vue"; | ||||
| import { mapState } from "vuex"; | ||||
| import { getLocationTypes, postLocation } from "../../api"; | ||||
| import { getLocationTypes } from "../../api"; | ||||
| import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods'; | ||||
|  | ||||
| export default { | ||||
|     name: "NewLocation", | ||||
| @@ -89,7 +87,7 @@ export default { | ||||
|         Modal, | ||||
|         AddAddress, | ||||
|     }, | ||||
|     props: ['locations'], | ||||
|     props: ['availableLocations'], | ||||
|     data() { | ||||
|         return { | ||||
|             errors: [], | ||||
| @@ -223,7 +221,6 @@ export default { | ||||
|         }, | ||||
|         saveNewLocation() { | ||||
|             if (this.checkForm()) { | ||||
|                 console.log('saveNewLocation', this.selected); | ||||
|                 let body = { | ||||
|                     type: 'location', | ||||
|                     name: this.selected.name, | ||||
| @@ -242,23 +239,28 @@ export default { | ||||
|                         } | ||||
|                     }); | ||||
|                 } | ||||
|                 postLocation(body) | ||||
|                     .then( | ||||
|                         location => new Promise(resolve => { | ||||
|                             this.locations.push(location); | ||||
|                             this.$store.dispatch('updateLocation', location); | ||||
|                             resolve(); | ||||
|                             this.modal.showModal = false; | ||||
|                         }) | ||||
|                     ).catch( | ||||
|                         err => { | ||||
|                             this.errors.push(err.message); | ||||
|  | ||||
|                 makeFetch('POST', '/api/1.0/main/location.json', body) | ||||
|                     .then(response => { | ||||
|                          this.$store.dispatch('addAvailableLocationGroup', { | ||||
|                             locationGroup: 'Localisations nouvellement créées', | ||||
|                             locations: [response] | ||||
|                         }); | ||||
|                         this.$store.dispatch('updateLocation', response); | ||||
|                         this.modal.showModal = false; | ||||
|                     }) | ||||
|                     .catch((error) => { | ||||
|                         if (error.name === 'ValidationException') { | ||||
|                             for (let v of error.violations) { | ||||
|                                 this.errors.push(v); | ||||
|                             } | ||||
|                         } else { | ||||
|                             this.errors.push('An error occurred'); | ||||
|                         } | ||||
|                     ); | ||||
|                     }) | ||||
|             }; | ||||
|         }, | ||||
|         submitNewAddress(payload) { | ||||
|             console.log('submitNewAddress', payload); | ||||
|             this.selected.addressId = payload.addressId; | ||||
|             this.addAddress.context.addressId = payload.addressId; | ||||
|             this.addAddress.context.edit = true; | ||||
|   | ||||
| @@ -2,17 +2,25 @@ import { createApp } from 'vue'; | ||||
| import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n' | ||||
| import { activityMessages } from './i18n' | ||||
| import store from './store' | ||||
| import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue'; | ||||
| import {fetchTemplates} from 'ChillDocGeneratorAssets/api/pickTemplate.js'; | ||||
|  | ||||
| import App from './App.vue'; | ||||
|  | ||||
| const i18n = _createI18n(activityMessages); | ||||
|  | ||||
| // app for activity | ||||
|  | ||||
| const hasSocialIssues = document.querySelector('#social-issues-acc') !== null; | ||||
| const hasLocation = document.querySelector('#location') !== null; | ||||
| const hasPerson = document.querySelector('#add-persons') !== null; | ||||
|  | ||||
| const app = createApp({ | ||||
|    template: `<app :hasSocialIssues="hasSocialIssues", :hasLocation="hasLocation", :hasPerson="hasPerson"></app>`, | ||||
|    template: `<app | ||||
|        :hasSocialIssues="hasSocialIssues" | ||||
|        :hasLocation="hasLocation" | ||||
|        :hasPerson="hasPerson" | ||||
|     ></app>`, | ||||
|     data() { | ||||
|        return { | ||||
|            hasSocialIssues, | ||||
| @@ -25,3 +33,54 @@ const app = createApp({ | ||||
| .use(i18n) | ||||
| .component('app', App) | ||||
| .mount('#activity'); | ||||
|  | ||||
|  | ||||
| // app for picking template | ||||
|  | ||||
| const i18nGendoc = _createI18n({}); | ||||
|  | ||||
| document.querySelectorAll('div[data-docgen-template-picker]').forEach(el => { | ||||
|     fetchTemplates(el.dataset.entityClass).then(templates => { | ||||
|         const picker = { | ||||
|             template: | ||||
|                 '<pick-template :templates="this.templates" :preventDefaultMoveToGenerate="true" ' + | ||||
|                     ':entityClass="faked" @go-to-generate-document="generateDoc"></pick-template>', | ||||
|             components: { | ||||
|                 PickTemplate, | ||||
|             }, | ||||
|             data() { | ||||
|                 return { | ||||
|                     templates: templates, | ||||
|                     entityId: el.dataset.entityId, | ||||
|                 } | ||||
|             }, | ||||
|             methods: { | ||||
|                 generateDoc({event, link, template}) { | ||||
|                     console.log('generateDoc'); | ||||
|                     console.log('link', link); | ||||
|                     console.log('template', template); | ||||
|  | ||||
|                     let hiddenInput = document.querySelector("input[data-template-id]"); | ||||
|  | ||||
|                     if (hiddenInput === null) { | ||||
|                         console.error('hidden input not found'); | ||||
|                         return; | ||||
|                     } | ||||
|  | ||||
|                     hiddenInput.value = template; | ||||
|  | ||||
|                     let form = document.querySelector('form[name="chill_activitybundle_activity"'); | ||||
|  | ||||
|                     if (form === null) { | ||||
|                         console.error('form not found'); | ||||
|                         return; | ||||
|                     } | ||||
|  | ||||
|                     form.submit(); | ||||
|                 } | ||||
|             } | ||||
|         }; | ||||
|         createApp(picker).use(i18nGendoc).mount(el); | ||||
|     }) | ||||
|  | ||||
| }); | ||||
|   | ||||
| @@ -240,6 +240,9 @@ const store = createStore({ | ||||
|             }); | ||||
|             commit("updateActionsSelected", payload); | ||||
|         }, | ||||
|         addAvailableLocationGroup({ commit }, payload) { | ||||
|             commit("addAvailableLocationGroup", payload); | ||||
|         }, | ||||
|         addPersonsInvolved({ commit }, payload) { | ||||
|             //console.log('### action addPersonsInvolved', payload.result.type); | ||||
|             switch (payload.result.type) { | ||||
|   | ||||
| @@ -41,6 +41,17 @@ | ||||
|                 </div> | ||||
|             {% endif %} | ||||
|  | ||||
|             {% if activity.attendee and t.attendeeVisible %} | ||||
|                 <div class="wl-row"> | ||||
|                     <div class="wl-col title"><h3>{{ 'Attendee'|trans }}</h3></div> | ||||
|                     <div class="wl-col list"> | ||||
|                         <p class="wl-item"> | ||||
|                             {{ activity.attendee.name|localize_translatable_string }} | ||||
|                         </p> | ||||
|                     </div> | ||||
|                 </div> | ||||
|             {% endif %} | ||||
|  | ||||
|             {% if activity.sentReceived is not empty and t.sentReceivedVisible %} | ||||
|                 <div class="wl-row"> | ||||
|                     <div class="wl-col title"><h3>{{ 'Sent received'|trans }}</h3></div> | ||||
| @@ -57,7 +68,7 @@ | ||||
|                     <div class="wl-col title"><h3>{{ 'Referrer'|trans }}</h3></div> | ||||
|                     <div class="wl-col list"> | ||||
|                         <p class="wl-item"> | ||||
|                             {{ activity.user|chill_entity_render_string|capitalize }} | ||||
|                             {{ activity.user|chill_entity_render_box }} | ||||
|                         </p> | ||||
|                     </div> | ||||
|                 </div> | ||||
| @@ -143,9 +154,17 @@ | ||||
|     </div> | ||||
|  | ||||
|     <div class="item-row separator"> | ||||
|         <ul class="record_actions"> | ||||
|             {{ recordAction }} | ||||
|         </ul> | ||||
|         <div class="item-col item-meta"> | ||||
|             {% set notif_counter = chill_count_notifications('Chill\\ActivityBundle\\Entity\\Activity', activity.id) %} | ||||
|             {% if notif_counter.total > 0 %} | ||||
|                 {{ chill_counter_notifications('Chill\\ActivityBundle\\Entity\\Activity', activity.id) }} | ||||
|             {% endif %} | ||||
|         </div> | ||||
|         <div class="item-col"> | ||||
|             <ul class="record_actions"> | ||||
|                 {{ recordAction }} | ||||
|             </ul> | ||||
|         </div> | ||||
|     </div> | ||||
|  | ||||
| </div> | ||||
|   | ||||
| @@ -8,6 +8,7 @@ | ||||
|         action: 'show', displayBadge: true, | ||||
|         targetEntity: { name: type, id: entity.id }, | ||||
|         buttonText: entity|chill_entity_render_string, | ||||
|         isDead: entity.deathdate is defined and entity.deathdate is not null, | ||||
|         parent: parent | ||||
|     } %} | ||||
| {% endmacro %} | ||||
|   | ||||
| @@ -83,15 +83,15 @@ | ||||
|     {{ form_row(edit_form.comment) }} | ||||
| {% endif %} | ||||
|  | ||||
| {%- if edit_form.documents is defined -%} | ||||
|     {{ form_row(edit_form.documents) }} | ||||
| {% endif %} | ||||
|  | ||||
| {%- if edit_form.attendee is defined -%} | ||||
|     {{ form_row(edit_form.attendee) }} | ||||
| {% endif %} | ||||
|  | ||||
| {# TODO .. status #} | ||||
| {%- if edit_form.documents is defined -%} | ||||
|     {{ form_row(edit_form.documents) }} | ||||
|     <div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\ActivityBundle\Entity\Activity" data-entity-id="{{ entity.id }}"></div> | ||||
| {% endif %} | ||||
|  | ||||
|  | ||||
| {% set person_id = null %} | ||||
| {% if entity.person %} | ||||
|   | ||||
| @@ -15,7 +15,7 @@ | ||||
|  | ||||
| {% block js %} | ||||
|     {{ parent() }} | ||||
|     {{ encore_entry_link_tags('mod_async_upload') }} | ||||
|     {{ encore_entry_script_tags('mod_async_upload') }} | ||||
|     <script type="text/javascript"> | ||||
|         window.addEventListener('DOMContentLoaded', function (e) { | ||||
|             chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]', | ||||
|   | ||||
| @@ -30,7 +30,7 @@ | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js %} | ||||
|     {{ encore_entry_link_tags('mod_async_upload') }} | ||||
|     {{ encore_entry_script_tags('mod_async_upload') }} | ||||
|     <script type="text/javascript"> | ||||
|         window.addEventListener('DOMContentLoaded', function (e) { | ||||
|             chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]', | ||||
|   | ||||
| @@ -1,58 +1,62 @@ | ||||
| {% macro recordAction(activity, context = null, person_id = null, accompanying_course_id = null) %} | ||||
|     {% if no_action is not defined or no_action == false %} | ||||
|         <li> | ||||
|             <a class="btn btn-notify" href="{{ chill_path_add_return_path('chill_main_notification_create', { | ||||
|                 'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity', | ||||
|                 'entityId': activity.id | ||||
|             }) }}">{{ 'notification.Notify'|trans }}</a> | ||||
|         </li> | ||||
|     {% endif %} | ||||
|     {% if context == 'person' and activity.accompanyingPeriod is not empty %} | ||||
|         {# | ||||
|             Disable person_id in following links, for redirect to accompanyingCourse context | ||||
|         #} | ||||
|         {% set person_id = null %} | ||||
|         {% set accompanying_course_id = activity.accompanyingPeriod.id %} | ||||
|         <li> | ||||
|             <a href="{{ chill_path_add_return_path('chill_activity_activity_list',{ | ||||
|                     'accompanying_period_id': accompanying_course_id | ||||
|                 }) }}" | ||||
|                 class="btn btn-primary" | ||||
|                 title="{{ 'See activity in accompanying course context'|trans }}"> | ||||
|                 <i class="fa fa-random fa-fw"></i> | ||||
|                 {{ 'Period number %number%'|trans({'%number%': accompanying_course_id}) }} | ||||
|             </a> | ||||
|         </li> | ||||
|     {% endif %} | ||||
|     <li> | ||||
|         <a href="{{ path('chill_activity_activity_show', {'id': activity.id, | ||||
|                 'person_id': person_id, | ||||
|                 'accompanying_period_id': accompanying_course_id | ||||
|             }) }}" | ||||
|             class="btn btn-show" | ||||
|             title="{{ 'Show'|trans }}"></a> | ||||
|     </li> | ||||
|     {% if no_action is not defined or no_action == false %} | ||||
|         {% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %} | ||||
|     {% if is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) %} | ||||
|         {% if no_action is not defined or no_action == false %} | ||||
|             <li> | ||||
|                 <a href="{{ path('chill_activity_activity_edit', {'id': activity.id, | ||||
|                         'person_id': person_id, | ||||
|                         'accompanying_period_id': accompanying_course_id | ||||
|                     }) }}" | ||||
|                     class="btn btn-update" | ||||
|                     title="{{ 'Edit'|trans }}"></a> | ||||
|                 <a class="btn btn-misc" href="{{ chill_path_add_return_path('chill_main_notification_create', { | ||||
|                     'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity', | ||||
|                     'entityId': activity.id | ||||
|                 }) }}"> | ||||
|                     <i class="fa fa-paper-plane fa-fw"></i> | ||||
|                     {{ 'notification.Notify'|trans }}</a> | ||||
|             </li> | ||||
|         {% endif %} | ||||
|         {% if is_granted('CHILL_ACTIVITY_DELETE', activity) %} | ||||
|         {% if context == 'person' and activity.accompanyingPeriod is not empty %} | ||||
|             {# | ||||
|                 Disable person_id in following links, for redirect to accompanyingCourse context | ||||
|             #} | ||||
|             {% set person_id = null %} | ||||
|             {% set accompanying_course_id = activity.accompanyingPeriod.id %} | ||||
|             <li> | ||||
|                 <a href="{{ path('chill_activity_activity_delete', {'id': activity.id, | ||||
|                         'person_id': person_id, | ||||
|                 <a href="{{ chill_path_add_return_path('chill_activity_activity_list',{ | ||||
|                         'accompanying_period_id': accompanying_course_id | ||||
|                     }) }}" | ||||
|                     class="btn btn-delete" | ||||
|                     title="{{ 'Delete'|trans }}"></a> | ||||
|                     class="btn btn-primary" | ||||
|                     title="{{ 'See activity in accompanying course context'|trans }}"> | ||||
|                     <i class="fa fa-random fa-fw"></i> | ||||
|                     {{ 'Period number %number%'|trans({'%number%': accompanying_course_id}) }} | ||||
|                 </a> | ||||
|             </li> | ||||
|         {% endif %} | ||||
|         <li> | ||||
|             <a href="{{ path('chill_activity_activity_show', {'id': activity.id, | ||||
|                     'person_id': person_id, | ||||
|                     'accompanying_period_id': accompanying_course_id | ||||
|                 }) }}" | ||||
|                 class="btn btn-show" | ||||
|                 title="{{ 'Show'|trans }}"></a> | ||||
|         </li> | ||||
|         {% if no_action is not defined or no_action == false %} | ||||
|             {% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %} | ||||
|                 <li> | ||||
|                     <a href="{{ path('chill_activity_activity_edit', {'id': activity.id, | ||||
|                             'person_id': person_id, | ||||
|                             'accompanying_period_id': accompanying_course_id | ||||
|                         }) }}" | ||||
|                         class="btn btn-update" | ||||
|                         title="{{ 'Edit'|trans }}"></a> | ||||
|                 </li> | ||||
|             {% endif %} | ||||
|             {% if is_granted('CHILL_ACTIVITY_DELETE', activity) %} | ||||
|                 <li> | ||||
|                     <a href="{{ path('chill_activity_activity_delete', {'id': activity.id, | ||||
|                             'person_id': person_id, | ||||
|                             'accompanying_period_id': accompanying_course_id | ||||
|                         }) }}" | ||||
|                         class="btn btn-delete" | ||||
|                         title="{{ 'Delete'|trans }}"></a> | ||||
|                 </li> | ||||
|             {% endif %} | ||||
|         {% endif %} | ||||
|     {% endif %} | ||||
| {% endmacro %} | ||||
|  | ||||
|   | ||||
| @@ -13,7 +13,7 @@ | ||||
|                         <p class="date-label">{{ activity.date|format_date('short') }}</p> | ||||
|                     {%- endif -%} | ||||
|  | ||||
|                     <span class="like-h3">{{ activity.type.name | localize_translatable_string }}</span> | ||||
|                     <span class="like-h3">{{ activity.type.name|localize_translatable_string }}</span> | ||||
|  | ||||
|                     {% if activity.emergency %} | ||||
|                         <span class="badge bg-danger rounded-pill fs-6">{{ 'Emergency'|trans|upper }}</span> | ||||
| @@ -41,14 +41,14 @@ | ||||
|                         {% if activity.user and t.userVisible %} | ||||
|                             <li> | ||||
|                                 <span class="item-key">{{ 'Referrer'|trans ~ ': ' }}</span> | ||||
|                                 <b>{{ activity.user.usernameCanonical }}</b> | ||||
|                                 <b>{{ activity.user|chill_entity_render_box}}</b> | ||||
|                             </li> | ||||
|                         {% endif %} | ||||
|  | ||||
|                         <li class="associated-persons"> | ||||
|                             <span class="item-key">{{ 'Participants'|trans ~ ' : ' }}</span> | ||||
|                             {% for p in activity.personsAssociated %} | ||||
|                                 <span class="badge-person">{{ p|chill_entity_render_box }}</span> | ||||
|                                 <span class="badge-person">{{ p|chill_entity_render_box({'addAgeBadge': true}) }}</span> | ||||
|                             {% endfor %} | ||||
|                         </li> | ||||
|                     </ul> | ||||
|   | ||||
| @@ -87,6 +87,7 @@ | ||||
|  | ||||
| {%- if form.documents is defined -%} | ||||
|     {{ form_row(form.documents) }} | ||||
|     <div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\ActivityBundle\Entity\Activity" data-entity-id="{{ entity.id }}"></div> | ||||
| {% endif %} | ||||
|  | ||||
| {%- if form.attendee is defined -%} | ||||
|   | ||||
| @@ -17,10 +17,6 @@ | ||||
|     {{ parent() }} | ||||
|     {{ encore_entry_script_tags('mod_async_upload') }} | ||||
|     <script type="text/javascript"> | ||||
|         window.addEventListener('DOMContentLoaded', function (e) { | ||||
|             chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]', | ||||
|             '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}'); | ||||
|         }); | ||||
|         window.activity = {{ activity_json|json_encode|raw }}; | ||||
|         {% if default_location is not null %}window.default_location_id = {{ default_location.id }}{% endif %}; | ||||
|     </script> | ||||
|   | ||||
| @@ -14,7 +14,7 @@ | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js %} | ||||
|     {{ encore_entry_link_tags('mod_async_upload') }} | ||||
|     {{ encore_entry_script_tags('mod_async_upload') }} | ||||
|     <script type="text/javascript"> | ||||
|         window.addEventListener('DOMContentLoaded', function (e) { | ||||
|             chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]', | ||||
|   | ||||
| @@ -25,7 +25,7 @@ | ||||
|                     'activityData': activityData | ||||
|                 }) }}"> | ||||
|  | ||||
|                     <div class="bloc btn btn-primary btn-lg btn-block"> | ||||
|                     <div class="btn btn-primary"> | ||||
|                         {{ activityType.name|localize_translatable_string }} | ||||
|                     </div> | ||||
|                 </a> | ||||
|   | ||||
| @@ -86,7 +86,7 @@ | ||||
| {% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with { | ||||
|     'context': context, | ||||
|     'render': 'bloc', | ||||
|     'badge_person': 'true' | ||||
|     'badge_person': true | ||||
| } %} | ||||
|  | ||||
| <h2 class="chill-blue">{{ 'Activity data'|trans }}</h2> | ||||
| @@ -165,11 +165,7 @@ | ||||
|                 <dt class="inline">{{ 'Attendee'|trans }}</dt> | ||||
|                 <dd> | ||||
|                     {% if entity.attendee is not null %} | ||||
|                         {% if entity.attendee %} | ||||
|                             {{ 'present'|trans|capitalize }} | ||||
|                         {% else %} | ||||
|                             {{ 'not present'|trans|capitalize }} | ||||
|                         {% endif %} | ||||
|                         {{ entity.attendee.name|localize_translatable_string }} | ||||
|                     {% else %} | ||||
|                         <span class="chill-no-data-statement">{{ 'None'|trans|capitalize }}</span> | ||||
|                     {% endif %} | ||||
| @@ -181,6 +177,13 @@ | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| <div class="notification notification-list"> | ||||
|     {% set notifications =  chill_list_notifications('Chill\\ActivityBundle\\Entity\\Activity', entity.id) %} | ||||
|     {% if notifications is not empty %} | ||||
|         {{ notifications|raw }} | ||||
|     {% endif %} | ||||
| </div> | ||||
|  | ||||
| {% set person_id = null %} | ||||
| {% if person %} | ||||
|     {% set person_id = person.id %} | ||||
| @@ -197,18 +200,21 @@ | ||||
|             {{ 'Back to the list'|trans }} | ||||
|         </a> | ||||
|     </li> | ||||
|     {% if is_granted('CHILL_ACTIVITY_UPDATE', entity) %} | ||||
|         <li> | ||||
|             <a class="btn btn-update" href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"> | ||||
|             {{ 'Edit'|trans }} | ||||
|     <li> | ||||
|         <a class="btn btn-notify" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity', 'entityId': entity.id}) }}"> | ||||
|             {{ 'notification.Notify'|trans }} | ||||
|         </a> | ||||
|     </li> | ||||
|     {% if is_granted('CHILL_ACTIVITY_UPDATE', entity) %} | ||||
|         <li> | ||||
|             <a href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}" | ||||
|                class="btn btn-update">{{ 'Edit'|trans }}</a> | ||||
|         </li> | ||||
|     {% endif %} | ||||
|     {% if is_granted('CHILL_ACTIVITY_DELETE', entity) %} | ||||
|     <li> | ||||
|         <a href="{{ path('chill_activity_activity_delete', { 'id': entity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="btn btn-delete"> | ||||
|             {{ 'Delete'|trans }} | ||||
|         </a> | ||||
|         <a href="{{ path('chill_activity_activity_delete', { 'id': entity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}" | ||||
|            class="btn btn-delete" title="{{ 'Delete'|trans }}"></a> | ||||
|     </li> | ||||
|     {% endif %} | ||||
| </ul> | ||||
|   | ||||
| @@ -7,11 +7,13 @@ | ||||
| {% block js %} | ||||
|     {{ parent() }} | ||||
|     {{ encore_entry_script_tags('mod_notification_toggle_read_status') }} | ||||
|     {{ encore_entry_script_tags('mod_async_upload') }} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block css %} | ||||
|     {{ parent() }} | ||||
|     {{ encore_entry_link_tags('mod_notification_toggle_read_status') }} | ||||
|     {{ encore_entry_link_tags('mod_async_upload') }} | ||||
| {% endblock %} | ||||
|  | ||||
| {% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %} | ||||
| @@ -23,19 +25,5 @@ | ||||
| {% endblock content %} | ||||
|  | ||||
| {% block block_post_menu %} | ||||
|     <div class="post-menu pt-4"> | ||||
|  | ||||
|         <div class="d-grid gap-2"> | ||||
|             <a class="btn btn-primary" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity', 'entityId': entity.id}) }}"> | ||||
|                 <i class="fa fa-paper-plane fa-fw"></i> | ||||
|                 {{ 'notification.Notify'|trans }} | ||||
|             </a> | ||||
|         </div> | ||||
|  | ||||
|         {% set notifications =  chill_list_notifications('Chill\\ActivityBundle\\Entity\\Activity', entity.id) %} | ||||
|         {% if notifications is not empty %} | ||||
|             {{ notifications|raw }} | ||||
|         {% endif %} | ||||
|  | ||||
|     </div> | ||||
| <div class="post-menu pt-4"></div> | ||||
| {% endblock %} | ||||
|   | ||||
| @@ -7,11 +7,13 @@ | ||||
| {% block js %} | ||||
|     {{ parent() }} | ||||
|     {{ encore_entry_script_tags('mod_notification_toggle_read_status') }} | ||||
|     {{ encore_entry_link_tags('mod_async_upload') }} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block css %} | ||||
|     {{ parent() }} | ||||
|     {{ encore_entry_link_tags('mod_notification_toggle_read_status') }} | ||||
|     {{ encore_entry_link_tags('mod_async_upload') }} | ||||
| {% endblock %} | ||||
|  | ||||
| {% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %} | ||||
| @@ -26,8 +28,7 @@ | ||||
|     <div class="post-menu pt-4"> | ||||
|  | ||||
|         <div class="d-grid gap-2"> | ||||
|             <a class="btn btn-primary" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity', 'entityId': entity.id}) }}"> | ||||
|                 <i class="fa fa-paper-plane fa-fw"></i> | ||||
|             <a class="btn btn-notify" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity', 'entityId': entity.id}) }}"> | ||||
|                 {{ 'notification.Notify'|trans }} | ||||
|             </a> | ||||
|         </div> | ||||
|   | ||||
| @@ -0,0 +1,216 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\ActivityBundle\Service\DocGenerator; | ||||
|  | ||||
| use Chill\ActivityBundle\Entity\Activity; | ||||
| use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithAdminFormInterface; | ||||
| use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface; | ||||
| use Chill\DocGeneratorBundle\Context\Exception\UnexpectedTypeException; | ||||
| use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate; | ||||
| use Chill\DocGeneratorBundle\Service\Context\BaseContextData; | ||||
| use Chill\DocStoreBundle\Entity\StoredObject; | ||||
| use Chill\DocStoreBundle\Repository\DocumentCategoryRepository; | ||||
| use Chill\MainBundle\Templating\TranslatableStringHelperInterface; | ||||
| use Chill\PersonBundle\Entity\AccompanyingPeriod; | ||||
| use Chill\PersonBundle\Entity\Person; | ||||
| use Chill\PersonBundle\Templating\Entity\PersonRender; | ||||
| use Doctrine\ORM\EntityManagerInterface; | ||||
| use Symfony\Bridge\Doctrine\Form\Type\EntityType; | ||||
| use Symfony\Component\Form\Extension\Core\Type\CheckboxType; | ||||
| use Symfony\Component\Form\Extension\Core\Type\TextType; | ||||
| use Symfony\Component\Form\FormBuilderInterface; | ||||
| use Symfony\Component\Serializer\Normalizer\NormalizerInterface; | ||||
| use Symfony\Contracts\Translation\TranslatorInterface; | ||||
|  | ||||
| class ActivityContext implements | ||||
|     DocGeneratorContextWithAdminFormInterface, | ||||
|     DocGeneratorContextWithPublicFormInterface | ||||
| { | ||||
|     private BaseContextData $baseContextData; | ||||
|  | ||||
|     private DocumentCategoryRepository $documentCategoryRepository; | ||||
|  | ||||
|     private EntityManagerInterface $em; | ||||
|  | ||||
|     private NormalizerInterface $normalizer; | ||||
|  | ||||
|     private PersonRender $personRender; | ||||
|  | ||||
|     private TranslatableStringHelperInterface $translatableStringHelper; | ||||
|  | ||||
|     private TranslatorInterface $translator; | ||||
|  | ||||
|     public function __construct( | ||||
|         DocumentCategoryRepository $documentCategoryRepository, | ||||
|         NormalizerInterface $normalizer, | ||||
|         TranslatableStringHelperInterface $translatableStringHelper, | ||||
|         EntityManagerInterface $em, | ||||
|         PersonRender $personRender, | ||||
|         TranslatorInterface $translator, | ||||
|         BaseContextData $baseContextData | ||||
|     ) { | ||||
|         $this->documentCategoryRepository = $documentCategoryRepository; | ||||
|         $this->normalizer = $normalizer; | ||||
|         $this->translatableStringHelper = $translatableStringHelper; | ||||
|         $this->em = $em; | ||||
|         $this->personRender = $personRender; | ||||
|         $this->translator = $translator; | ||||
|         $this->baseContextData = $baseContextData; | ||||
|     } | ||||
|  | ||||
|     public function adminFormReverseTransform(array $data): array | ||||
|     { | ||||
|         return $data; | ||||
|     } | ||||
|  | ||||
|     public function adminFormTransform(array $data): array | ||||
|     { | ||||
|         return [ | ||||
|             'mainPerson' => $data['mainPerson'] ?? false, | ||||
|             'mainPersonLabel' => $data['mainPersonLabel'] ?? $this->translator->trans('docgen.Main person'), | ||||
|             'person1' => $data['person1'] ?? false, | ||||
|             'person1Label' => $data['person1Label'] ?? $this->translator->trans('docgen.person 1'), | ||||
|             'person2' => $data['person2'] ?? false, | ||||
|             'person2Label' => $data['person2Label'] ?? $this->translator->trans('docgen.person 2'), | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|     public function buildAdminForm(FormBuilderInterface $builder): void | ||||
|     { | ||||
|         $builder | ||||
|             ->add('mainPerson', CheckboxType::class, [ | ||||
|                 'required' => false, | ||||
|                 'label' => 'docgen.Ask for main person', | ||||
|             ]) | ||||
|             ->add('mainPersonLabel', TextType::class, [ | ||||
|                 'label' => 'main person label', | ||||
|                 'required' => true, | ||||
|             ]) | ||||
|             ->add('person1', CheckboxType::class, [ | ||||
|                 'required' => false, | ||||
|                 'label' => 'docgen.Ask for person 1', | ||||
|             ]) | ||||
|             ->add('person1Label', TextType::class, [ | ||||
|                 'label' => 'person 1 label', | ||||
|                 'required' => true, | ||||
|             ]) | ||||
|             ->add('person2', CheckboxType::class, [ | ||||
|                 'required' => false, | ||||
|                 'label' => 'docgen.Ask for person 2', | ||||
|             ]) | ||||
|             ->add('person2Label', TextType::class, [ | ||||
|                 'label' => 'person 2 label', | ||||
|                 'required' => true, | ||||
|             ]); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param Activity $entity | ||||
|      */ | ||||
|     public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, $entity): void | ||||
|     { | ||||
|         $options = $template->getOptions(); | ||||
|         $persons = $entity->getPersons(); | ||||
|  | ||||
|         foreach (['mainPerson', 'person1', 'person2'] as $key) { | ||||
|             if ($options[$key] ?? false) { | ||||
|                 $builder->add($key, EntityType::class, [ | ||||
|                     'class' => Person::class, | ||||
|                     'choices' => $persons, | ||||
|                     'choice_label' => function (Person $p) { | ||||
|                         return $this->personRender->renderString($p, []); | ||||
|                     }, | ||||
|                     'multiple' => false, | ||||
|                     'expanded' => true, | ||||
|                     'label' => $options[$key . 'Label'], | ||||
|                 ]); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array | ||||
|     { | ||||
|         if (!$entity instanceof Activity) { | ||||
|             throw new UnexpectedTypeException($entity, Activity::class); | ||||
|         } | ||||
|         $options = $template->getOptions(); | ||||
|  | ||||
|         $data = []; | ||||
|         $data = array_merge($data, $this->baseContextData->getData()); | ||||
|         $data['activity'] = $this->normalizer->normalize($entity, 'docgen', ['docgen:expects' => Activity::class, 'groups' => 'docgen:read']); | ||||
|  | ||||
|         $data['course'] = $this->normalizer->normalize($entity->getAccompanyingPeriod(), 'docgen', ['docgen:expects' => AccompanyingPeriod::class, 'groups' => 'docgen:read']); | ||||
|         $data['person'] = $this->normalizer->normalize($entity->getPerson(), 'docgen', ['docgen:expects' => Person::class, 'groups' => 'docgen:read']); | ||||
|  | ||||
|         foreach (['mainPerson', 'person1', 'person2'] as $k) { | ||||
|             if ($options[$k]) { | ||||
|                 $data[$k] = $this->normalizer->normalize($contextGenerationData[$k], 'docgen', [ | ||||
|                     'docgen:expects' => Person::class, | ||||
|                     'groups' => 'docgen:read', | ||||
|                     'docgen:person:with-household' => true, | ||||
|                     'docgen:person:with-relations' => true, | ||||
|                 ]); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return $data; | ||||
|     } | ||||
|  | ||||
|     public function getDescription(): string | ||||
|     { | ||||
|         return 'docgen.A basic context for activity'; | ||||
|     } | ||||
|  | ||||
|     public function getEntityClass(): string | ||||
|     { | ||||
|         return Activity::class; | ||||
|     } | ||||
|  | ||||
|     public function getFormData(DocGeneratorTemplate $template, $entity): array | ||||
|     { | ||||
|         return [ | ||||
|             'activity' => $entity, | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|     public static function getKey(): string | ||||
|     { | ||||
|         return self::class; | ||||
|     } | ||||
|  | ||||
|     public function getName(): string | ||||
|     { | ||||
|         return 'docgen.Activity basic'; | ||||
|     } | ||||
|  | ||||
|     public function hasAdminForm(): bool | ||||
|     { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     public function hasPublicForm(DocGeneratorTemplate $template, $entity): bool | ||||
|     { | ||||
|         $options = $template->getOptions(); | ||||
|  | ||||
|         return $options['mainPerson'] || $options['person1'] || $options['person2']; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param Activity $entity | ||||
|      */ | ||||
|     public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void | ||||
|     { | ||||
|         $entity->addDocument($storedObject); | ||||
|  | ||||
|         $this->em->persist($storedObject); | ||||
|     } | ||||
| } | ||||
| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\ActivityBundle\Tests\Aggregator; | ||||
| namespace Chill\ActivityBundle\Tests\Export\Aggregator; | ||||
|  | ||||
| use Chill\MainBundle\Test\Export\AbstractAggregatorTest; | ||||
|  | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\ActivityBundle\Tests\Aggregator; | ||||
| namespace Chill\ActivityBundle\Tests\Export\Aggregator; | ||||
|  | ||||
| use Chill\MainBundle\Test\Export\AbstractAggregatorTest; | ||||
|  | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\ActivityBundle\Tests\Aggregator; | ||||
| namespace Chill\ActivityBundle\Tests\Export\Aggregator; | ||||
|  | ||||
| use Chill\MainBundle\Test\Export\AbstractAggregatorTest; | ||||
|  | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\ActivityBundle\Tests\Filter; | ||||
| namespace Chill\ActivityBundle\Tests\Export\Filter; | ||||
|  | ||||
| use Chill\MainBundle\Test\Export\AbstractFilterTest; | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\ActivityBundle\Tests\Filter; | ||||
| namespace Chill\ActivityBundle\Tests\Export\Filter; | ||||
|  | ||||
| use Chill\MainBundle\Test\Export\AbstractFilterTest; | ||||
| use DateTime; | ||||
|   | ||||
| @@ -29,9 +29,13 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; | ||||
| final class ActivityVoterTest extends KernelTestCase | ||||
| { | ||||
|     use PrepareActivityTrait; | ||||
|  | ||||
|     use PrepareCenterTrait; | ||||
|  | ||||
|     use PreparePersonTrait; | ||||
|  | ||||
|     use PrepareScopeTrait; | ||||
|  | ||||
|     use PrepareUserTrait; | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -32,3 +32,8 @@ services: | ||||
|         autowire: true | ||||
|         autoconfigure: true | ||||
|         resource: '../Validator/Constraints/' | ||||
|  | ||||
|     Chill\ActivityBundle\Service\DocGenerator\: | ||||
|         autowire: true | ||||
|         autoconfigure: true | ||||
|         resource: '../Service/DocGenerator/' | ||||
|   | ||||
| @@ -76,7 +76,7 @@ activity: | ||||
|     Insert a document: Insérer un document | ||||
|     Remove a document: Supprimer le document | ||||
|     comment: Commentaire | ||||
|  | ||||
| No documents: Pas de documents | ||||
|  | ||||
| #timeline | ||||
| '%user% has done an %activity_type%': '%user% a effectué une activité de type "%activity_type%"' | ||||
| @@ -228,3 +228,7 @@ See activity in accompanying course context: Voir l'activité dans le contexte d | ||||
| You get notified of an activity which does not exists any more: Cette notification ne correspond pas à une activité valide. | ||||
| you are not allowed to see it details: La notification fait référence à une activité à laquelle vous n'avez pas accès. | ||||
| This is the minimal activity data: Activité n° | ||||
|  | ||||
| docgen: | ||||
|     Activity basic: Echange | ||||
|     A basic context for activity: Contexte pour les échanges | ||||
|   | ||||
| @@ -20,3 +20,4 @@ For this type of activity, you must add at least one social action: Pour ce type | ||||
|  | ||||
| # admin | ||||
| This parameter must be equal to social issue parameter: Ce paramètre doit être égal au paramètre "Visibilité du champs Problématiques sociales" | ||||
| The socialActionsVisible value is not compatible with the socialIssuesVisible value: Cette valeur du paramètre "Visibilité du champs Actions sociales" n'est pas compatible avec la valeur du paramètre "Visibilité du champs Problématiques sociales" | ||||
| @@ -32,6 +32,8 @@ final class AsideActivityController extends CRUDController | ||||
|     { | ||||
|         $asideActivity = new AsideActivity(); | ||||
|  | ||||
|         $asideActivity->setAgent($this->getUser()); | ||||
|  | ||||
|         $duration = $request->query->get('duration', '300'); | ||||
|         $duration = DateTime::createFromFormat('U', $duration); | ||||
|         $asideActivity->setDuration($duration); | ||||
|   | ||||
| @@ -167,7 +167,6 @@ class AsideActivityCategory | ||||
|         } | ||||
|  | ||||
|         $this->parent = $parent; | ||||
|         dump($this); | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|   | ||||
| @@ -14,9 +14,9 @@ namespace Chill\AsideActivityBundle\Form; | ||||
| use Chill\AsideActivityBundle\Entity\AsideActivity; | ||||
| use Chill\AsideActivityBundle\Entity\AsideActivityCategory; | ||||
| use Chill\AsideActivityBundle\Templating\Entity\CategoryRender; | ||||
| use Chill\MainBundle\Entity\User; | ||||
| use Chill\MainBundle\Form\Type\ChillDateType; | ||||
| use Chill\MainBundle\Form\Type\ChillTextareaType; | ||||
| use Chill\MainBundle\Form\Type\PickUserDynamicType; | ||||
| use DateInterval; | ||||
| use DateTime; | ||||
| use DateTimeImmutable; | ||||
| @@ -68,22 +68,10 @@ final class AsideActivityFormType extends AbstractType | ||||
|         ]; | ||||
|  | ||||
|         $builder | ||||
|             ->add( | ||||
|                 'agent', | ||||
|                 EntityType::class, | ||||
|                 [ | ||||
|                     'label' => 'For agent', | ||||
|                     'required' => true, | ||||
|                     'class' => User::class, | ||||
|                     'data' => $this->storage->getToken()->getUser(), | ||||
|                     'query_builder' => static function (EntityRepository $er) { | ||||
|                         return $er->createQueryBuilder('u')->where('u.enabled = true'); | ||||
|                     }, | ||||
|                     'attr' => ['class' => 'select2 '], | ||||
|                     'placeholder' => 'Choose the agent for whom this activity is created', | ||||
|                     'choice_label' => 'username', | ||||
|                 ] | ||||
|             ) | ||||
|             ->add('agent', PickUserDynamicType::class, [ | ||||
|                 'label' => 'For agent', | ||||
|                 'required' => true, | ||||
|             ]) | ||||
|             ->add( | ||||
|                 'date', | ||||
|                 ChillDateType::class, | ||||
|   | ||||
| @@ -1,5 +1,15 @@ | ||||
| {% extends '@ChillMain/Admin/layout.html.twig' %} | ||||
|  | ||||
| {% block js %} | ||||
|     {{ parent() }} | ||||
|     {{ encore_entry_script_tags('mod_pickentity_type') }} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block css %} | ||||
|     {{ parent() }} | ||||
|     {{ encore_entry_link_tags('mod_pickentity_type') }} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block title %} | ||||
| {% include('@ChillMain/CRUD/_new_title.html.twig') %} | ||||
| {% endblock %} | ||||
| @@ -8,4 +18,5 @@ | ||||
| {% embed '@ChillMain/CRUD/_new_content.html.twig' %} | ||||
|     {% block content_form_actions_save_and_show %}{% endblock %} | ||||
| {% endembed %} | ||||
| {% endblock %} | ||||
| {% endblock %} | ||||
|  | ||||
|   | ||||
| @@ -97,8 +97,6 @@ class CalendarType extends AbstractType | ||||
|                     return $res; | ||||
|                 }, | ||||
|                 static function (?string $dateAsString): DateTimeImmutable { | ||||
|                     dump($dateAsString); | ||||
|  | ||||
|                     return new DateTimeImmutable($dateAsString); | ||||
|                 } | ||||
|             )); | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\CustomFieldsBundle\Tests; | ||||
| namespace Chill\CustomFieldsBundle\Tests\CustomFields; | ||||
|  | ||||
| use Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice; | ||||
| use Chill\CustomFieldsBundle\Entity\CustomField; | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\CustomFieldsBundle\Tests; | ||||
| namespace Chill\CustomFieldsBundle\Tests\CustomFields; | ||||
|  | ||||
| use Chill\CustomFieldsBundle\CustomFields\CustomFieldNumber; | ||||
| use Chill\CustomFieldsBundle\Entity\CustomField; | ||||
|   | ||||
| @@ -9,10 +9,11 @@ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\CustomFieldsBundle\Tests; | ||||
| namespace Chill\CustomFieldsBundle\Tests\CustomFields; | ||||
|  | ||||
| use Chill\CustomFieldsBundle\CustomFields\CustomFieldText; | ||||
| use Chill\CustomFieldsBundle\Entity\CustomField; | ||||
| use Chill\CustomFieldsBundle\Tests\CustomFieldTestHelper; | ||||
| use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||||
|  | ||||
| /** | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\CustomFieldsBundle\Tests; | ||||
| namespace Chill\CustomFieldsBundle\Tests\Routing; | ||||
|  | ||||
| use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||||
| use Symfony\Component\HttpFoundation\Response; | ||||
|   | ||||
| @@ -0,0 +1,13 @@ | ||||
|  | ||||
| const buildLink = function(templateId, entityId, entityClass) { | ||||
|     const | ||||
|         entityIdEncoded = encodeURI(entityId), | ||||
|         returnPath = encodeURIComponent(window.location.pathname + window.location.search + window.location.hash), | ||||
|         entityClassEncoded = encodeURI(entityClass), | ||||
|         url = `/fr/doc/gen/generate/from/${templateId}/for/${entityClassEncoded}/${entityIdEncoded}?returnPath=${returnPath}` | ||||
|     ; | ||||
|     console.log('computed Url'); | ||||
|     return url; | ||||
| }; | ||||
|  | ||||
| export {buildLink}; | ||||
| @@ -17,11 +17,11 @@ | ||||
|                             <select class="form-select" v-model="template"> | ||||
|                                 <option disabled selected value="">{{ $t('choose_a_template') }}</option> | ||||
|                                 <template v-for="t in templates"> | ||||
|                                     <option  v-bind:value="t.id">{{ t.name.fr }}</option> | ||||
|                                     <option v-bind:value="t.id">{{ t.name.fr || 'Aucun nom défini' }}</option> | ||||
|                                 </template> | ||||
|                             </select> | ||||
|                             <button v-if="canGenerate" class="btn btn-update btn-sm change-icon" type="button" @click="generateDocument"><i class="fa fa-fw fa-cog"></i></button> | ||||
|                             <button v-else class="btn btn-update btn-sm change-icon" type="button" disabled ><i class="fa fa-fw fa-cog"></i></button> | ||||
|                             <a v-if="canGenerate" class="btn btn-update btn-sm change-icon" :href="buildUrlGenerate" @click.prevent="clickGenerate($event, buildUrlGenerate)"><i class="fa fa-fw fa-cog"></i></a> | ||||
|                             <a v-else class="btn btn-update btn-sm change-icon" href="#" disabled ><i class="fa fa-fw fa-cog"></i></a> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
| @@ -39,23 +39,27 @@ | ||||
|  | ||||
| <script> | ||||
|  | ||||
| import {buildLink} from 'ChillDocGeneratorAssets/lib/document-generator'; | ||||
|  | ||||
| export default { | ||||
|     name: "PickTemplate", | ||||
|     props: { | ||||
|         entityId: [String, Number], | ||||
|         entityClass: { | ||||
|             type: String, | ||||
|             required: true, | ||||
|             required: false, | ||||
|         }, | ||||
|         templates: { | ||||
|             type: Array, | ||||
|             required: true, | ||||
|         }, | ||||
|         // beforeMove execute "something" before | ||||
|         beforeMove: { | ||||
|             type: Function, | ||||
|         preventDefaultMoveToGenerate: { | ||||
|             type: Boolean, | ||||
|             required: false, | ||||
|             default: false, | ||||
|         } | ||||
|     }, | ||||
|     emits: ['goToGenerateDocument'], | ||||
|     data() { | ||||
|         return { | ||||
|             template: null, | ||||
| @@ -73,62 +77,37 @@ export default { | ||||
|             return true; | ||||
|         }, | ||||
|         getDescription() { | ||||
|             return this.templates.find(t => t.id === this.template).description || ''; | ||||
|             if (null === this.template) { | ||||
|                 return ''; | ||||
|             } | ||||
|             let desc = this.templates.find(t => t.id === this.template); | ||||
|             if (null === desc) { | ||||
|                 return ''; | ||||
|             } | ||||
|             return desc.description || ''; | ||||
|         }, | ||||
|         buildUrlGenerate() { | ||||
|             if (null === this.template) { | ||||
|                 return '#'; | ||||
|             } | ||||
|  | ||||
|             return buildLink(this.template, this.entityId, this.entityClass); | ||||
|         } | ||||
|     }, | ||||
|     methods: { | ||||
|         generateDocument() { | ||||
|             console.log('generateDocument'); | ||||
|             console.log('beforeMove', this.beforeMove); | ||||
|             if (this.beforeMove != null) { | ||||
|                 console.log('execute before move'); | ||||
|                 let r = this.beforeMove(); | ||||
|                 if (r instanceof Promise) { | ||||
|                     r.then((obj) => this.goToGenerate(obj)); | ||||
|                 } else { | ||||
|                     this.goToGenerate(); | ||||
|                 } | ||||
|             } else { | ||||
|                 this.goToGenerate(); | ||||
|             } | ||||
|         }, | ||||
|         goToGenerate(obj) { | ||||
|             console.log('goToGenerate'); | ||||
|             console.log('obj', obj); | ||||
|             console.log('entityId', this.entityId); | ||||
|             let | ||||
|                 realId = this.entityId, | ||||
|                 realEntityClass = this.entityClass | ||||
|             ; | ||||
|  | ||||
|             if (obj !== undefined) { | ||||
|                 if (obj.entityId !== undefined) { | ||||
|                     realId = obj.entityId; | ||||
|                 } | ||||
|                 if (obj.entityClass !== undefined) { | ||||
|                     realEntityClass = obj.entityClass; | ||||
|                 } | ||||
|         clickGenerate(event, link) { | ||||
|             if (!this.preventDefaultMoveToGenerate) { | ||||
|                 window.location.assign(link); | ||||
|             } | ||||
|  | ||||
|             console.log('realId', realId); | ||||
|             console.log('realEntityClass', realEntityClass); | ||||
|  | ||||
|             const | ||||
|                 entityId = encodeURI(realId), | ||||
|                 returnPath = encodeURIComponent(window.location.pathname + window.location.search + window.location.hash), | ||||
|                 fqdnEntityClass = encodeURI(realEntityClass), | ||||
|                 url = `/fr/doc/gen/generate/from/${this.template}/for/${fqdnEntityClass}/${entityId}?returnPath=${returnPath}` | ||||
|             ; | ||||
|  | ||||
|             console.log('I will generate your doc at', url); | ||||
|             window.location.assign(url); | ||||
|             this.$emit('goToGenerateDocument', {event, link, template: this.template}); | ||||
|         }, | ||||
|     }, | ||||
|     i18n: { | ||||
|         messages: { | ||||
|             fr: { | ||||
|                 generate_document: 'Générer un document', | ||||
|                 select_a_template: 'Choisir un gabarit', | ||||
|                 select_a_template: 'Choisir un modèle', | ||||
|                 choose_a_template: 'Choisir', | ||||
|             } | ||||
|         } | ||||
|   | ||||
| @@ -13,7 +13,9 @@ namespace Chill\DocStoreBundle\Controller; | ||||
|  | ||||
| use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument; | ||||
| use Chill\DocStoreBundle\Form\AccompanyingCourseDocumentType; | ||||
| use Chill\DocStoreBundle\Repository\AccompanyingCourseDocumentRepository; | ||||
| use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter; | ||||
| use Chill\MainBundle\Pagination\PaginatorFactory; | ||||
| use Chill\MainBundle\Security\Authorization\AuthorizationHelper; | ||||
| use Chill\PersonBundle\Entity\AccompanyingPeriod; | ||||
| use DateTime; | ||||
| @@ -29,20 +31,15 @@ use Symfony\Contracts\Translation\TranslatorInterface; | ||||
|  */ | ||||
| class DocumentAccompanyingCourseController extends AbstractController | ||||
| { | ||||
|     /** | ||||
|      * @var AuthorizationHelper | ||||
|      */ | ||||
|     protected $authorizationHelper; | ||||
|     protected AuthorizationHelper $authorizationHelper; | ||||
|  | ||||
|     /** | ||||
|      * @var EventDispatcherInterface | ||||
|      */ | ||||
|     protected $eventDispatcher; | ||||
|     protected EventDispatcherInterface $eventDispatcher; | ||||
|  | ||||
|     /** | ||||
|      * @var TranslatorInterface | ||||
|      */ | ||||
|     protected $translator; | ||||
|     protected TranslatorInterface $translator; | ||||
|  | ||||
|     private AccompanyingCourseDocumentRepository $courseRepository; | ||||
|  | ||||
|     private PaginatorFactory $paginatorFactory; | ||||
|  | ||||
|     /** | ||||
|      * DocumentAccompanyingCourseController constructor. | ||||
| @@ -50,11 +47,15 @@ class DocumentAccompanyingCourseController extends AbstractController | ||||
|     public function __construct( | ||||
|         TranslatorInterface $translator, | ||||
|         EventDispatcherInterface $eventDispatcher, | ||||
|         AuthorizationHelper $authorizationHelper | ||||
|         AuthorizationHelper $authorizationHelper, | ||||
|         PaginatorFactory $paginatorFactory, | ||||
|         AccompanyingCourseDocumentRepository $courseRepository | ||||
|     ) { | ||||
|         $this->translator = $translator; | ||||
|         $this->eventDispatcher = $eventDispatcher; | ||||
|         $this->authorizationHelper = $authorizationHelper; | ||||
|         $this->paginatorFactory = $paginatorFactory; | ||||
|         $this->courseRepository = $courseRepository; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -130,11 +131,15 @@ class DocumentAccompanyingCourseController extends AbstractController | ||||
|  | ||||
|         $this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::SEE, $course); | ||||
|  | ||||
|         $documents = $em | ||||
|             ->getRepository('ChillDocStoreBundle:AccompanyingCourseDocument') | ||||
|         $total = $this->courseRepository->countByCourse($course); | ||||
|         $pagination = $this->paginatorFactory->create($total); | ||||
|  | ||||
|         $documents = $this->courseRepository | ||||
|             ->findBy( | ||||
|                 ['course' => $course], | ||||
|                 ['date' => 'DESC'] | ||||
|                 ['date' => 'DESC'], | ||||
|                 $pagination->getItemsPerPage(), | ||||
|                 $pagination->getCurrentPageFirstItemNumber() | ||||
|             ); | ||||
|  | ||||
|         return $this->render( | ||||
| @@ -142,6 +147,7 @@ class DocumentAccompanyingCourseController extends AbstractController | ||||
|             [ | ||||
|                 'documents' => $documents, | ||||
|                 'accompanyingCourse' => $course, | ||||
|                 'pagination' => $pagination, | ||||
|             ] | ||||
|         ); | ||||
|     } | ||||
|   | ||||
| @@ -13,7 +13,8 @@ namespace Chill\DocStoreBundle\Controller; | ||||
|  | ||||
| use Chill\DocStoreBundle\Entity\PersonDocument; | ||||
| use Chill\DocStoreBundle\Form\PersonDocumentType; | ||||
| use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter; | ||||
| use Chill\DocStoreBundle\Repository\PersonDocumentACLAwareRepositoryInterface; | ||||
| use Chill\MainBundle\Pagination\PaginatorFactory; | ||||
| use Chill\MainBundle\Security\Authorization\AuthorizationHelper; | ||||
| use Chill\PersonBundle\Entity\Person; | ||||
| use Chill\PersonBundle\Privacy\PrivacyEvent; | ||||
| @@ -24,7 +25,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; | ||||
| use Symfony\Component\HttpFoundation\Request; | ||||
| use Symfony\Component\HttpFoundation\Response; | ||||
| use Symfony\Component\Routing\Annotation\Route; | ||||
| use Symfony\Component\Translation\TranslatorInterface; | ||||
| use Symfony\Contracts\Translation\TranslatorInterface; | ||||
|  | ||||
| /** | ||||
|  * Class DocumentPersonController. | ||||
| @@ -35,20 +36,15 @@ use Symfony\Component\Translation\TranslatorInterface; | ||||
|  */ | ||||
| class DocumentPersonController extends AbstractController | ||||
| { | ||||
|     /** | ||||
|      * @var AuthorizationHelper | ||||
|      */ | ||||
|     protected $authorizationHelper; | ||||
|     protected AuthorizationHelper $authorizationHelper; | ||||
|  | ||||
|     /** | ||||
|      * @var EventDispatcherInterface | ||||
|      */ | ||||
|     protected $eventDispatcher; | ||||
|     protected EventDispatcherInterface $eventDispatcher; | ||||
|  | ||||
|     /** | ||||
|      * @var TranslatorInterface | ||||
|      */ | ||||
|     protected $translator; | ||||
|     protected TranslatorInterface $translator; | ||||
|  | ||||
|     private PaginatorFactory $paginatorFactory; | ||||
|  | ||||
|     private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository; | ||||
|  | ||||
|     /** | ||||
|      * DocumentPersonController constructor. | ||||
| @@ -56,11 +52,15 @@ class DocumentPersonController extends AbstractController | ||||
|     public function __construct( | ||||
|         TranslatorInterface $translator, | ||||
|         EventDispatcherInterface $eventDispatcher, | ||||
|         AuthorizationHelper $authorizationHelper | ||||
|         AuthorizationHelper $authorizationHelper, | ||||
|         PaginatorFactory $paginatorFactory, | ||||
|         PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository | ||||
|     ) { | ||||
|         $this->translator = $translator; | ||||
|         $this->eventDispatcher = $eventDispatcher; | ||||
|         $this->authorizationHelper = $authorizationHelper; | ||||
|         $this->paginatorFactory = $paginatorFactory; | ||||
|         $this->personDocumentACLAwareRepository = $personDocumentACLAwareRepository; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -156,19 +156,15 @@ class DocumentPersonController extends AbstractController | ||||
|  | ||||
|         $this->denyAccessUnlessGranted(PersonVoter::SEE, $person); | ||||
|  | ||||
|         $reachableScopes = $this->authorizationHelper | ||||
|             ->getReachableScopes( | ||||
|                 $this->getUser(), | ||||
|                 PersonDocumentVoter::SEE, | ||||
|                 $person->getCenter() | ||||
|             ); | ||||
|         $total = $this->personDocumentACLAwareRepository->countByPerson($person); | ||||
|         $pagination = $this->paginatorFactory->create($total); | ||||
|  | ||||
|         $documents = $em | ||||
|             ->getRepository('ChillDocStoreBundle:PersonDocument') | ||||
|             ->findBy( | ||||
|                 ['person' => $person, 'scope' => $reachableScopes], | ||||
|                 ['date' => 'DESC'] | ||||
|             ); | ||||
|         $documents = $this->personDocumentACLAwareRepository->findByPerson( | ||||
|             $person, | ||||
|             [], | ||||
|             $pagination->getItemsPerPage(), | ||||
|             $pagination->getCurrentPageFirstItemNumber() | ||||
|         ); | ||||
|  | ||||
|         $event = new PrivacyEvent($person, [ | ||||
|             'element_class' => PersonDocument::class, | ||||
| @@ -181,6 +177,7 @@ class DocumentPersonController extends AbstractController | ||||
|             [ | ||||
|                 'documents' => $documents, | ||||
|                 'person' => $person, | ||||
|                 'pagination' => $pagination, | ||||
|             ] | ||||
|         ); | ||||
|     } | ||||
|   | ||||
| @@ -38,6 +38,7 @@ class ChillDocStoreExtension extends Extension implements PrependExtensionInterf | ||||
|         $loader->load('services/menu.yaml'); | ||||
|         $loader->load('services/fixtures.yaml'); | ||||
|         $loader->load('services/form.yaml'); | ||||
|         $loader->load('services/templating.yaml'); | ||||
|     } | ||||
|  | ||||
|     public function prepend(ContainerBuilder $container) | ||||
|   | ||||
| @@ -11,7 +11,13 @@ declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\DocStoreBundle\Entity; | ||||
|  | ||||
| use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate; | ||||
| use Chill\MainBundle\Doctrine\Model\TrackCreationInterface; | ||||
| use Chill\MainBundle\Doctrine\Model\TrackCreationTrait; | ||||
| use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; | ||||
| use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait; | ||||
| use Chill\MainBundle\Entity\HasScopeInterface; | ||||
| use Chill\MainBundle\Entity\Scope; | ||||
| use Chill\MainBundle\Entity\User; | ||||
| use DateTimeInterface; | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
| @@ -20,8 +26,12 @@ use Symfony\Component\Validator\Constraints as Assert; | ||||
| /** | ||||
|  * @ORM\MappedSuperclass | ||||
|  */ | ||||
| class Document implements HasScopeInterface | ||||
| class Document implements HasScopeInterface, TrackCreationInterface, TrackUpdateInterface | ||||
| { | ||||
|     use TrackCreationTrait; | ||||
|  | ||||
|     use TrackUpdateTrait; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity="Chill\DocStoreBundle\Entity\DocumentCategory") | ||||
|      * @ORM\JoinColumns({ | ||||
| @@ -67,6 +77,11 @@ class Document implements HasScopeInterface | ||||
|      */ | ||||
|     private $scope; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity="Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate") | ||||
|      */ | ||||
|     private $template; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="text") | ||||
|      * @Assert\Length( | ||||
| @@ -82,9 +97,6 @@ class Document implements HasScopeInterface | ||||
|      */ | ||||
|     private $user; | ||||
|  | ||||
|     /** | ||||
|      * @return DocumentCategory | ||||
|      */ | ||||
|     public function getCategory(): ?DocumentCategory | ||||
|     { | ||||
|         return $this->category; | ||||
| @@ -115,11 +127,16 @@ class Document implements HasScopeInterface | ||||
|      * | ||||
|      * @return \Chill\MainBundle\Entity\Scope | ||||
|      */ | ||||
|     public function getScope() | ||||
|     public function getScope(): ?Scope | ||||
|     { | ||||
|         return $this->scope; | ||||
|     } | ||||
|  | ||||
|     public function getTemplate(): ?DocGeneratorTemplate | ||||
|     { | ||||
|         return $this->template; | ||||
|     } | ||||
|  | ||||
|     public function getTitle(): ?string | ||||
|     { | ||||
|         return $this->title; | ||||
| @@ -165,6 +182,13 @@ class Document implements HasScopeInterface | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setTemplate(?DocGeneratorTemplate $template): self | ||||
|     { | ||||
|         $this->template = $template; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setTitle(string $title): self | ||||
|     { | ||||
|         $this->title = $title; | ||||
|   | ||||
| @@ -18,10 +18,12 @@ use Chill\MainBundle\Form\Type\ChillDateType; | ||||
| use Chill\MainBundle\Form\Type\ChillTextareaType; | ||||
| use Chill\MainBundle\Form\Type\ScopePickerType; | ||||
| use Chill\MainBundle\Security\Authorization\AuthorizationHelper; | ||||
| use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher; | ||||
| use Chill\MainBundle\Templating\TranslatableStringHelper; | ||||
| use Doctrine\ORM\EntityRepository; | ||||
| use Doctrine\Persistence\ObjectManager; | ||||
| use Symfony\Bridge\Doctrine\Form\Type\EntityType; | ||||
| use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | ||||
| use Symfony\Component\Form\AbstractType; | ||||
| use Symfony\Component\Form\Extension\Core\Type\TextType; | ||||
| use Symfony\Component\Form\FormBuilderInterface; | ||||
| @@ -51,14 +53,25 @@ class PersonDocumentType extends AbstractType | ||||
|      */ | ||||
|     protected $user; | ||||
|  | ||||
|     private ParameterBagInterface $parameterBag; | ||||
|  | ||||
|     private ScopeResolverDispatcher $scopeResolverDispatcher; | ||||
|  | ||||
|     public function __construct( | ||||
|         TranslatableStringHelper $translatableStringHelper | ||||
|         TranslatableStringHelper $translatableStringHelper, | ||||
|         ScopeResolverDispatcher $scopeResolverDispatcher, | ||||
|         ParameterBagInterface $parameterBag | ||||
|     ) { | ||||
|         $this->translatableStringHelper = $translatableStringHelper; | ||||
|         $this->scopeResolverDispatcher = $scopeResolverDispatcher; | ||||
|         $this->parameterBag = $parameterBag; | ||||
|     } | ||||
|  | ||||
|     public function buildForm(FormBuilderInterface $builder, array $options) | ||||
|     { | ||||
|         $document = $options['data']; | ||||
|         $isScopeConcerned = $this->scopeResolverDispatcher->isConcerned($document); | ||||
|  | ||||
|         $builder | ||||
|             ->add('title', TextType::class) | ||||
|             ->add('description', ChillTextareaType::class, [ | ||||
| @@ -67,10 +80,6 @@ class PersonDocumentType extends AbstractType | ||||
|             ->add('object', StoredObjectType::class, [ | ||||
|                 'error_bubbling' => true, | ||||
|             ]) | ||||
|             ->add('scope', ScopePickerType::class, [ | ||||
|                 'center' => $options['center'], | ||||
|                 'role' => $options['role'], | ||||
|             ]) | ||||
|             ->add('date', ChillDateType::class) | ||||
|             ->add('category', EntityType::class, [ | ||||
|                 'placeholder' => 'Choose a document category', | ||||
| @@ -84,6 +93,13 @@ class PersonDocumentType extends AbstractType | ||||
|                     return $entity ? $this->translatableStringHelper->localize($entity->getName()) : ''; | ||||
|                 }, | ||||
|             ]); | ||||
|  | ||||
|         if ($isScopeConcerned && $this->parameterBag->get('chill_main')['acl']['form_show_scopes']) { | ||||
|             $builder->add('scope', ScopePickerType::class, [ | ||||
|                 'center' => $options['center'], | ||||
|                 'role' => $options['role'], | ||||
|             ]); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public function configureOptions(OptionsResolver $resolver) | ||||
|   | ||||
| @@ -0,0 +1,75 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\DocStoreBundle\Repository; | ||||
|  | ||||
| use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument; | ||||
| use Chill\PersonBundle\Entity\AccompanyingPeriod; | ||||
| use Doctrine\ORM\EntityManagerInterface; | ||||
| use Doctrine\ORM\EntityRepository; | ||||
| use Doctrine\ORM\QueryBuilder; | ||||
| use Doctrine\Persistence\ObjectRepository; | ||||
|  | ||||
| class AccompanyingCourseDocumentRepository implements ObjectRepository | ||||
| { | ||||
|     private EntityManagerInterface $em; | ||||
|  | ||||
|     private EntityRepository $repository; | ||||
|  | ||||
|     public function __construct(EntityManagerInterface $em) | ||||
|     { | ||||
|         $this->em = $em; | ||||
|         $this->repository = $em->getRepository(AccompanyingCourseDocument::class); | ||||
|     } | ||||
|  | ||||
|     public function buildQueryByCourse(AccompanyingPeriod $course): QueryBuilder | ||||
|     { | ||||
|         $qb = $this->repository->createQueryBuilder('d'); | ||||
|  | ||||
|         $qb | ||||
|             ->where($qb->expr()->eq('d.course', ':course')) | ||||
|             ->setParameter('course', $course); | ||||
|  | ||||
|         return $qb; | ||||
|     } | ||||
|  | ||||
|     public function countByCourse(AccompanyingPeriod $course): int | ||||
|     { | ||||
|         $qb = $this->buildQueryByCourse($course)->select('COUNT(d)'); | ||||
|  | ||||
|         return $qb->getQuery()->getSingleScalarResult(); | ||||
|     } | ||||
|  | ||||
|     public function find($id): ?AccompanyingCourseDocument | ||||
|     { | ||||
|         return $this->repository->find($id); | ||||
|     } | ||||
|  | ||||
|     public function findAll(): array | ||||
|     { | ||||
|         return $this->repository->findAll(); | ||||
|     } | ||||
|  | ||||
|     public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) | ||||
|     { | ||||
|         return $this->repository->findBy($criteria, $orderBy, $limit, $offset); | ||||
|     } | ||||
|  | ||||
|     public function findOneBy(array $criteria): ?AccompanyingCourseDocument | ||||
|     { | ||||
|         return $this->findOneBy($criteria); | ||||
|     } | ||||
|  | ||||
|     public function getClassName() | ||||
|     { | ||||
|         return AccompanyingCourseDocument::class; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,90 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\DocStoreBundle\Repository; | ||||
|  | ||||
| use Chill\DocStoreBundle\Entity\PersonDocument; | ||||
| use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter; | ||||
| use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface; | ||||
| use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher; | ||||
| use Chill\PersonBundle\Entity\Person; | ||||
| use Doctrine\ORM\EntityManagerInterface; | ||||
| use Doctrine\ORM\QueryBuilder; | ||||
| use Symfony\Component\Security\Core\Security; | ||||
|  | ||||
| class PersonDocumentACLAwareRepository implements PersonDocumentACLAwareRepositoryInterface | ||||
| { | ||||
|     private AuthorizationHelperInterface $authorizationHelper; | ||||
|  | ||||
|     private CenterResolverDispatcher $centerResolverDispatcher; | ||||
|  | ||||
|     private EntityManagerInterface $em; | ||||
|  | ||||
|     private Security $security; | ||||
|  | ||||
|     public function __construct(EntityManagerInterface $em, AuthorizationHelperInterface $authorizationHelper, CenterResolverDispatcher $centerResolverDispatcher, Security $security) | ||||
|     { | ||||
|         $this->em = $em; | ||||
|         $this->authorizationHelper = $authorizationHelper; | ||||
|         $this->centerResolverDispatcher = $centerResolverDispatcher; | ||||
|         $this->security = $security; | ||||
|     } | ||||
|  | ||||
|     public function buildQueryByPerson(Person $person): QueryBuilder | ||||
|     { | ||||
|         $qb = $this->em->getRepository(PersonDocument::class)->createQueryBuilder('d'); | ||||
|  | ||||
|         $qb | ||||
|             ->where($qb->expr()->eq('d.person', ':person')) | ||||
|             ->setParameter('person', $person); | ||||
|  | ||||
|         return $qb; | ||||
|     } | ||||
|  | ||||
|     public function countByPerson(Person $person): int | ||||
|     { | ||||
|         $qb = $this->buildQueryByPerson($person)->select('COUNT(d)'); | ||||
|  | ||||
|         $this->addACL($qb, $person); | ||||
|  | ||||
|         return $qb->getQuery()->getSingleScalarResult(); | ||||
|     } | ||||
|  | ||||
|     public function findByPerson(Person $person, array $orderBy = [], int $limit = 20, int $offset = 0): array | ||||
|     { | ||||
|         $qb = $this->buildQueryByPerson($person)->select('d'); | ||||
|  | ||||
|         $this->addACL($qb, $person); | ||||
|  | ||||
|         foreach ($orderBy as [$field, $order]) { | ||||
|             $qb->addOrderBy($field, $order); | ||||
|         } | ||||
|  | ||||
|         $qb->setFirstResult($offset)->setMaxResults($limit); | ||||
|  | ||||
|         return $qb->getQuery()->getResult(); | ||||
|     } | ||||
|  | ||||
|     private function addACL(QueryBuilder $qb, Person $person): void | ||||
|     { | ||||
|         $center = $this->centerResolverDispatcher->resolveCenter($person); | ||||
|  | ||||
|         $reachableScopes = $this->authorizationHelper | ||||
|             ->getReachableScopes( | ||||
|                 $this->security->getUser(), | ||||
|                 PersonDocumentVoter::SEE, | ||||
|                 $center | ||||
|             ); | ||||
|  | ||||
|         $qb->andWhere($qb->expr()->in('d.scope', ':scopes')) | ||||
|             ->setParameter('scopes', $reachableScopes); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,21 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\DocStoreBundle\Repository; | ||||
|  | ||||
| use Chill\PersonBundle\Entity\Person; | ||||
|  | ||||
| interface PersonDocumentACLAwareRepositoryInterface | ||||
| { | ||||
|     public function countByPerson(Person $person): int; | ||||
|  | ||||
|     public function findByPerson(Person $person, array $orderBy = [], int $limit = 20, int $offset = 0): array; | ||||
| } | ||||
| @@ -0,0 +1,64 @@ | ||||
| {% import "@ChillDocStore/Macro/macro.html.twig" as m %} | ||||
| {% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %} | ||||
|  | ||||
| <div class="flex-table accompanying_course_work-list"> | ||||
|     <div class="item-bloc document-item bg-chill-llight-gray"> | ||||
|         <div class="row justify-content-center my-4"> | ||||
|             <div class="col-2"> | ||||
|                 <i class="fa fa-4x fa-file-text-o text-success"></i> | ||||
|             </div> | ||||
|             <div class="col-8"> | ||||
|                 <h3>{{ document.title }}</h3> | ||||
|  | ||||
|                 {{ mm.mimeIcon(document.object.type) }} | ||||
|  | ||||
|                 {% if document.description is not empty %} | ||||
|                     <blockquote class="chill-user-quote mt-4"> | ||||
|                         {{ document.description }} | ||||
|                     </blockquote> | ||||
|                 {% endif %} | ||||
|  | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| {% set freezed = false %} | ||||
| {% for step in entity_workflow.stepsChained %} | ||||
|     {% if loop.last %} | ||||
|         {% if step.previous is not null and step.previous.freezeAfter == true %} | ||||
|             {% set freezed = true %} | ||||
|         {% endif %} | ||||
|     {% endif %} | ||||
| {% endfor %} | ||||
|  | ||||
| {% if display_action is defined and display_action == true %} | ||||
|     <ul class="record_actions"> | ||||
|         {% if document.course != null and is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', document.course) %} | ||||
|             <li> | ||||
|                 <a href="{{ path('chill_person_accompanying_course_index', {'accompanying_period_id': document.course.id}) }}" class="btn btn-show change-icon"> | ||||
|                     <i class="fa fa-random"></i> {{ 'Course number'|trans }} {{ document.course.id }} | ||||
|                 </a> | ||||
|             </li> | ||||
|         {% endif %} | ||||
|         <li> | ||||
|             {{ m.download_button(document.object, document.title) }} | ||||
|         </li> | ||||
|         <li> | ||||
|         {% if chill_document_is_editable(document.object) %} | ||||
|             {% if not freezed %} | ||||
|                 {{ document.object|chill_document_edit_button({'title': document.title|e('html') }) }} | ||||
|             {% else %} | ||||
|                 <a class="btn btn-wopilink disabled" href="#" title="{{ 'workflow.freezed document'|trans }}"> | ||||
|                     {{ 'Update document'|trans }} | ||||
|                 </a> | ||||
|             {% endif %} | ||||
|         {% endif %} | ||||
|         {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %} | ||||
|             <li> | ||||
|                 <a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': document.course.id, 'id': document.id}) }}" class="btn btn-show"></a> | ||||
|             </li> | ||||
|         {% endif %} | ||||
|         </li> | ||||
|     </ul> | ||||
| {% endif %} | ||||
| @@ -0,0 +1,19 @@ | ||||
| {% import '@ChillMain/Workflow/macro_breadcrumb.html.twig' as m %} | ||||
|  | ||||
| <div class="flex-grow-1 {% if add_classes is defined %}{{ add_classes }}{% else %}h2{% endif %}"> | ||||
|     <div> | ||||
|         {% if concerne is defined and concerne == true %} | ||||
|             <span class="item-key">{{ 'Concerne'|trans }}: </span> | ||||
|         {% endif %} | ||||
|      | ||||
|         {{ 'workflow.Document (n°%doc%)'|trans({'%doc%': document.id}) }} | ||||
|      | ||||
|         {% if description is defined and description == true %} | ||||
|             {{ ' — ' ~ document.title }} | ||||
|         {% endif %} | ||||
|     </div> | ||||
|      | ||||
|     {% if breadcrumb is defined and breadcrumb == true %} | ||||
|         {{ m.breadcrumb(_context) }} | ||||
|     {% endif %} | ||||
| </div> | ||||
| @@ -19,7 +19,7 @@ | ||||
| 	{{ form_row(form.description) }} | ||||
| 	{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }} | ||||
|  | ||||
| 	<ul class="record_actions"> | ||||
| 	<ul class="record_actions sticky-form-buttons"> | ||||
| 		<li class="cancel"> | ||||
| 			<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel"> | ||||
| 				{{ 'Back to the list' | trans }} | ||||
|   | ||||
| @@ -2,8 +2,6 @@ | ||||
|  | ||||
| {% set activeRouteKey = '' %} | ||||
|  | ||||
| {% import "@ChillDocStore/Macro/macro.html.twig" as m %} | ||||
|  | ||||
| {% block title %} | ||||
| 	{{ 'Documents' }} | ||||
| {% endblock %} | ||||
| @@ -11,64 +9,35 @@ | ||||
| {% block js %} | ||||
| 	{{ parent() }} | ||||
| 	{{ encore_entry_script_tags('mod_async_upload') }} | ||||
|   {{ encore_entry_script_tags('mod_docgen_picktemplate') }} | ||||
|     {{ encore_entry_script_tags('mod_docgen_picktemplate') }} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block css %} | ||||
| 	{{ parent() }} | ||||
| 	{{ encore_entry_link_tags('mod_async_upload') }} | ||||
|   {{ encore_entry_link_tags('mod_docgen_picktemplate') }} | ||||
|     {{ encore_entry_link_tags('mod_docgen_picktemplate') }} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block content %} | ||||
| <div class="col-md-10 col-xxl"> | ||||
| 	<h1>{{ 'Documents' }}</h1> | ||||
|  | ||||
| 	<table class="table table-bordered border-dark table-striped"> | ||||
|  | ||||
| 		<thead> | ||||
| 			<tr> | ||||
| 				<th>{{ 'Title' | trans }}</th> | ||||
| 				<th>{{ 'Category'|trans }}</th> | ||||
| 				<th>{{ 'Actions' | trans }}</th> | ||||
| 			</tr> | ||||
| 		</thead> | ||||
| 		<tbody> | ||||
| 	{% if documents|length == 0 %} | ||||
|             <p class="chill-no-data-statement">{{ 'No documents'|trans }}</p> | ||||
|     {% else %} | ||||
| 		<div class="flex-table chill-task-list"> | ||||
| 			{% for document in documents %} | ||||
| 				<tr> | ||||
| 					<td>{{ document.title }}</td> | ||||
| 					<td>{% if document.category %}{{ document.category.name|localize_translatable_string }}{% endif %}</td> | ||||
| 					<td> | ||||
| 						<ul class="record_actions"> | ||||
| 							{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS', document) %} | ||||
| 								<li> | ||||
| 									{{ m.download_button(document.object, document.title) }} | ||||
| 								</li> | ||||
| 								<li> | ||||
| 									<a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': accompanyingCourse.id, 'id': document.id}) }}" class="btn btn-show"></a> | ||||
| 								</li> | ||||
| 							{% endif %} | ||||
| 							{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %} | ||||
| 								<li> | ||||
| 									<a href="{{ path('accompanying_course_document_edit', {'course': accompanyingCourse.id, 'id': document.id }) }}" class="btn btn-update"></a> | ||||
| 								</li> | ||||
| 							{% endif %} | ||||
| 						</ul> | ||||
| 					</td> | ||||
| 				</tr> | ||||
| 			{% else %} | ||||
| 				<tr> | ||||
| 					<td colspan="9" style="text-align:center;"> | ||||
| 						<span class="chill-no-data-statement">{{ 'Any document found'|trans }}</span> | ||||
| 					</td> | ||||
| 				</tr> | ||||
| 				{% include 'ChillDocStoreBundle:List:list_item.html.twig' %} | ||||
| 			{% endfor %} | ||||
| 		</tbody> | ||||
| 	</table> | ||||
| 		</div> | ||||
|     {% endif %} | ||||
|  | ||||
|     <div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\PersonBundle\Entity\AccompanyingPeriod" data-entity-id="{{ accompanyingCourse.id }}"></div> | ||||
| 	{{ chill_pagination(pagination) }} | ||||
|  | ||||
| 	<div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\PersonBundle\Entity\AccompanyingPeriod" data-entity-id="{{ accompanyingCourse.id }}"></div> | ||||
|  | ||||
| 	{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE', accompanyingCourse) %} | ||||
| 		<ul class="record_actions"> | ||||
| 		<ul class="record_actions sticky-form-buttons"> | ||||
| 			<li class="create"> | ||||
| 				<a href="{{ path('accompanying_course_document_new', {'course': accompanyingCourse.id}) }}" class="btn btn-create"> | ||||
| 					{{ 'Create'|trans }} | ||||
| @@ -76,4 +45,6 @@ | ||||
| 			</li> | ||||
| 		</ul> | ||||
| 	{% endif %} | ||||
|  | ||||
| </div> | ||||
| {% endblock %} | ||||
|   | ||||
| @@ -3,64 +3,82 @@ | ||||
| {% set activeRouteKey = '' %} | ||||
|  | ||||
| {% import "@ChillDocStore/Macro/macro.html.twig" as m %} | ||||
| {% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %} | ||||
|  | ||||
| {% block title %} | ||||
| 	{# {{ 'Detail of document of %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }} #} | ||||
| {% endblock %} | ||||
|  | ||||
|  | ||||
| {% block js %} | ||||
| 	{{ parent() }} | ||||
| 	{{ encore_entry_script_tags('mod_async_upload') }} | ||||
|     {{ 'Document %title%' | trans({ '%title%': document.title }) }} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block css %} | ||||
|     {{ parent() }} | ||||
|     {{ encore_entry_link_tags('mod_async_upload') }} | ||||
|     {{ encore_entry_link_tags('mod_entity_workflow_pick') }} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block content %} | ||||
| <div class="document-show"> | ||||
|     <h1>{{ block('title') }}</h1> | ||||
|  | ||||
| 	<h1>{{ 'Document %title%' | trans({ '%title%': document.title }) }}</h1> | ||||
|     {{ mm.mimeIcon(document.object.type) }} | ||||
|  | ||||
| 	<dl class="chill_view_data"> | ||||
| 		<dt>{{ 'Title'|trans }}</dt> | ||||
| 		<dd>{{ document.title }}</dd> | ||||
|     <dl class="chill_view_data mt-4"> | ||||
|         <dt>{{ 'Title'|trans }}</dt> | ||||
|         <dd>{{ document.title }}</dd> | ||||
|  | ||||
|         {% if document.category is not null %} | ||||
|             <dt>{{ 'Category'|trans }}</dt> | ||||
|             <dd>{{ document.category.name|localize_translatable_string }}</dd> | ||||
|         {% endif %} | ||||
|  | ||||
| 		<dt>{{ 'Description' | trans }}</dt> | ||||
| 		<dd> | ||||
| 			{% if document.description is empty %} | ||||
| 				<span class="chill-no-data-statement">{{ 'Any description'|trans }}</span> | ||||
| 			{% else %} | ||||
| 				<blockquote class="chill-user-quote"> | ||||
| 					{{ document.description|chill_markdown_to_html }} | ||||
| 				</blockquote> | ||||
| 			{% endif %} | ||||
| 		</dd> | ||||
|         <dt>{{ 'Description' | trans }}</dt> | ||||
|         <dd> | ||||
|             {% if document.description is empty %} | ||||
|                 <span class="chill-no-data-statement">{{ 'Any description'|trans }}</span> | ||||
|             {% else %} | ||||
|                 <blockquote class="chill-user-quote"> | ||||
|                     {{ document.description|chill_markdown_to_html }} | ||||
|                 </blockquote> | ||||
|             {% endif %} | ||||
|         </dd> | ||||
|     </dl> | ||||
|  | ||||
| 	</dl> | ||||
|     <ul class="record_actions sticky-form-buttons"> | ||||
|         <li class="cancel"> | ||||
|             <a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel"> | ||||
|                 {{ 'Back to the list' | trans }} | ||||
|             </a> | ||||
|         </li> | ||||
|         <li> | ||||
|             {{ m.download_button(document.object, document.title) }} | ||||
|         </li> | ||||
|         {% if chill_document_is_editable(document.object) %} | ||||
|             <li> | ||||
|                 {{ document.object|chill_document_edit_button }} | ||||
|             </li> | ||||
|         {% endif %} | ||||
|         {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %} | ||||
|             <li> | ||||
|                 <a href="{{ path('accompanying_course_document_edit', {'id': document.id, 'course': accompanyingCourse.id}) }}" | ||||
|                    class="btn btn-edit" title="{{ 'Edit attributes' | trans }}"></a> | ||||
|             </li> | ||||
|         {% endif %} | ||||
|         {% set workflows_frame = chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) %} | ||||
|         {% if workflows_frame is not empty %} | ||||
|             <li> | ||||
|                 {{ workflows_frame|raw }} | ||||
|             </li> | ||||
|         {% endif %} | ||||
|     </ul> | ||||
| </div> | ||||
| {% endblock %} | ||||
|  | ||||
| 	<ul class="record_actions"> | ||||
| 		<li class="cancel"> | ||||
| 			<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel"> | ||||
| 				{{ 'Back to the list' | trans }} | ||||
| 			</a> | ||||
| 		</li> | ||||
| {% block block_post_menu %} | ||||
|     <div class="post-menu pt-4"></div> | ||||
| {% endblock %} | ||||
|  | ||||
| 		<li> | ||||
| 			{{ m.download_button(document.object, document.title) }} | ||||
| 		</li> | ||||
|  | ||||
| 		{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %} | ||||
| 			<li> | ||||
| 				<a href="{{ path('accompanying_course_document_edit', {'id': document.id, 'course': accompanyingCourse.id}) }}" class="btn btn-edit"> | ||||
| 					{{ 'Edit' | trans }} | ||||
| 				</a> | ||||
| 			</li> | ||||
| 		{% endif %} | ||||
| 	{% endblock %} | ||||
| {% block js %} | ||||
|     {{ parent() }} | ||||
|     {{ encore_entry_script_tags('mod_async_upload') }} | ||||
|     {{ encore_entry_script_tags('mod_entity_workflow_pick') }} | ||||
| {% endblock %} | ||||
|   | ||||
| @@ -0,0 +1,9 @@ | ||||
|  | ||||
| {# Twig way | ||||
|     TODO: une route, un template avec un header CHILL et un iframe | ||||
| #} | ||||
| <a href="{{ chill_path_add_return_path('chill_wopi_file_edit', {'fileId': document.uuid}) }}" | ||||
|     class="btn btn-wopilink"> | ||||
|     {{ 'online_edit_document'|trans }} | ||||
| </a> | ||||
|  | ||||
| @@ -0,0 +1,83 @@ | ||||
| {% import "@ChillDocStore/Macro/macro.html.twig" as m %} | ||||
| {% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %} | ||||
| <div class="item-bloc"> | ||||
|     <div class="item-row"> | ||||
|         <div class="item-col"> | ||||
|             <div class="denomination h2"> | ||||
|                 {{ document.title }} | ||||
|             </div> | ||||
|             <div> | ||||
|                 {{ mm.mimeIcon(document.object.type) }} | ||||
|             </div> | ||||
|             <div> | ||||
|                 <p>{{ document.category.name|localize_translatable_string }}</p> | ||||
|             </div> | ||||
|             {% if document.template is not null %} | ||||
|                 <div> | ||||
|                     <p>{{ document.template.name.fr }}</p> | ||||
|                 </div> | ||||
|             {% endif %} | ||||
|         </div> | ||||
|  | ||||
|         <div class="item-col"> | ||||
|             <div class="container"> | ||||
|                 {% if document.date is not null %} | ||||
|                     <div class="dates row" style="float: right;"> | ||||
|                         <span>{{ document.createdAt|format_date('short') }}</span> | ||||
|                     </div> | ||||
|                 {% endif %} | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     {% if document.description is not empty %} | ||||
|         <div class="item-row separator"> | ||||
|             <blockquote class="chill-user-quote"> | ||||
|                 {{ document.description|chill_markdown_to_html }} | ||||
|             </blockquote> | ||||
|         </div> | ||||
|     {% endif %} | ||||
|     <div class="item-row separator"> | ||||
|         <div class="item-col item-meta"> | ||||
|             <div class="updatedBy"> | ||||
|                 {{ 'Created by'|trans }}: | ||||
|                 <span class="user">{{ document.createdBy|chill_entity_render_string }}</span> | ||||
|                 <span class="date">le {{ document.createdAt|format_date('long') }}</span> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <div> | ||||
|     {% if document.course is defined %} | ||||
|         <ul class="record_actions"> | ||||
|             {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS', document) %} | ||||
|                 <li> | ||||
|                     {{ m.download_button(document.object, document.title) }} | ||||
|                 </li> | ||||
|                 <li> | ||||
|                     <a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': accompanyingCourse.id, 'id': document.id}) }}" class="btn btn-show"></a> | ||||
|                 </li> | ||||
|             {% endif %} | ||||
|             {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %} | ||||
|                 <li> | ||||
|                     <a href="{{ path('accompanying_course_document_edit', {'course': accompanyingCourse.id, 'id': document.id }) }}" class="btn btn-update"></a> | ||||
|                 </li> | ||||
|             {% endif %} | ||||
|         </ul> | ||||
|     {% else %} | ||||
|         <ul class="record_actions"> | ||||
|             {% if is_granted('CHILL_PERSON_DOCUMENT_SEE_DETAILS', document) %} | ||||
|                 <li> | ||||
|                     {{ m.download_button(document.object, document.title) }} | ||||
|                 </li> | ||||
|                 <li> | ||||
|                     <a href="{{ path('person_document_show', {'person': person.id, 'id': document.id}) }}" class="btn btn-show"></a> | ||||
|                 </li> | ||||
|             {% endif %} | ||||
|             {% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %} | ||||
|                 <li> | ||||
|                     <a href="{{ path('person_document_edit', {'person': person.id, 'id': document.id}) }}" class="btn btn-update"></a> | ||||
|                 </li> | ||||
|             {% endif %} | ||||
|         </ul> | ||||
|     {% endif %} | ||||
|     </div> | ||||
| </div> | ||||
| @@ -0,0 +1,55 @@ | ||||
| {% macro mimeIcon(type) %} | ||||
|      | ||||
|     {# mapping | ||||
|         forkawesome and mime type  https://gist.github.com/colemanw/9c9a12aae16a4bfe2678de86b661d922 | ||||
|     #} | ||||
|     {% set mapmime = { | ||||
|         'image': 'fa-file-image-o', | ||||
|         'audio': 'fa-file-audio-o', | ||||
|         'video': 'fa-file-video-o', | ||||
|         'application/pdf': 'fa-file-pdf-o', | ||||
|         'application/msword': 'fa-file-word-o', | ||||
|         'application/vnd.ms-word': 'fa-file-word-o', | ||||
|         'application/vnd.oasis.opendocument.text': 'fa-file-word-o', | ||||
|         'application/vnd.openxmlformats-officedocument.wordprocessingml': 'fa-file-word-o', | ||||
|         'application/vnd.ms-excel': 'fa-file-excel-o', | ||||
|         'application/vnd.openxmlformats-officedocument.spreadsheetml': 'fa-file-excel-o', | ||||
|         'application/vnd.oasis.opendocument.spreadsheet': 'fa-file-excel-o', | ||||
|         'application/vnd.ms-powerpoint': 'fa-file-powerpoint-o', | ||||
|         'application/vnd.openxmlformats-officedocument.presentationml': 'fa-file-powerpoint-o', | ||||
|         'application/vnd.oasis.opendocument.presentation': 'fa-file-powerpoint-o', | ||||
|         'text/plain': 'fa-file-text-o', | ||||
|         'text/html': 'fa-file-code-o', | ||||
|         'application/json': 'fa-file-code-o', | ||||
|         'application/gzip': 'fa-file-archive-o', | ||||
|         'application/zip': 'fa-file-archive-o', | ||||
|     } %} | ||||
|      | ||||
|     {% set icon = 'fa-file-o' %} | ||||
|     {% for key,val in mapmime %} | ||||
|         {% if type starts with key %} | ||||
|             {% set icon = val %} | ||||
|         {% endif %} | ||||
|     {% endfor %} | ||||
|      | ||||
|     {# TODO improve mapping | ||||
|         mime type and friendly name  https://gist.github.com/rosskmurphy/3724501 | ||||
|     #} | ||||
|     {% set maptype = { | ||||
|         'fa-file-word-o': 'office document/texte', | ||||
|         'fa-file-excel-o': 'office document/tableur', | ||||
|         'fa-file-powerpoint-o': 'office document/presentation', | ||||
|     } %} | ||||
|      | ||||
|     {% set label = type %} | ||||
|     {% for key, val in maptype %} | ||||
|         {% if icon == key %} | ||||
|             {% set label = val %} | ||||
|         {% endif %} | ||||
|     {% endfor %} | ||||
|      | ||||
|     <div class="metadata"> | ||||
|         <i class="fa {{ icon }} fa-lg me-1"></i> | ||||
|         {{ label|capitalize }} | ||||
|     </div> | ||||
| {% endmacro %} | ||||
| @@ -30,7 +30,9 @@ | ||||
|     {{ form_row(form.title) }} | ||||
|     {{ form_row(form.date) }} | ||||
|     {{ form_row(form.category) }} | ||||
|     {{ form_row(form.scope) }} | ||||
|     {% if form.scope is defined %} | ||||
|         {{ form_row(form.scope) }} | ||||
|     {% endif %} | ||||
|     {{ form_row(form.description) }} | ||||
|     {{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }} | ||||
|  | ||||
|   | ||||
| @@ -30,54 +30,24 @@ | ||||
| {% endblock %} | ||||
|  | ||||
| {% block personcontent %} | ||||
|  | ||||
| <div class="col-md-10 col-xxl"> | ||||
| 	<h1>{{ 'Documents for %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}</h1> | ||||
|  | ||||
| 	<table class="table table-bordered border-dark table-striped"> | ||||
|  | ||||
| 		<thead> | ||||
| 			<tr> | ||||
| 				<th>{{ 'Title' | trans }}</th> | ||||
| 				<th>{{ 'Category'|trans }}</th> | ||||
| 				<th>{{ 'Circle' | trans }}</th> | ||||
| 				<th>{{ 'Actions' | trans }}</th> | ||||
| 			</tr> | ||||
| 		</thead> | ||||
| 		<tbody> | ||||
| 	{% if documents|length == 0 %} | ||||
|             <p class="chill-no-data-statement">{{ 'No documents'|trans }}</p> | ||||
|     {% else %} | ||||
| 		<div class="flex-table chill-task-list"> | ||||
| 			{% for document in documents %} | ||||
| 				<tr> | ||||
| 					<td>{{ document.title }}</td> | ||||
| 					<td>{{ document.category.name|localize_translatable_string }}</td> | ||||
| 					<td>{{ document.scope.name|localize_translatable_string }}</td> | ||||
| 					<td> | ||||
| 						<ul class="record_actions"> | ||||
| 							{% if is_granted('CHILL_PERSON_DOCUMENT_SEE_DETAILS', document) %} | ||||
| 								<li> | ||||
| 									{{ m.download_button(document.object, document.title) }} | ||||
| 								</li> | ||||
| 								<li> | ||||
| 									<a href="{{ path('person_document_show', {'person': person.id, 'id': document.id}) }}" class="btn btn-show"></a> | ||||
| 								</li> | ||||
| 							{% endif %} | ||||
| 							{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %} | ||||
| 								<li> | ||||
| 									<a href="{{ path('person_document_edit', {'person': person.id, 'id': document.id}) }}" class="btn btn-update"></a> | ||||
| 								</li> | ||||
| 							{% endif %} | ||||
| 						</ul> | ||||
| 					</td> | ||||
| 				</tr> | ||||
| 			{% else %} | ||||
| 				<tr> | ||||
| 					<td colspan="9" style="text-align:center;"> | ||||
| 						<span class="chill-no-data-statement">{{ 'Any document found'|trans }}</span> | ||||
| 					</td> | ||||
| 				</tr> | ||||
| 				{% include 'ChillDocStoreBundle:List:list_item.html.twig' %} | ||||
| 			{% endfor %} | ||||
| 		</tbody> | ||||
| 	</table> | ||||
| 		</div> | ||||
|     {% endif %} | ||||
|  | ||||
| 	{{ chill_pagination(pagination) }} | ||||
|  | ||||
| 	{% if is_granted('CHILL_PERSON_DOCUMENT_CREATE', person) %} | ||||
| 		<ul class="record_actions"> | ||||
| 		<ul class="record_actions sticky-form-buttons"> | ||||
| 			<li class="create"> | ||||
| 				<a href="{{ path('person_document_new', {'person': person.id}) }}" class="btn btn-create"> | ||||
| 					{{ 'Create new document' | trans }} | ||||
| @@ -85,4 +55,6 @@ | ||||
| 			</li> | ||||
| 		</ul> | ||||
| 	{% endif %} | ||||
|  | ||||
| </div> | ||||
| {% endblock %} | ||||
|   | ||||
| @@ -19,6 +19,7 @@ | ||||
| {% set activeRouteKey = '' %} | ||||
|  | ||||
| {% import "@ChillDocStore/Macro/macro.html.twig" as m %} | ||||
| {% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %} | ||||
|  | ||||
| {% block title %}{{ 'Detail of document of %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}{% endblock %} | ||||
|  | ||||
| @@ -29,12 +30,16 @@ | ||||
| {% block personcontent %} | ||||
|     <h1>{{ 'Document %title%' | trans({ '%title%': document.title }) }}</h1> | ||||
|  | ||||
|     {{ mm.mimeIcon(document.object.type) }} | ||||
|  | ||||
|     <dl class="chill_view_data"> | ||||
|         <dt>{{ 'Title'|trans }}</dt> | ||||
|         <dd>{{ document.title }}</dd> | ||||
|  | ||||
|         {% if document.scope is not null %} | ||||
|         <dt>{{ 'Scope' | trans }}</dt> | ||||
|         <dd>{{ document.scope.name | localize_translatable_string }}</dd> | ||||
|         {% endif %} | ||||
|  | ||||
|         <dt>{{ 'Category'|trans }}</dt> | ||||
|         <dd>{{ document.category.name|localize_translatable_string }}</dd> | ||||
| @@ -52,7 +57,7 @@ | ||||
|  | ||||
|     </dl> | ||||
|  | ||||
|     <ul class="record_actions"> | ||||
|     <ul class="record_actions sticky-form-buttons"> | ||||
|         <li class="cancel"> | ||||
|             <a href="{{ path('person_document_index', {'person': person.id}) }}" class="btn btn-cancel"> | ||||
|                 {{ 'Back to the list' | trans }} | ||||
| @@ -63,6 +68,12 @@ | ||||
|             {{ m.download_button(document.object, document.title) }} | ||||
|         </li> | ||||
|  | ||||
|         {% if chill_document_is_editable(document.object) %} | ||||
|             <li> | ||||
|                 {{ document.object|chill_document_edit_button }} | ||||
|             </li> | ||||
|         {% endif %} | ||||
|  | ||||
|         {% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %} | ||||
|             <li> | ||||
|                 <a href="{{ path('person_document_edit', {'id': document.id, 'person': person.id}) }}" class="btn btn-edit"> | ||||
|   | ||||
| @@ -0,0 +1,36 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\DocStoreBundle\Templating; | ||||
|  | ||||
| use Twig\Extension\AbstractExtension; | ||||
| use Twig\TwigFilter; | ||||
| use Twig\TwigFunction; | ||||
|  | ||||
| class WopiEditTwigExtension extends AbstractExtension | ||||
| { | ||||
|     public function getFilters(): array | ||||
|     { | ||||
|         return [ | ||||
|             new TwigFilter('chill_document_edit_button', [WopiEditTwigExtensionRuntime::class, 'renderEditButton'], [ | ||||
|                 'needs_environment' => true, | ||||
|                 'is_safe' => ['html'], | ||||
|             ]), | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|     public function getFunctions(): array | ||||
|     { | ||||
|         return [ | ||||
|             new TwigFunction('chill_document_is_editable', [WopiEditTwigExtensionRuntime::class, 'isEditable']), | ||||
|         ]; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,55 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\DocStoreBundle\Templating; | ||||
|  | ||||
| use ChampsLibres\WopiLib\Contract\Service\Discovery\DiscoveryInterface; | ||||
| use Chill\DocStoreBundle\Entity\StoredObject; | ||||
| use Twig\Environment; | ||||
| use Twig\Extension\RuntimeExtensionInterface; | ||||
| use function array_key_exists; | ||||
|  | ||||
| class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface | ||||
| { | ||||
|     public const TEMPLATE = '@ChillDocStore/Button/wopi_edit_document.html.twig'; | ||||
|  | ||||
|     private DiscoveryInterface $discovery; | ||||
|  | ||||
|     public function __construct(DiscoveryInterface $discovery) | ||||
|     { | ||||
|         $this->discovery = $discovery; | ||||
|     } | ||||
|  | ||||
|     public function isEditable(StoredObject $document): bool | ||||
|     { | ||||
|         $mime_type = $this->discovery->discoverMimeType($document->getType()); | ||||
|  | ||||
|         if ([] === $mime_type) { | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         foreach ($mime_type as $item) { | ||||
|             if (array_key_exists('default', $item) && 'true' === $item['default']) { | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     public function renderEditButton(Environment $environment, StoredObject $document, ?array $options = null): string | ||||
|     { | ||||
|         return $environment->render(self::TEMPLATE, [ | ||||
|             'document' => $document, | ||||
|             'options' => $options, | ||||
|         ]); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,74 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\DocStoreBundle\Workflow; | ||||
|  | ||||
| use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument; | ||||
| use Chill\MainBundle\Entity\Workflow\EntityWorkflow; | ||||
| use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface; | ||||
| use Doctrine\ORM\EntityManagerInterface; | ||||
| use Doctrine\ORM\EntityRepository; | ||||
|  | ||||
| class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandlerInterface | ||||
| { | ||||
|     private EntityRepository $repository; | ||||
|  | ||||
|     /** | ||||
|      * TODO: injecter le repository directement. | ||||
|      */ | ||||
|     public function __construct(EntityManagerInterface $em) | ||||
|     { | ||||
|         $this->repository = $em->getRepository(AccompanyingCourseDocument::class); | ||||
|     } | ||||
|  | ||||
|     public function getRelatedEntity(EntityWorkflow $entityWorkflow): ?AccompanyingCourseDocument | ||||
|     { | ||||
|         return $this->repository->find($entityWorkflow->getRelatedEntityId()); | ||||
|     } | ||||
|  | ||||
|     public function getRoleShow(EntityWorkflow $entityWorkflow): ?string | ||||
|     { | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     public function getTemplate(EntityWorkflow $entityWorkflow, array $options = []): string | ||||
|     { | ||||
|         return '@ChillDocStore/AccompanyingCourseDocument/_workflow.html.twig'; | ||||
|     } | ||||
|  | ||||
|     public function getTemplateData(EntityWorkflow $entityWorkflow, array $options = []): array | ||||
|     { | ||||
|         return [ | ||||
|             'entity_workflow' => $entityWorkflow, | ||||
|             'document' => $this->getRelatedEntity($entityWorkflow), | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|     public function getTemplateTitle(EntityWorkflow $entityWorkflow, array $options = []): string | ||||
|     { | ||||
|         return '@ChillDocStore/AccompanyingCourseDocument/_workflow.title.html.twig'; | ||||
|     } | ||||
|  | ||||
|     public function getTemplateTitleData(EntityWorkflow $entityWorkflow, array $options = []): array | ||||
|     { | ||||
|         return $this->getTemplateData($entityWorkflow, $options); | ||||
|     } | ||||
|  | ||||
|     public function supports(EntityWorkflow $entityWorkflow, array $options = []): bool | ||||
|     { | ||||
|         return $entityWorkflow->getRelatedEntityClass() === AccompanyingCourseDocument::class; | ||||
|     } | ||||
|  | ||||
|     public function supportsFreeze(EntityWorkflow $entityWorkflow, array $options = []): bool | ||||
|     { | ||||
|         return true; | ||||
|     } | ||||
| } | ||||
| @@ -6,7 +6,6 @@ services: | ||||
|     autowire: true | ||||
|     autoconfigure: true | ||||
|     resource: "../Repository/" | ||||
|     tags: ["doctrine.repository_service"] | ||||
|  | ||||
|   Chill\DocStoreBundle\Form\DocumentCategoryType: | ||||
|     class: Chill\DocStoreBundle\Form\DocumentCategoryType | ||||
| @@ -16,8 +15,10 @@ services: | ||||
|  | ||||
|   Chill\DocStoreBundle\Form\PersonDocumentType: | ||||
|     class: Chill\DocStoreBundle\Form\PersonDocumentType | ||||
|     arguments: | ||||
|       - "@chill.main.helper.translatable_string" | ||||
|     autowire: true | ||||
|     autoconfigure: true | ||||
|     # arguments: | ||||
|     #   - "@chill.main.helper.translatable_string" | ||||
|     tags: | ||||
|       - { name: form.type, alias: chill_docstorebundle_form_document } | ||||
|  | ||||
| @@ -27,3 +28,8 @@ services: | ||||
|     autoconfigure: true | ||||
|     tags: | ||||
|       - { name: chill.role } | ||||
|  | ||||
|   Chill\DocStoreBundle\Workflow\: | ||||
|       resource: './../Workflow/' | ||||
|       autoconfigure: true | ||||
|       autowire: true | ||||
|   | ||||
| @@ -0,0 +1,6 @@ | ||||
| services: | ||||
|  | ||||
|   Chill\DocStoreBundle\Templating\: | ||||
|     resource: ../../Templating | ||||
|     autoconfigure: true | ||||
|     autowire: true | ||||
| @@ -0,0 +1,76 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\Migrations\DocStore; | ||||
|  | ||||
| use Doctrine\DBAL\Schema\Schema; | ||||
| use Doctrine\Migrations\AbstractMigration; | ||||
|  | ||||
| /** | ||||
|  * Implementations of create and update traits for Document entity + template property added. | ||||
|  */ | ||||
| final class Version20220131093117 extends AbstractMigration | ||||
| { | ||||
|     public function down(Schema $schema): void | ||||
|     { | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C5DA0FB8'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C3174800F'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C65FF1AEC'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document DROP template_id'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document DROP createdAt'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document DROP updatedAt'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document DROP createdBy_id'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document DROP updatedBy_id'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F65DA0FB8'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F63174800F'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F665FF1AEC'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP template_id'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP createdAt'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP updatedAt'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP createdBy_id'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP updatedBy_id'); | ||||
|     } | ||||
|  | ||||
|     public function getDescription(): string | ||||
|     { | ||||
|         return 'Implementations of create and update traits for Document entity + template property added'; | ||||
|     } | ||||
|  | ||||
|     public function up(Schema $schema): void | ||||
|     { | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD template_id INT DEFAULT NULL'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD createdBy_id INT DEFAULT NULL'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD updatedBy_id INT DEFAULT NULL'); | ||||
|         $this->addSql('COMMENT ON COLUMN chill_doc.accompanyingcourse_document.createdAt IS \'(DC2Type:datetime_immutable)\''); | ||||
|         $this->addSql('COMMENT ON COLUMN chill_doc.accompanyingcourse_document.updatedAt IS \'(DC2Type:datetime_immutable)\''); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F65DA0FB8 FOREIGN KEY (template_id) REFERENCES chill_docgen_template (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F63174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F665FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||||
|         $this->addSql('CREATE INDEX IDX_A45098F65DA0FB8 ON chill_doc.accompanyingcourse_document (template_id)'); | ||||
|         $this->addSql('CREATE INDEX IDX_A45098F63174800F ON chill_doc.accompanyingcourse_document (createdBy_id)'); | ||||
|         $this->addSql('CREATE INDEX IDX_A45098F665FF1AEC ON chill_doc.accompanyingcourse_document (updatedBy_id)'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document ADD template_id INT DEFAULT NULL'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document ADD createdBy_id INT DEFAULT NULL'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document ADD updatedBy_id INT DEFAULT NULL'); | ||||
|         $this->addSql('COMMENT ON COLUMN chill_doc.person_document.createdAt IS \'(DC2Type:datetime_immutable)\''); | ||||
|         $this->addSql('COMMENT ON COLUMN chill_doc.person_document.updatedAt IS \'(DC2Type:datetime_immutable)\''); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C5DA0FB8 FOREIGN KEY (template_id) REFERENCES chill_docgen_template (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C3174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||||
|         $this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C65FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||||
|         $this->addSql('CREATE INDEX IDX_41DA53C5DA0FB8 ON chill_doc.person_document (template_id)'); | ||||
|         $this->addSql('CREATE INDEX IDX_41DA53C3174800F ON chill_doc.person_document (createdBy_id)'); | ||||
|         $this->addSql('CREATE INDEX IDX_41DA53C65FF1AEC ON chill_doc.person_document (updatedBy_id)'); | ||||
|     } | ||||
| } | ||||
| @@ -9,6 +9,8 @@ Create new document: Créer un nouveau document | ||||
| New document for %name%: Nouveau document pour %name% | ||||
| Editing document for %name%: Modification d'un document pour %name% | ||||
| Edit Document: Modification d'un document | ||||
| Update document: Modifier le document | ||||
| Edit attributes: Modifier les propriétés du document | ||||
| Existing document: Document existant | ||||
| No document to download: Aucun document à télécharger | ||||
| 'Choose a document category': Choisissez une catégorie de document | ||||
| @@ -50,4 +52,7 @@ Id inside bundle: Identifiant | ||||
| Document class: Classe de document | ||||
| no records found: | ||||
| Create new category: Créer une nouvelle catégorie | ||||
| Back to the category list: Retour à la liste | ||||
| Back to the category list: Retour à la liste | ||||
|  | ||||
| # WOPI EDIT | ||||
| online_edit_document: Éditer en ligne | ||||
|   | ||||
| @@ -31,6 +31,7 @@ use Chill\MainBundle\Security\Resolver\ScopeResolverInterface; | ||||
| use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; | ||||
| use Chill\MainBundle\Templating\Entity\CompilerPass as RenderEntityCompilerPass; | ||||
| use Chill\MainBundle\Templating\UI\NotificationCounterInterface; | ||||
| use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface; | ||||
| use Symfony\Component\DependencyInjection\ContainerBuilder; | ||||
| use Symfony\Component\HttpKernel\Bundle\Bundle; | ||||
|  | ||||
| @@ -56,6 +57,8 @@ class ChillMainBundle extends Bundle | ||||
|             ->addTag('chill_main.notification_handler'); | ||||
|         $container->registerForAutoconfiguration(NotificationCounterInterface::class) | ||||
|             ->addTag('chill.count_notification.user'); | ||||
|         $container->registerForAutoconfiguration(EntityWorkflowHandlerInterface::class) | ||||
|             ->addTag('chill_main.workflow_handler'); | ||||
|  | ||||
|         $container->addCompilerPass(new SearchableServicesCompilerPass()); | ||||
|         $container->addCompilerPass(new ConfigConsistencyCompilerPass()); | ||||
|   | ||||
| @@ -12,6 +12,8 @@ declare(strict_types=1); | ||||
| namespace Chill\MainBundle\Controller; | ||||
|  | ||||
| use Chill\MainBundle\CRUD\Controller\ApiController; | ||||
| use Chill\MainBundle\Pagination\PaginatorInterface; | ||||
| use Doctrine\ORM\QueryBuilder; | ||||
| use Symfony\Component\HttpFoundation\Request; | ||||
|  | ||||
| /** | ||||
| @@ -19,7 +21,7 @@ use Symfony\Component\HttpFoundation\Request; | ||||
|  */ | ||||
| class LocationApiController extends ApiController | ||||
| { | ||||
|     public function customizeQuery(string $action, Request $request, $query): void | ||||
|     protected function customizeQuery(string $action, Request $request, $query): void | ||||
|     { | ||||
|         $query | ||||
|             ->leftJoin('e.locationType', 'lt') | ||||
| @@ -31,4 +33,14 @@ class LocationApiController extends ApiController | ||||
|                 ) | ||||
|             ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param QueryBuilder $query | ||||
|      * @param mixed $_format | ||||
|      */ | ||||
|     protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format) | ||||
|     { | ||||
|         return $query | ||||
|             ->addOrderBy('e.name', 'ASC'); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -24,6 +24,7 @@ class LocationTypeApiController extends ApiController | ||||
|         $query->andWhere( | ||||
|             $query->expr()->andX( | ||||
|                 $query->expr()->eq('e.availableForUsers', "'TRUE'"), | ||||
|                 $query->expr()->eq('e.editableByUsers', "'TRUE'"), | ||||
|                 $query->expr()->eq('e.active', "'TRUE'"), | ||||
|             ) | ||||
|         ); | ||||
|   | ||||
| @@ -13,13 +13,19 @@ namespace Chill\MainBundle\Controller; | ||||
|  | ||||
| use Chill\MainBundle\Entity\Notification; | ||||
| use Chill\MainBundle\Entity\User; | ||||
| use Chill\MainBundle\Pagination\PaginatorFactory; | ||||
| use Chill\MainBundle\Repository\NotificationRepository; | ||||
| use Chill\MainBundle\Security\Authorization\NotificationVoter; | ||||
| use Chill\MainBundle\Serializer\Model\Collection; | ||||
| use Chill\MainBundle\Serializer\Model\Counter; | ||||
| use Doctrine\ORM\EntityManagerInterface; | ||||
| use RuntimeException; | ||||
| use Symfony\Component\HttpFoundation\JsonResponse; | ||||
| use Symfony\Component\HttpFoundation\Request; | ||||
| use Symfony\Component\Routing\Annotation\Route; | ||||
| use Symfony\Component\Security\Core\Exception\AccessDeniedException; | ||||
| use Symfony\Component\Security\Core\Security; | ||||
| use Symfony\Component\Serializer\SerializerInterface; | ||||
| use UnexpectedValueException; | ||||
|  | ||||
| /** | ||||
| @@ -29,12 +35,26 @@ class NotificationApiController | ||||
| { | ||||
|     private EntityManagerInterface $entityManager; | ||||
|  | ||||
|     private NotificationRepository $notificationRepository; | ||||
|  | ||||
|     private PaginatorFactory $paginatorFactory; | ||||
|  | ||||
|     private Security $security; | ||||
|  | ||||
|     public function __construct(EntityManagerInterface $entityManager, Security $security) | ||||
|     { | ||||
|     private SerializerInterface $serializer; | ||||
|  | ||||
|     public function __construct( | ||||
|         EntityManagerInterface $entityManager, | ||||
|         NotificationRepository $notificationRepository, | ||||
|         PaginatorFactory $paginatorFactory, | ||||
|         Security $security, | ||||
|         SerializerInterface $serializer | ||||
|     ) { | ||||
|         $this->entityManager = $entityManager; | ||||
|         $this->notificationRepository = $notificationRepository; | ||||
|         $this->paginatorFactory = $paginatorFactory; | ||||
|         $this->security = $security; | ||||
|         $this->serializer = $serializer; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -53,6 +73,37 @@ class NotificationApiController | ||||
|         return $this->markAs('unread', $notification); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @Route("/my/unread") | ||||
|      */ | ||||
|     public function myUnreadNotifications(Request $request): JsonResponse | ||||
|     { | ||||
|         $total = $this->notificationRepository->countUnreadByUser($this->security->getUser()); | ||||
|  | ||||
|         if ($request->query->getBoolean('countOnly')) { | ||||
|             return new JsonResponse( | ||||
|                 $this->serializer->serialize(new Counter($total), 'json', ['groups' => ['read']]), | ||||
|                 JsonResponse::HTTP_OK, | ||||
|                 [], | ||||
|                 true | ||||
|             ); | ||||
|         } | ||||
|         $paginator = $this->paginatorFactory->create($total); | ||||
|         $notifications = $this->notificationRepository->findUnreadByUser( | ||||
|             $this->security->getUser(), | ||||
|             $paginator->getItemsPerPage(), | ||||
|             $paginator->getCurrentPageFirstItemNumber() | ||||
|         ); | ||||
|         $collection = new Collection($notifications, $paginator); | ||||
|  | ||||
|         return new JsonResponse( | ||||
|             $this->serializer->serialize($collection, 'json', ['groups' => ['read']]), | ||||
|             JsonResponse::HTTP_OK, | ||||
|             [], | ||||
|             true | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     private function markAs(string $target, Notification $notification): JsonResponse | ||||
|     { | ||||
|         if (!$this->security->isGranted(NotificationVoter::NOTIFICATION_TOGGLE_READ_STATUS, $notification)) { | ||||
|   | ||||
| @@ -236,6 +236,10 @@ class NotificationController extends AbstractController | ||||
|                         '_fragment' => 'comment-' . $commentId, | ||||
|                     ]); | ||||
|                 } | ||||
|  | ||||
|                 if ($editedCommentForm->isSubmitted() && !$editedCommentForm->isValid()) { | ||||
|                     $this->addFlash('error', $this->translator->trans('This form contains errors')); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -257,6 +261,10 @@ class NotificationController extends AbstractController | ||||
|                         'id' => $notification->getId(), | ||||
|                     ]); | ||||
|                 } | ||||
|  | ||||
|                 if ($appendCommentForm->isSubmitted() && !$appendCommentForm->isValid()) { | ||||
|                     $this->addFlash('error', $this->translator->trans('This form contains errors')); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|   | ||||
							
								
								
									
										118
									
								
								src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										118
									
								
								src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,118 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\MainBundle\Controller; | ||||
|  | ||||
| use Chill\MainBundle\Entity\Workflow\EntityWorkflow; | ||||
| use Doctrine\ORM\EntityManagerInterface; | ||||
| use LogicException; | ||||
| use Symfony\Component\HttpFoundation\JsonResponse; | ||||
| use Symfony\Component\HttpFoundation\Request; | ||||
| use Symfony\Component\HttpFoundation\Response; | ||||
| use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; | ||||
| use Symfony\Component\Routing\Annotation\Route; | ||||
| use Symfony\Component\Security\Core\Exception\AccessDeniedException; | ||||
| use Symfony\Component\Security\Core\Security; | ||||
|  | ||||
| class WorkflowApiController | ||||
| { | ||||
|     private EntityManagerInterface $entityManager; | ||||
|  | ||||
|     private Security $security; | ||||
|  | ||||
|     public function __construct(Security $security, EntityManagerInterface $entityManager) | ||||
|     { | ||||
|         $this->entityManager = $entityManager; | ||||
|         $this->security = $security; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @Route("/api/1.0/main/workflow/{id}/subscribe", methods={"POST"}) | ||||
|      */ | ||||
|     public function subscribe(EntityWorkflow $entityWorkflow, Request $request): Response | ||||
|     { | ||||
|         return $this->handleSubscription($entityWorkflow, $request, 'subscribe'); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @Route("/api/1.0/main/workflow/{id}/unsubscribe", methods={"POST"}) | ||||
|      */ | ||||
|     public function unsubscribe(EntityWorkflow $entityWorkflow, Request $request): Response | ||||
|     { | ||||
|         return $this->handleSubscription($entityWorkflow, $request, 'unsubscribe'); | ||||
|     } | ||||
|  | ||||
|     private function handleSubscription(EntityWorkflow $entityWorkflow, Request $request, string $action): JsonResponse | ||||
|     { | ||||
|         if (!$this->security->isGranted('IS_AUTHENTICATED_REMEMBERED')) { | ||||
|             throw new AccessDeniedException(); | ||||
|         } | ||||
|  | ||||
|         if (!$request->query->has('subscribe')) { | ||||
|             throw new BadRequestHttpException('missing subscribe parameter'); | ||||
|         } | ||||
|  | ||||
|         $user = $this->security->getUser(); | ||||
|  | ||||
|         switch ($request->query->get('subscribe')) { | ||||
|             case 'final': | ||||
|                 switch ($action) { | ||||
|                     case 'subscribe': | ||||
|                         $entityWorkflow->addSubscriberToFinal($user); | ||||
|  | ||||
|                         break; | ||||
|  | ||||
|                     case 'unsubscribe': | ||||
|                         $entityWorkflow->removeSubscriberToFinal($user); | ||||
|  | ||||
|                         break; | ||||
|  | ||||
|                     default: | ||||
|                         throw new LogicException(); | ||||
|                 } | ||||
|  | ||||
|                 break; | ||||
|  | ||||
|             case 'step': | ||||
|                 switch ($action) { | ||||
|                     case 'subscribe': | ||||
|                         $entityWorkflow->addSubscriberToStep($user); | ||||
|  | ||||
|                         break; | ||||
|  | ||||
|                     case 'unsubscribe': | ||||
|                         $entityWorkflow->removeSubscriberToStep($user); | ||||
|  | ||||
|                         break; | ||||
|  | ||||
|                     default: | ||||
|                         throw new LogicException(); | ||||
|                 } | ||||
|  | ||||
|                 break; | ||||
|  | ||||
|             default: | ||||
|                 throw new BadRequestHttpException('subscribe parameter must be equal to "step" or "final"'); | ||||
|         } | ||||
|  | ||||
|         $this->entityManager->flush(); | ||||
|  | ||||
|         return new JsonResponse( | ||||
|             [ | ||||
|                 'step' => $entityWorkflow->isUserSubscribedToStep($user), | ||||
|                 'final' => $entityWorkflow->isUserSubscribedToFinal($user), | ||||
|             ], | ||||
|             JsonResponse::HTTP_OK, | ||||
|             [], | ||||
|             false | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										269
									
								
								src/Bundle/ChillMainBundle/Controller/WorkflowController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										269
									
								
								src/Bundle/ChillMainBundle/Controller/WorkflowController.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,269 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\MainBundle\Controller; | ||||
|  | ||||
| use Chill\MainBundle\Entity\Workflow\EntityWorkflow; | ||||
| use Chill\MainBundle\Entity\Workflow\EntityWorkflowComment; | ||||
| use Chill\MainBundle\Form\EntityWorkflowCommentType; | ||||
| use Chill\MainBundle\Form\WorkflowStepType; | ||||
| use Chill\MainBundle\Pagination\PaginatorFactory; | ||||
| use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository; | ||||
| use Chill\MainBundle\Security\Authorization\EntityWorkflowVoter; | ||||
| use Chill\MainBundle\Workflow\EntityWorkflowManager; | ||||
| use Chill\MainBundle\Workflow\Validator\StepDestValid; | ||||
| use Doctrine\ORM\EntityManagerInterface; | ||||
| use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||||
| use Symfony\Component\HttpFoundation\Request; | ||||
| use Symfony\Component\HttpFoundation\Response; | ||||
| use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; | ||||
| use Symfony\Component\Routing\Annotation\Route; | ||||
| use Symfony\Component\Validator\Validator\ValidatorInterface; | ||||
| use Symfony\Component\Workflow\Registry; | ||||
| use Symfony\Component\Workflow\TransitionBlocker; | ||||
| use Symfony\Contracts\Translation\TranslatorInterface; | ||||
| use function count; | ||||
|  | ||||
| class WorkflowController extends AbstractController | ||||
| { | ||||
|     private EntityManagerInterface $entityManager; | ||||
|  | ||||
|     private EntityWorkflowManager $entityWorkflowManager; | ||||
|  | ||||
|     private EntityWorkflowRepository $entityWorkflowRepository; | ||||
|  | ||||
|     private PaginatorFactory $paginatorFactory; | ||||
|  | ||||
|     private Registry $registry; | ||||
|  | ||||
|     private TranslatorInterface $translator; | ||||
|  | ||||
|     private ValidatorInterface $validator; | ||||
|  | ||||
|     public function __construct(EntityWorkflowManager $entityWorkflowManager, EntityWorkflowRepository $entityWorkflowRepository, ValidatorInterface $validator, PaginatorFactory $paginatorFactory, Registry $registry, EntityManagerInterface $entityManager, TranslatorInterface $translator) | ||||
|     { | ||||
|         $this->entityWorkflowManager = $entityWorkflowManager; | ||||
|         $this->entityWorkflowRepository = $entityWorkflowRepository; | ||||
|         $this->validator = $validator; | ||||
|         $this->paginatorFactory = $paginatorFactory; | ||||
|         $this->registry = $registry; | ||||
|         $this->entityManager = $entityManager; | ||||
|         $this->translator = $translator; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @Route("/{_locale}/main/workflow/create", name="chill_main_workflow_create") | ||||
|      */ | ||||
|     public function create(Request $request): Response | ||||
|     { | ||||
|         if (!$request->query->has('entityClass')) { | ||||
|             throw new BadRequestHttpException('Missing entityClass parameter'); | ||||
|         } | ||||
|  | ||||
|         if (!$request->query->has('entityId')) { | ||||
|             throw new BadRequestHttpException('missing entityId parameter'); | ||||
|         } | ||||
|  | ||||
|         if (!$request->query->has('workflow')) { | ||||
|             throw new BadRequestHttpException('missing workflow parameter'); | ||||
|         } | ||||
|  | ||||
|         $entityWorkflow = new EntityWorkflow(); | ||||
|         $entityWorkflow | ||||
|             ->setRelatedEntityClass($request->query->get('entityClass')) | ||||
|             ->setRelatedEntityId($request->query->getInt('entityId')) | ||||
|             ->setWorkflowName($request->query->get('workflow')); | ||||
|  | ||||
|         $errors = $this->validator->validate($entityWorkflow, null, ['creation']); | ||||
|  | ||||
|         if (count($errors) > 0) { | ||||
|             $msg = []; | ||||
|  | ||||
|             foreach ($errors as $error) { | ||||
|                 /** @var \Symfony\Component\Validator\ConstraintViolationInterface $error */ | ||||
|                 $msg[] = $error->getMessage(); | ||||
|             } | ||||
|  | ||||
|             return new Response(implode("\n", $msg), Response::HTTP_UNPROCESSABLE_ENTITY); | ||||
|         } | ||||
|  | ||||
|         $this->denyAccessUnlessGranted(EntityWorkflowVoter::CREATE, $entityWorkflow); | ||||
|  | ||||
|         $em = $this->getDoctrine()->getManager(); | ||||
|         $em->persist($entityWorkflow); | ||||
|         $em->flush(); | ||||
|  | ||||
|         return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @Route("/{_locale}/main/workflow/list/dest", name="chill_main_workflow_list_dest") | ||||
|      */ | ||||
|     public function myWorkflowsDest(Request $request): Response | ||||
|     { | ||||
|         $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); | ||||
|  | ||||
|         $total = $this->entityWorkflowRepository->countByDest($this->getUser()); | ||||
|         $paginator = $this->paginatorFactory->create($total); | ||||
|  | ||||
|         $workflows = $this->entityWorkflowRepository->findByDest( | ||||
|             $this->getUser(), | ||||
|             ['createdAt' => 'DESC'], | ||||
|             $paginator->getItemsPerPage(), | ||||
|             $paginator->getCurrentPageFirstItemNumber() | ||||
|         ); | ||||
|  | ||||
|         return $this->render( | ||||
|             '@ChillMain/Workflow/list.html.twig', | ||||
|             [ | ||||
|                 'workflows' => $this->buildHandler($workflows), | ||||
|                 'paginator' => $paginator, | ||||
|                 'step' => 'dest', | ||||
|             ] | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @Route("/{_locale}/main/workflow/list/subscribed", name="chill_main_workflow_list_subscribed") | ||||
|      */ | ||||
|     public function myWorkflowsSubscribed(Request $request): Response | ||||
|     { | ||||
|         $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); | ||||
|  | ||||
|         $total = $this->entityWorkflowRepository->countBySubscriber($this->getUser()); | ||||
|         $paginator = $this->paginatorFactory->create($total); | ||||
|  | ||||
|         $workflows = $this->entityWorkflowRepository->findBySubscriber( | ||||
|             $this->getUser(), | ||||
|             ['createdAt' => 'DESC'], | ||||
|             $paginator->getItemsPerPage(), | ||||
|             $paginator->getCurrentPageFirstItemNumber() | ||||
|         ); | ||||
|  | ||||
|         return $this->render( | ||||
|             '@ChillMain/Workflow/list.html.twig', | ||||
|             [ | ||||
|                 'workflows' => $this->buildHandler($workflows), | ||||
|                 'paginator' => $paginator, | ||||
|                 'step' => 'subscribed', | ||||
|             ] | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @Route("/{_locale}/main/workflow/{id}/show", name="chill_main_workflow_show") | ||||
|      */ | ||||
|     public function show(EntityWorkflow $entityWorkflow, Request $request): Response | ||||
|     { | ||||
|         $this->denyAccessUnlessGranted(EntityWorkflowVoter::SEE, $entityWorkflow); | ||||
|  | ||||
|         $handler = $this->entityWorkflowManager->getHandler($entityWorkflow); | ||||
|         $workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName()); | ||||
|         $errors = []; | ||||
|  | ||||
|         if (count($workflow->getEnabledTransitions($entityWorkflow)) > 0) { | ||||
|             // possible transition | ||||
|             $transitionForm = $this->createForm( | ||||
|                 WorkflowStepType::class, | ||||
|                 $entityWorkflow->getCurrentStep(), | ||||
|                 ['transition' => true, 'entity_workflow' => $entityWorkflow] | ||||
|             ); | ||||
|  | ||||
|             $transitionForm->handleRequest($request); | ||||
|  | ||||
|             if ($transitionForm->isSubmitted() && $transitionForm->isValid()) { | ||||
|                 if (!$workflow->can($entityWorkflow, $transition = $transitionForm['transition']->getData()->getName())) { | ||||
|                     $blockers = $workflow->buildTransitionBlockerList($entityWorkflow, $transition); | ||||
|                     $msgs = array_map(function (TransitionBlocker $tb) { | ||||
|                         return $this->translator->trans( | ||||
|                             $tb->getMessage(), | ||||
|                             $tb->getParameters() | ||||
|                         ); | ||||
|                     }, iterator_to_array($blockers)); | ||||
|  | ||||
|                     throw $this->createAccessDeniedException( | ||||
|                         sprintf( | ||||
|                             "not allowed to apply transition {$transition}: %s", | ||||
|                             implode(', ', $msgs) | ||||
|                         ) | ||||
|                     ); | ||||
|                 } | ||||
|  | ||||
|                 $workflow->apply($entityWorkflow, $transition); | ||||
|  | ||||
|                 foreach ($transitionForm['future_dest_users']->getData() as $user) { | ||||
|                     $entityWorkflow->getCurrentStep()->addDestUser($user); | ||||
|                 } | ||||
|  | ||||
|                 $errors = $this->validator->validate( | ||||
|                     $entityWorkflow->getCurrentStep(), | ||||
|                     new StepDestValid() | ||||
|                 ); | ||||
|  | ||||
|                 if (count($errors) === 0) { | ||||
|                     $this->entityManager->flush(); | ||||
|  | ||||
|                     return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]); | ||||
|                 } | ||||
|  | ||||
|                 return new Response((string) $errors, Response::HTTP_UNPROCESSABLE_ENTITY); | ||||
|             } | ||||
|  | ||||
|             if ($transitionForm->isSubmitted() && !$transitionForm->isValid()) { | ||||
|                 $this->addFlash('error', $this->translator->trans('This form contains errors')); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         /* | ||||
|         $commentForm = $this->createForm(EntityWorkflowCommentType::class, $newComment = new EntityWorkflowComment()); | ||||
|         $commentForm->handleRequest($request); | ||||
|  | ||||
|         if ($commentForm->isSubmitted() && $commentForm->isValid()) { | ||||
|             $this->entityManager->persist($newComment); | ||||
|             $this->entityManager->flush(); | ||||
|  | ||||
|             $this->addFlash('success', $this->translator->trans('workflow.Comment added')); | ||||
|  | ||||
|             return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]); | ||||
|         } elseif ($commentForm->isSubmitted() && !$commentForm->isValid()) { | ||||
|             $this->addFlash('error', $this->translator->trans('This form contains errors')); | ||||
|         } | ||||
|          */ | ||||
|  | ||||
|         return $this->render( | ||||
|             '@ChillMain/Workflow/index.html.twig', | ||||
|             [ | ||||
|                 'handler_template' => $handler->getTemplate($entityWorkflow), | ||||
|                 'handler_template_title' => $handler->getTemplateTitle($entityWorkflow), | ||||
|                 'handler_template_data' => $handler->getTemplateData($entityWorkflow), | ||||
|                 'transition_form' => isset($transitionForm) ? $transitionForm->createView() : null, | ||||
|                 'entity_workflow' => $entityWorkflow, | ||||
|                 'transition_form_errors' => $errors, | ||||
|                 //'comment_form' => $commentForm->createView(), | ||||
|             ] | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     private function buildHandler(array $workflows): array | ||||
|     { | ||||
|         $lines = []; | ||||
|  | ||||
|         foreach ($workflows as $workflow) { | ||||
|             $handler = $this->entityWorkflowManager->getHandler($workflow); | ||||
|             $lines[] = [ | ||||
|                 'handler' => $handler, | ||||
|                 'entity_workflow' => $workflow, | ||||
|             ]; | ||||
|         } | ||||
|  | ||||
|         return $lines; | ||||
|     } | ||||
| } | ||||
| @@ -168,6 +168,7 @@ class ChillMainExtension extends Extension implements | ||||
|         $loader->load('services/timeline.yaml'); | ||||
|         $loader->load('services/search.yaml'); | ||||
|         $loader->load('services/serializer.yaml'); | ||||
|         $loader->load('services/mailer.yaml'); | ||||
|  | ||||
|         $this->configureCruds($container, $config['cruds'], $config['apis'], $loader); | ||||
|     } | ||||
| @@ -391,6 +392,26 @@ class ChillMainExtension extends Extension implements | ||||
|                         ], | ||||
|                     ], | ||||
|                 ], | ||||
|                 [ | ||||
|                     'class' => \Chill\MainBundle\Entity\UserJob::class, | ||||
|                     'name' => 'user_job', | ||||
|                     'base_path' => '/api/1.0/main/user-job', | ||||
|                     'base_role' => 'ROLE_USER', | ||||
|                     'actions' => [ | ||||
|                         '_index' => [ | ||||
|                             'methods' => [ | ||||
|                                 Request::METHOD_GET => true, | ||||
|                                 Request::METHOD_HEAD => true, | ||||
|                             ], | ||||
|                         ], | ||||
|                         '_entity' => [ | ||||
|                             'methods' => [ | ||||
|                                 Request::METHOD_GET => true, | ||||
|                                 Request::METHOD_HEAD => true, | ||||
|                             ], | ||||
|                         ], | ||||
|                     ], | ||||
|                 ], | ||||
|                 [ | ||||
|                     'controller' => \Chill\MainBundle\Controller\AddressReferenceAPIController::class, | ||||
|                     'class' => \Chill\MainBundle\Entity\AddressReference::class, | ||||
|   | ||||
| @@ -0,0 +1,56 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\MainBundle\Doctrine\Model; | ||||
|  | ||||
| use Chill\MainBundle\Entity\User; | ||||
| use DateTime; | ||||
| use DateTimeImmutable; | ||||
| use DateTimeInterface; | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
|  | ||||
| trait TrackCreationTrait | ||||
| { | ||||
|     /** | ||||
|      * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL}) | ||||
|      */ | ||||
|     private ?DateTimeImmutable $createdAt = null; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity=User::class) | ||||
|      * @ORM\JoinColumn(nullable=true) | ||||
|      */ | ||||
|     private ?User $createdBy = null; | ||||
|  | ||||
|     public function getCreatedAt(): ?DateTimeInterface | ||||
|     { | ||||
|         return $this->createdAt; | ||||
|     } | ||||
|  | ||||
|     public function getCreatedBy(): ?User | ||||
|     { | ||||
|         return $this->createdBy; | ||||
|     } | ||||
|  | ||||
|     public function setCreatedAt(DateTimeInterface $datetime): self | ||||
|     { | ||||
|         $this->createdAt = $datetime instanceof DateTime ? DateTimeImmutable::createFromMutable($datetime) : $datetime; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setCreatedBy(User $user): self | ||||
|     { | ||||
|         $this->createdBy = $user; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,56 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\MainBundle\Doctrine\Model; | ||||
|  | ||||
| use Chill\MainBundle\Entity\User; | ||||
| use DateTime; | ||||
| use DateTimeImmutable; | ||||
| use DateTimeInterface; | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
|  | ||||
| trait TrackUpdateTrait | ||||
| { | ||||
|     /** | ||||
|      * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL}) | ||||
|      */ | ||||
|     private ?DateTimeImmutable $updatedAt = null; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity=User::class) | ||||
|      * @ORM\JoinColumn(nullable=true) | ||||
|      */ | ||||
|     private ?User $updatedBy = null; | ||||
|  | ||||
|     public function getUpdatedAt(): ?DateTimeInterface | ||||
|     { | ||||
|         return $this->updatedAt; | ||||
|     } | ||||
|  | ||||
|     public function getUpdatedBy(): ?User | ||||
|     { | ||||
|         return $this->updatedBy; | ||||
|     } | ||||
|  | ||||
|     public function setUpdatedAt(DateTimeInterface $datetime): self | ||||
|     { | ||||
|         $this->updatedAt = $datetime instanceof DateTime ? DateTimeImmutable::createFromMutable($datetime) : $datetime; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setUpdatedBy(User $user): self | ||||
|     { | ||||
|         $this->updatedBy = $user; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
| @@ -42,10 +42,16 @@ class Address | ||||
|      */ | ||||
|     private $buildingName; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="boolean") | ||||
|      * @Groups({"write"}) | ||||
|      */ | ||||
|     private bool $confidential = false; | ||||
|  | ||||
|     /** | ||||
|      * @var string|null | ||||
|      * | ||||
|      * @ORM\Column(type="string", length=16, nullable=true) | ||||
|      * @ORM\Column(type="string", length=255, nullable=true) | ||||
|      * @Groups({"write"}) | ||||
|      */ | ||||
|     private $corridor; | ||||
| @@ -78,7 +84,7 @@ class Address | ||||
|     /** | ||||
|      * @var string|null | ||||
|      * | ||||
|      * @ORM\Column(type="string", length=16, nullable=true) | ||||
|      * @ORM\Column(type="string", length=255, nullable=true) | ||||
|      * @Groups({"write"}) | ||||
|      */ | ||||
|     private $flat; | ||||
| @@ -86,7 +92,7 @@ class Address | ||||
|     /** | ||||
|      * @var string|null | ||||
|      * | ||||
|      * @ORM\Column(type="string", length=16, nullable=true) | ||||
|      * @ORM\Column(type="string", length=255, nullable=true) | ||||
|      * @Groups({"write"}) | ||||
|      */ | ||||
|     private $floor; | ||||
| @@ -143,7 +149,7 @@ class Address | ||||
|     /** | ||||
|      * @var string|null | ||||
|      * | ||||
|      * @ORM\Column(type="string", length=16, nullable=true) | ||||
|      * @ORM\Column(type="string", length=255, nullable=true) | ||||
|      * @Groups({"write"}) | ||||
|      */ | ||||
|     private $steps; | ||||
| @@ -192,6 +198,7 @@ class Address | ||||
|         return (new Address()) | ||||
|             ->setAddressReference($original->getAddressReference()) | ||||
|             ->setBuildingName($original->getBuildingName()) | ||||
|             ->setConfidential($original->getConfidential()) | ||||
|             ->setCorridor($original->getCorridor()) | ||||
|             ->setCustoms($original->getCustoms()) | ||||
|             ->setDistribution($original->getDistribution()) | ||||
| @@ -229,6 +236,11 @@ class Address | ||||
|         return $this->buildingName; | ||||
|     } | ||||
|  | ||||
|     public function getConfidential(): bool | ||||
|     { | ||||
|         return $this->confidential; | ||||
|     } | ||||
|  | ||||
|     public function getCorridor(): ?string | ||||
|     { | ||||
|         return $this->corridor; | ||||
| @@ -369,6 +381,13 @@ class Address | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setConfidential(bool $confidential): self | ||||
|     { | ||||
|         $this->confidential = $confidential; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setCorridor(?string $corridor): self | ||||
|     { | ||||
|         $this->corridor = $corridor; | ||||
|   | ||||
| @@ -20,10 +20,9 @@ use Doctrine\ORM\Mapping as ORM; | ||||
| class CommentEmbeddable | ||||
| { | ||||
|     /** | ||||
|      * @var string | ||||
|      * @ORM\Column(type="text", nullable=true) | ||||
|      */ | ||||
|     private $comment; | ||||
|     private ?string $comment = null; | ||||
|  | ||||
|     /** | ||||
|      * @var DateTime | ||||
| @@ -39,10 +38,7 @@ class CommentEmbeddable | ||||
|      */ | ||||
|     private $userId; | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getComment() | ||||
|     public function getComment(): ?string | ||||
|     { | ||||
|         return $this->comment; | ||||
|     } | ||||
| @@ -68,9 +64,6 @@ class CommentEmbeddable | ||||
|         return empty($this->getComment()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param string $comment | ||||
|      */ | ||||
|     public function setComment(?string $comment) | ||||
|     { | ||||
|         $this->comment = $comment; | ||||
|   | ||||
| @@ -64,7 +64,7 @@ class Location implements TrackCreationInterface, TrackUpdateInterface | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="string", length=255, nullable=true) | ||||
|      * @Serializer\Groups({"read", "write"}) | ||||
|      * @Serializer\Groups({"read", "write", "docgen:read"}) | ||||
|      */ | ||||
|     private ?string $email = null; | ||||
|  | ||||
|   | ||||
| @@ -67,6 +67,12 @@ class LocationType | ||||
|      */ | ||||
|     private ?string $defaultFor = null; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="boolean") | ||||
|      * @Serializer\Groups({"read"}) | ||||
|      */ | ||||
|     private bool $editableByUsers = true; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Id | ||||
|      * @ORM\GeneratedValue | ||||
| @@ -107,6 +113,11 @@ class LocationType | ||||
|         return $this->defaultFor; | ||||
|     } | ||||
|  | ||||
|     public function getEditableByUsers(): ?bool | ||||
|     { | ||||
|         return $this->editableByUsers; | ||||
|     } | ||||
|  | ||||
|     public function getId(): ?int | ||||
|     { | ||||
|         return $this->id; | ||||
| @@ -152,6 +163,13 @@ class LocationType | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setEditableByUsers(bool $editableByUsers): self | ||||
|     { | ||||
|         $this->editableByUsers = $editableByUsers; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setTitle(array $title): self | ||||
|     { | ||||
|         $this->title = $title; | ||||
|   | ||||
| @@ -17,11 +17,15 @@ use DateTimeInterface; | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
| use Doctrine\Common\Collections\Collection; | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
| use Symfony\Component\Validator\Constraints as Assert; | ||||
|  | ||||
| /** | ||||
|  * @ORM\Entity | ||||
|  * @ORM\Table( | ||||
|  *     name="chill_main_notification", | ||||
|  *     indexes={ | ||||
|  *         @ORM\Index(name="chill_main_notification_related_entity_idx", columns={"relatedentityclass", "relatedentityid"}) | ||||
|  *     } | ||||
|  * ) | ||||
|  * @ORM\HasLifecycleCallbacks | ||||
|  */ | ||||
| @@ -32,6 +36,7 @@ class Notification implements TrackUpdateInterface | ||||
|     /** | ||||
|      * @ORM\ManyToMany(targetEntity=User::class) | ||||
|      * @ORM\JoinTable(name="chill_main_notification_addresses_user") | ||||
|      * @Assert\Count(min="1", minMessage="notification.At least one addressee") | ||||
|      */ | ||||
|     private Collection $addressees; | ||||
|  | ||||
| @@ -80,6 +85,7 @@ class Notification implements TrackUpdateInterface | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="text", options={"default": ""}) | ||||
|      * @Assert\NotBlank(message="notification.Title must be defined") | ||||
|      */ | ||||
|     private string $title = ''; | ||||
|  | ||||
| @@ -286,9 +292,9 @@ class Notification implements TrackUpdateInterface | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setMessage(string $message): self | ||||
|     public function setMessage(?string $message): self | ||||
|     { | ||||
|         $this->message = $message; | ||||
|         $this->message = (string) $message; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
| @@ -314,9 +320,9 @@ class Notification implements TrackUpdateInterface | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setTitle(string $title): Notification | ||||
|     public function setTitle(?string $title): Notification | ||||
|     { | ||||
|         $this->title = $title; | ||||
|         $this->title = (string) $title; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|   | ||||
| @@ -18,6 +18,7 @@ use DateTimeInterface; | ||||
| use Doctrine\ORM\Event\LifecycleEventArgs; | ||||
| use Doctrine\ORM\Event\PreFlushEventArgs; | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
| use Symfony\Component\Validator\Constraints as Assert; | ||||
|  | ||||
| /** | ||||
|  * @ORM\Entity | ||||
| @@ -28,6 +29,7 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac | ||||
| { | ||||
|     /** | ||||
|      * @ORM\Column(type="text") | ||||
|      * @Assert\NotBlank(message="notification.Comment content might not be blank") | ||||
|      */ | ||||
|     private string $content = ''; | ||||
|  | ||||
| @@ -136,9 +138,9 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac | ||||
|         $this->recentlyPersisted = true; | ||||
|     } | ||||
|  | ||||
|     public function setContent(string $content): self | ||||
|     public function setContent(?string $content): self | ||||
|     { | ||||
|         $this->content = $content; | ||||
|         $this->content = (string) $content; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|   | ||||
							
								
								
									
										166
									
								
								src/Bundle/ChillMainBundle/Entity/ResidentialAddress.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										166
									
								
								src/Bundle/ChillMainBundle/Entity/ResidentialAddress.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,166 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\MainBundle\Entity; | ||||
|  | ||||
| use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; | ||||
| use Chill\MainBundle\Repository\ResidentialAddressRepository; | ||||
| use Chill\PersonBundle\Entity\Person; | ||||
| use Chill\ThirdPartyBundle\Entity\ThirdParty; | ||||
| use DateTimeImmutable; | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
|  | ||||
| /** | ||||
|  * @ORM\Entity(repositoryClass=ResidentialAddressRepository::class) | ||||
|  * @ORM\Table(name="chill_main_residential_address") | ||||
|  */ | ||||
| class ResidentialAddress | ||||
| { | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity=Address::class) | ||||
|      * @ORM\JoinColumn(nullable=true) | ||||
|      */ | ||||
|     private ?Address $address = null; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="residentialAddressComment_") | ||||
|      */ | ||||
|     private CommentEmbeddable $comment; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="datetime_immutable", nullable=true) | ||||
|      */ | ||||
|     private ?DateTimeImmutable $endDate = null; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity=Person::class) | ||||
|      * @ORM\JoinColumn(nullable=true) | ||||
|      */ | ||||
|     private ?Person $hostPerson = null; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity=ThirdParty::class) | ||||
|      * @ORM\JoinColumn(nullable=true) | ||||
|      */ | ||||
|     private ?ThirdParty $hostThirdParty = null; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Id | ||||
|      * @ORM\GeneratedValue | ||||
|      * @ORM\Column(type="integer") | ||||
|      */ | ||||
|     private $id; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity=Person::class) | ||||
|      * @ORM\JoinColumn(nullable=false) | ||||
|      */ | ||||
|     private Person $person; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="datetime_immutable") | ||||
|      */ | ||||
|     private ?DateTimeImmutable $startDate = null; | ||||
|  | ||||
|     public function __construct() | ||||
|     { | ||||
|         $this->comment = new CommentEmbeddable(); | ||||
|     } | ||||
|  | ||||
|     public function getAddress(): ?Address | ||||
|     { | ||||
|         return $this->address; | ||||
|     } | ||||
|  | ||||
|     public function getComment(): CommentEmbeddable | ||||
|     { | ||||
|         return $this->comment; | ||||
|     } | ||||
|  | ||||
|     public function getEndDate(): ?DateTimeImmutable | ||||
|     { | ||||
|         return $this->endDate; | ||||
|     } | ||||
|  | ||||
|     public function getHostPerson(): ?Person | ||||
|     { | ||||
|         return $this->hostPerson; | ||||
|     } | ||||
|  | ||||
|     public function getHostThirdParty(): ?ThirdParty | ||||
|     { | ||||
|         return $this->hostThirdParty; | ||||
|     } | ||||
|  | ||||
|     public function getId(): ?int | ||||
|     { | ||||
|         return $this->id; | ||||
|     } | ||||
|  | ||||
|     public function getPerson(): ?Person | ||||
|     { | ||||
|         return $this->person; | ||||
|     } | ||||
|  | ||||
|     public function getStartDate(): ?DateTimeImmutable | ||||
|     { | ||||
|         return $this->startDate; | ||||
|     } | ||||
|  | ||||
|     public function setAddress(?Address $address): self | ||||
|     { | ||||
|         $this->address = $address; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setComment(CommentEmbeddable $comment): self | ||||
|     { | ||||
|         $this->comment = $comment; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setEndDate(?DateTimeImmutable $endDate): self | ||||
|     { | ||||
|         $this->endDate = $endDate; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setHostPerson(?Person $hostPerson): self | ||||
|     { | ||||
|         $this->hostPerson = $hostPerson; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setHostThirdParty(?ThirdParty $hostThirdParty): self | ||||
|     { | ||||
|         $this->hostThirdParty = $hostThirdParty; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setPerson(?Person $person): self | ||||
|     { | ||||
|         $this->person = $person; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setStartDate(DateTimeImmutable $startDate): self | ||||
|     { | ||||
|         $this->startDate = $startDate; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
| @@ -97,6 +97,11 @@ class User implements AdvancedUserInterface | ||||
|      */ | ||||
|     private ?Center $mainCenter = null; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity=Location::class) | ||||
|      */ | ||||
|     private ?Location $mainLocation = null; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity=Scope::class) | ||||
|      */ | ||||
| @@ -228,6 +233,11 @@ class User implements AdvancedUserInterface | ||||
|         return $this->mainCenter; | ||||
|     } | ||||
|  | ||||
|     public function getMainLocation(): ?Location | ||||
|     { | ||||
|         return $this->mainLocation; | ||||
|     } | ||||
|  | ||||
|     public function getMainScope(): ?Scope | ||||
|     { | ||||
|         return $this->mainScope; | ||||
| @@ -405,6 +415,13 @@ class User implements AdvancedUserInterface | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setMainLocation(?Location $mainLocation): User | ||||
|     { | ||||
|         $this->mainLocation = $mainLocation; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function setMainScope(?Scope $mainScope): User | ||||
|     { | ||||
|         $this->mainScope = $mainScope; | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user