Parameters.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. <?php
  2. declare (strict_types=1);
  3. namespace App\Entity\Organization;
  4. use ApiPlatform\Metadata\Put;
  5. use ApiPlatform\Metadata\Get;
  6. use ApiPlatform\Metadata\ApiResource;
  7. use App\Entity\Access\Access;
  8. use App\Entity\Core\File;
  9. use App\Repository\Organization\ParametersRepository;
  10. use App\State\Processor\Organization\ParametersProcessor;
  11. //use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  12. use Doctrine\Common\Collections\ArrayCollection;
  13. use Doctrine\Common\Collections\Collection;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use JetBrains\PhpStorm\Pure;
  16. use Symfony\Component\Validator\Constraints as Assert;
  17. use App\Validator\Organization\Parameters as OpentalentAssert;
  18. #[ApiResource(
  19. operations: [
  20. new Get(
  21. security: '(is_granted("ROLE_ORGANIZATION_VIEW") or is_granted("ROLE_ORGANIZATION")) and object.getOrganization().getId() == user.getOrganization().getId()'
  22. ),
  23. new Put(
  24. security: 'is_granted("ROLE_ORGANIZATION") and object.getOrganization().getId() == user.getOrganization().getId()'
  25. )
  26. ],
  27. processor: ParametersProcessor::class
  28. )]
  29. //#[Auditable]
  30. #[ORM\Entity(repositoryClass: ParametersRepository::class)]
  31. #[OpentalentAssert\MobytCredentials]
  32. class Parameters
  33. {
  34. #[ORM\Id]
  35. #[ORM\Column]
  36. #[ORM\GeneratedValue]
  37. private ?int $id = null;
  38. #[ORM\OneToOne(mappedBy: 'parameters', targetEntity: Organization::class)]
  39. private Organization $organization;
  40. #[ORM\Column(type: 'date', nullable: true)]
  41. private ?\DateTimeInterface $financialDate = null;
  42. #[ORM\Column(type: 'date', nullable: true)]
  43. private ?\DateTimeInterface $musicalDate = null;
  44. #[ORM\Column(type: 'date', nullable: true)]
  45. private ?\DateTimeInterface $startCourseDate = null;
  46. #[ORM\Column(type: 'date', nullable: true)]
  47. private ?\DateTimeInterface $endCourseDate = null;
  48. #[ORM\Column(options: ['default' => 20])]
  49. #[Assert\Range(notInRangeMessage: 'between_{{ min }}_and_{{ max }}', min: 0, max: 100)]
  50. private int $average = 20;
  51. #[ORM\Column(options: ['default' => true])]
  52. private bool $editCriteriaNotationByAdminOnly = true;
  53. #[ORM\Column(length: 255, nullable: true)]
  54. #[Assert\Regex('/^[a-z0-9]+$/i', message: 'smsSenderName_error')]
  55. private ?string $smsSenderName = null;
  56. #[ORM\Column(options: ['default' => false])]
  57. private bool $logoDonorsMove = false;
  58. #[ORM\Column(length: 60, nullable: true)]
  59. private ?string $subDomain = null;
  60. #[ORM\Column(length: 100, nullable: true)]
  61. private ?string $website = null;
  62. #[ORM\Column(length: 150, nullable: true)]
  63. private ?string $otherWebsite = null;
  64. #[ORM\Column(length: 150, nullable: true)]
  65. private ?string $customDomain = null;
  66. #[ORM\Column(options: ['default' => false])]
  67. private bool $desactivateOpentalentSiteWeb = false;
  68. #[ORM\OneToMany(mappedBy: 'publicationDirector', targetEntity: Access::class)]
  69. private Collection $publicationDirectors;
  70. #[ORM\Column(length: 255, nullable: true)]
  71. #[Assert\Choice(callback: ['\\App\\Enum\\Organization\\BulletinPeriodEnum', 'toArray'], message: 'invalid-bulletin-period')]
  72. private ?string $bulletinPeriod = null;
  73. #[ORM\Column(options: ['default' => false])]
  74. private bool $bulletinWithTeacher = false;
  75. #[ORM\Column(options: ['default' => false])]
  76. private bool $bulletinPrintAddress = false;
  77. #[ORM\Column(options: ['default' => true])]
  78. private bool $bulletinSignatureDirector = true;
  79. #[ORM\Column(options: ['default' => true])]
  80. private bool $bulletinDisplayLevelAcquired = true;
  81. #[ORM\Column(options: ['default' => false])]
  82. private bool $bulletinShowEducationWithoutEvaluation = false;
  83. #[ORM\Column(options: ['default' => false])]
  84. private bool $bulletinViewTestResults = false;
  85. #[ORM\Column(options: ['default' => false])]
  86. private bool $bulletinShowAbsences = false;
  87. #[ORM\Column(options: ['default' => true])]
  88. private bool $bulletinShowAverages = true;
  89. #[ORM\Column(length: 255, nullable: true)]
  90. #[Assert\Choice(callback: ['\\App\\Enum\\Organization\\BulletinOutputEnum', 'toArray'], message: 'invalid-bulletin-output')]
  91. private ?string $bulletinOutput = null;
  92. #[ORM\Column(options: ['default' => true])]
  93. private bool $bulletinEditWithoutEvaluation = true;
  94. #[ORM\Column(length: 255, nullable: true, options: ['default' => 'STUDENTS_AND_THEIR_GUARDIANS'])]
  95. #[Assert\Choice(callback: ['\\App\\Enum\\Organization\\SendToBulletinEnum', 'toArray'], message: 'invalid-send-to-bulletin')]
  96. private ?string $bulletinReceiver = null;
  97. #[ORM\Column(length: 255, nullable: true)]
  98. private ?string $usernameSMS = null;
  99. #[ORM\Column(length: 255, nullable: true)]
  100. private ?string $passwordSMS = null;
  101. #[ORM\Column(options: ['default' => true])]
  102. private bool $showAdherentList = true;
  103. #[ORM\Column(options: ['default' => false])]
  104. private bool $studentsAreAdherents = false;
  105. #[ORM\OneToOne(inversedBy: 'qrCode', targetEntity: File::class, cascade: ['persist'], fetch: 'EAGER')]
  106. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  107. private ?File $qrCode = null;
  108. #[ORM\Column(length: 255, options: ['default' => 'Europe/Paris'])]
  109. #[Assert\Choice(callback: ['\\App\\Enum\\Core\\TimeZoneEnum', 'toArray'], message: 'invalid-timezone')]
  110. private ?string $timezone = "Europe/Paris";
  111. #[ORM\Column(length: 255, nullable: false, options: ['default' => 'ANNUAL'])]
  112. #[Assert\Choice(callback: ['\\App\\Enum\\Education\\PeriodicityEnum', 'toArray'], message: 'invalid-periodicity')]
  113. private ?string $educationPeriodicity = 'ANNUAL';
  114. #[ORM\Column(length: 255, nullable: true, options: ['default' => 'BY_EDUCATION'])]
  115. #[Assert\Choice(callback: ['\\App\\Enum\\Education\\AdvancedEducationNotationTypeEnum', 'toArray'], message: 'invalid-advanced-education-notation-type')]
  116. private ?string $advancedEducationNotationType = null;
  117. #[ORM\Column(options: ['default' => false])]
  118. private bool $sendAttendanceEmail = false;
  119. #[ORM\Column(options: ['default' => false])]
  120. private bool $sendAttendanceSms = false;
  121. #[ORM\Column(options: ['default' => true])]
  122. private bool $generateAttendanceReport = true;
  123. #[ORM\Column(options: ['default' => true])]
  124. private bool $consultPedagogicResult = true;
  125. #[ORM\Column(options: ['default' => true])]
  126. private bool $consultTeacherListing = true;
  127. #[ORM\Column(options: ['default' => true])]
  128. private bool $periodValidation = true;
  129. #[ORM\Column(type: "boolean", options: ["default" => false])]
  130. private bool $notifyAdministrationAbsence = false;
  131. #[Pure]
  132. public function __construct()
  133. {
  134. $this->publicationDirectors = new ArrayCollection();
  135. }
  136. public function getId(): ?int
  137. {
  138. return $this->id;
  139. }
  140. public function getOrganization(): Organization
  141. {
  142. return $this->organization;
  143. }
  144. public function setOrganization(Organization $organization): self
  145. {
  146. $this->organization = $organization;
  147. return $this;
  148. }
  149. public function getFinancialDate(): ?\DateTimeInterface
  150. {
  151. return $this->financialDate;
  152. }
  153. public function setFinancialDate(?\DateTimeInterface $financialDate): self
  154. {
  155. $this->financialDate = $financialDate;
  156. return $this;
  157. }
  158. public function getMusicalDate(): ?\DateTimeInterface
  159. {
  160. return $this->musicalDate;
  161. }
  162. public function setMusicalDate(?\DateTimeInterface $musicalDate): self
  163. {
  164. $this->musicalDate = $musicalDate;
  165. return $this;
  166. }
  167. public function getStartCourseDate(): ?\DateTimeInterface
  168. {
  169. return $this->startCourseDate;
  170. }
  171. public function setStartCourseDate(?\DateTimeInterface $startCourseDate): self
  172. {
  173. $this->startCourseDate = $startCourseDate;
  174. return $this;
  175. }
  176. public function getEndCourseDate(): ?\DateTimeInterface
  177. {
  178. return $this->endCourseDate;
  179. }
  180. public function setEndCourseDate(?\DateTimeInterface $endCourseDate): self
  181. {
  182. $this->endCourseDate = $endCourseDate;
  183. return $this;
  184. }
  185. public function getAverage(): int
  186. {
  187. return $this->average;
  188. }
  189. public function setAverage(int $average): self
  190. {
  191. $this->average = $average;
  192. return $this;
  193. }
  194. public function getEditCriteriaNotationByAdminOnly(): bool
  195. {
  196. return $this->editCriteriaNotationByAdminOnly;
  197. }
  198. public function setEditCriteriaNotationByAdminOnly(bool $editCriteriaNotationByAdminOnly): self
  199. {
  200. $this->editCriteriaNotationByAdminOnly = $editCriteriaNotationByAdminOnly;
  201. return $this;
  202. }
  203. public function getSmsSenderName(): ?string
  204. {
  205. return $this->smsSenderName;
  206. }
  207. public function setSmsSenderName(?string $smsSenderName): self
  208. {
  209. $this->smsSenderName = $smsSenderName;
  210. return $this;
  211. }
  212. public function getLogoDonorsMove(): bool
  213. {
  214. return $this->logoDonorsMove;
  215. }
  216. public function setLogoDonorsMove(bool $logoDonorsMove): self
  217. {
  218. $this->logoDonorsMove = $logoDonorsMove;
  219. return $this;
  220. }
  221. public function getOtherWebsite(): ?string
  222. {
  223. return $this->otherWebsite;
  224. }
  225. public function setOtherWebsite(?string $otherWebsite): self
  226. {
  227. $this->otherWebsite = $otherWebsite;
  228. return $this;
  229. }
  230. /**
  231. * @return string|null
  232. */
  233. public function getCustomDomain(): ?string
  234. {
  235. return $this->customDomain;
  236. }
  237. /**
  238. * @param string|null $customDomain
  239. */
  240. public function setCustomDomain(?string $customDomain): void
  241. {
  242. $this->customDomain = $customDomain;
  243. }
  244. public function getDesactivateOpentalentSiteWeb(): bool
  245. {
  246. return $this->desactivateOpentalentSiteWeb;
  247. }
  248. public function setDesactivateOpentalentSiteWeb(bool $desactivateOpentalentSiteWeb): self
  249. {
  250. $this->desactivateOpentalentSiteWeb = $desactivateOpentalentSiteWeb;
  251. return $this;
  252. }
  253. public function getBulletinPeriod(): ?string
  254. {
  255. return $this->bulletinPeriod;
  256. }
  257. public function setBulletinPeriod(?string $bulletinPeriod): self
  258. {
  259. $this->bulletinPeriod = $bulletinPeriod;
  260. return $this;
  261. }
  262. public function getPublicationDirectors(): Collection
  263. {
  264. return $this->publicationDirectors;
  265. }
  266. public function addPublicationDirector(Access $access): self
  267. {
  268. if (!$this->publicationDirectors->contains($access)) {
  269. $this->publicationDirectors[] = $access;
  270. $access->setPublicationDirector($this);
  271. }
  272. return $this;
  273. }
  274. public function removePublicationDirector(Access $access): self
  275. {
  276. if ($this->publicationDirectors->removeElement($access)) {
  277. // set the owning side to null (unless already changed)
  278. if ($access->getPublicationDirector() === $this) {
  279. $access->setPublicationDirector(null);
  280. }
  281. }
  282. return $this;
  283. }
  284. public function getBulletinWithTeacher(): bool
  285. {
  286. return $this->bulletinWithTeacher;
  287. }
  288. public function setBulletinWithTeacher(bool $bulletinWithTeacher): self
  289. {
  290. $this->bulletinWithTeacher = $bulletinWithTeacher;
  291. return $this;
  292. }
  293. public function getBulletinPrintAddress(): bool
  294. {
  295. return $this->bulletinPrintAddress;
  296. }
  297. public function setBulletinPrintAddress(bool $bulletinPrintAddress): self
  298. {
  299. $this->bulletinPrintAddress = $bulletinPrintAddress;
  300. return $this;
  301. }
  302. public function getBulletinSignatureDirector(): bool
  303. {
  304. return $this->bulletinSignatureDirector;
  305. }
  306. public function setBulletinSignatureDirector(bool $bulletinSignatureDirector): self
  307. {
  308. $this->bulletinSignatureDirector = $bulletinSignatureDirector;
  309. return $this;
  310. }
  311. public function getBulletinDisplayLevelAcquired(): bool
  312. {
  313. return $this->bulletinDisplayLevelAcquired;
  314. }
  315. public function setBulletinDisplayLevelAcquired(bool $bulletinDisplayLevelAcquired): self
  316. {
  317. $this->bulletinDisplayLevelAcquired = $bulletinDisplayLevelAcquired;
  318. return $this;
  319. }
  320. public function getBulletinShowEducationWithoutEvaluation(): bool
  321. {
  322. return $this->bulletinShowEducationWithoutEvaluation;
  323. }
  324. public function setBulletinShowEducationWithoutEvaluation(bool $bulletinShowEducationWithoutEvaluation): self
  325. {
  326. $this->bulletinShowEducationWithoutEvaluation = $bulletinShowEducationWithoutEvaluation;
  327. return $this;
  328. }
  329. public function getBulletinViewTestResults(): bool
  330. {
  331. return $this->bulletinViewTestResults;
  332. }
  333. public function setBulletinViewTestResults(bool $bulletinViewTestResults): self
  334. {
  335. $this->bulletinViewTestResults = $bulletinViewTestResults;
  336. return $this;
  337. }
  338. public function getBulletinShowAbsences(): bool
  339. {
  340. return $this->bulletinShowAbsences;
  341. }
  342. public function setBulletinShowAbsences(bool $bulletinShowAbsences): self
  343. {
  344. $this->bulletinShowAbsences = $bulletinShowAbsences;
  345. return $this;
  346. }
  347. public function getBulletinShowAverages(): bool
  348. {
  349. return $this->bulletinShowAverages;
  350. }
  351. public function setBulletinShowAverages(bool $bulletinShowAverages): self
  352. {
  353. $this->bulletinShowAverages = $bulletinShowAverages;
  354. return $this;
  355. }
  356. public function getBulletinOutput(): ?string
  357. {
  358. return $this->bulletinOutput;
  359. }
  360. public function setBulletinOutput(?string $bulletinOutput): self
  361. {
  362. $this->bulletinOutput = $bulletinOutput;
  363. return $this;
  364. }
  365. public function getUsernameSMS(): ?string
  366. {
  367. return $this->usernameSMS;
  368. }
  369. public function setUsernameSMS(?string $usernameSMS): self
  370. {
  371. $this->usernameSMS = $usernameSMS;
  372. return $this;
  373. }
  374. public function getPasswordSMS(): ?string
  375. {
  376. return $this->passwordSMS;
  377. }
  378. public function setPasswordSMS(?string $passwordSMS): self
  379. {
  380. $this->passwordSMS = $passwordSMS;
  381. return $this;
  382. }
  383. public function getBulletinEditWithoutEvaluation(): bool
  384. {
  385. return $this->bulletinEditWithoutEvaluation;
  386. }
  387. public function setBulletinEditWithoutEvaluation(bool $bulletinEditWithoutEvaluation): self
  388. {
  389. $this->bulletinEditWithoutEvaluation = $bulletinEditWithoutEvaluation;
  390. return $this;
  391. }
  392. public function getBulletinReceiver(): ?string
  393. {
  394. return $this->bulletinReceiver;
  395. }
  396. public function setBulletinReceiver(?string $bulletinReceiver): self
  397. {
  398. $this->bulletinReceiver = $bulletinReceiver;
  399. return $this;
  400. }
  401. public function getShowAdherentList(): bool
  402. {
  403. return $this->showAdherentList;
  404. }
  405. public function setShowAdherentList(bool $showAdherentList): self
  406. {
  407. $this->showAdherentList = $showAdherentList;
  408. return $this;
  409. }
  410. public function getStudentsAreAdherents(): bool
  411. {
  412. return $this->studentsAreAdherents;
  413. }
  414. public function setStudentsAreAdherents(bool $studentsAreAdherents): self
  415. {
  416. $this->studentsAreAdherents = $studentsAreAdherents;
  417. return $this;
  418. }
  419. public function getTimezone(): string
  420. {
  421. return $this->timezone;
  422. }
  423. public function setTimezone(string $timezone): self
  424. {
  425. $this->timezone = $timezone;
  426. return $this;
  427. }
  428. public function getEducationPeriodicity(): ?string
  429. {
  430. return $this->educationPeriodicity;
  431. }
  432. public function setEducationPeriodicity(?string $educationPeriodicity): self
  433. {
  434. $this->educationPeriodicity = $educationPeriodicity;
  435. return $this;
  436. }
  437. public function getAdvancedEducationNotationType(): ?string
  438. {
  439. return $this->advancedEducationNotationType;
  440. }
  441. public function setAdvancedEducationNotationType(?string $advancedEducationNotationType): self
  442. {
  443. $this->advancedEducationNotationType = $advancedEducationNotationType;
  444. return $this;
  445. }
  446. public function getQrCode(): ?File
  447. {
  448. return $this->qrCode;
  449. }
  450. public function setQrCode(?File $qrCode): self
  451. {
  452. $this->qrCode = $qrCode;
  453. return $this;
  454. }
  455. public function getSendAttendanceSms(): bool
  456. {
  457. return $this->sendAttendanceSms;
  458. }
  459. public function setSendAttendanceSms(bool $sendAttendanceSms): self
  460. {
  461. $this->sendAttendanceSms = $sendAttendanceSms;
  462. return $this;
  463. }
  464. public function getSendAttendanceEmail(): bool
  465. {
  466. return $this->sendAttendanceEmail;
  467. }
  468. public function setSendAttendanceEmail(bool $sendAttendanceEmail): self
  469. {
  470. $this->sendAttendanceEmail = $sendAttendanceEmail;
  471. return $this;
  472. }
  473. /**
  474. * @return string|null
  475. */
  476. public function getSubDomain(): ?string
  477. {
  478. return $this->subDomain;
  479. }
  480. /**
  481. * @param string|null $subDomain
  482. */
  483. public function setSubDomain(?string $subDomain): void
  484. {
  485. $this->subDomain = $subDomain;
  486. }
  487. /**
  488. * @return string|null
  489. */
  490. public function getWebsite(): ?string
  491. {
  492. return $this->website;
  493. }
  494. /**
  495. * @param string|null $website
  496. */
  497. public function setWebsite(?string $website): void
  498. {
  499. $this->website = $website;
  500. }
  501. /**
  502. * @return bool
  503. */
  504. public function isGenerateAttendanceReport(): bool
  505. {
  506. return $this->generateAttendanceReport;
  507. }
  508. /**
  509. * @param bool $generateAttendanceReport
  510. */
  511. public function setGenerateAttendanceReport(bool $generateAttendanceReport): void
  512. {
  513. $this->generateAttendanceReport = $generateAttendanceReport;
  514. }
  515. /**
  516. * @return bool
  517. */
  518. public function isConsultPedagogicResult(): bool
  519. {
  520. return $this->consultPedagogicResult;
  521. }
  522. /**
  523. * @param bool $consultPedagogicResult
  524. */
  525. public function setConsultPedagogicResult(bool $consultPedagogicResult): void
  526. {
  527. $this->consultPedagogicResult = $consultPedagogicResult;
  528. }
  529. /**
  530. * @return bool
  531. */
  532. public function isConsultTeacherListing(): bool
  533. {
  534. return $this->consultTeacherListing;
  535. }
  536. /**
  537. * @param bool $consultTeacherListing
  538. */
  539. public function setConsultTeacherListing(bool $consultTeacherListing): void
  540. {
  541. $this->consultTeacherListing = $consultTeacherListing;
  542. }
  543. /**
  544. * Period validation is enabled
  545. *
  546. * @return bool
  547. */
  548. public function isPeriodValidation(): bool
  549. {
  550. return $this->periodValidation;
  551. }
  552. /**
  553. * @param bool $periodValidation
  554. */
  555. public function setPeriodValidation(bool $periodValidation): void
  556. {
  557. $this->periodValidation = $periodValidation;
  558. }
  559. public function getNotifyAdministrationAbsence(): bool
  560. {
  561. return $this->notifyAdministrationAbsence;
  562. }
  563. public function setNotifyAdministrationAbsence(bool $notifyAdministrationAbsence): self
  564. {
  565. $this->notifyAdministrationAbsence = $notifyAdministrationAbsence;
  566. return $this;
  567. }
  568. }