From 4ad42d0e8c5370e0b43820f61a9d821e1d83a445 Mon Sep 17 00:00:00 2001 From: paaton Date: Tue, 28 Nov 2023 21:05:59 +0100 Subject: [PATCH] additional changes to handbook, translates and migrations --- sql/init-postgresql.sql | 3 --- sql/init.sql | 3 --- ...psychical_health_and_printed_handbook.php} | 2 ++ ...1127201235_add_printed_handbook_switch.php | 22 ------------------- src/Event/AbstractContentArbiter.php | 2 +- src/Event/EventType/Obrok/EventTypeObrok.php | 6 +---- src/Participant/Participant.php | 2 +- src/Participant/ParticipantService.php | 2 +- src/Templates/cs.yaml | 2 ++ src/Templates/en.yaml | 2 ++ src/Templates/sk.yaml | 10 ++++++++- .../translatable/widgets/changeDetails.twig | 2 +- .../translatable/widgets/details.twig | 2 +- 13 files changed, 21 insertions(+), 39 deletions(-) rename src/Application/migrations/{20231127173650_add_psychical_health_and_medications.php => 20231127173650_add_psychical_health_and_printed_handbook.php} (83%) delete mode 100644 src/Application/migrations/20231127201235_add_printed_handbook_switch.php diff --git a/sql/init-postgresql.sql b/sql/init-postgresql.sql index 89b5c377..a62fe1dd 100755 --- a/sql/init-postgresql.sql +++ b/sql/init-postgresql.sql @@ -94,8 +94,6 @@ create table "participant" email TEXT, legal_representative TEXT, health_problems TEXT, - medicaments TEXT, - psychical_health_problems TEXT, food_preferences TEXT, scout_unit TEXT, tshirt TEXT, @@ -106,7 +104,6 @@ create table "participant" patrol_leader_id int, patrol_name TEXT, drivers_license TEXT, - printed_handbook TEXT, languages TEXT, skills TEXT, preferred_position TEXT, diff --git a/sql/init.sql b/sql/init.sql index 5bef3a30..f39fe8c2 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -98,8 +98,6 @@ create table participant email TEXT, legal_representative TEXT, health_problems TEXT, - medicaments TEXT, - psychical_health_problems TEXT, food_preferences TEXT, scout_unit TEXT, tshirt TEXT, @@ -110,7 +108,6 @@ create table participant patrol_leader_id int, patrol_name TEXT, drivers_license TEXT, - printed_handbook TEXT, languages TEXT, skills TEXT, preferred_position TEXT, diff --git a/src/Application/migrations/20231127173650_add_psychical_health_and_medications.php b/src/Application/migrations/20231127173650_add_psychical_health_and_printed_handbook.php similarity index 83% rename from src/Application/migrations/20231127173650_add_psychical_health_and_medications.php rename to src/Application/migrations/20231127173650_add_psychical_health_and_printed_handbook.php index f78a2189..1aa9d3a8 100644 --- a/src/Application/migrations/20231127173650_add_psychical_health_and_medications.php +++ b/src/Application/migrations/20231127173650_add_psychical_health_and_printed_handbook.php @@ -10,6 +10,7 @@ public function up(): void $tableUser = $this->table('participant'); $tableUser->addColumn('medications', 'string', ['null' => true]); $tableUser->addColumn('psychical_health_problems', 'string', ['null' => true]); + $tableUser->addColumn('printed_handbook', 'boolean', ['null' => true]); $tableUser->save(); } @@ -18,6 +19,7 @@ public function down(): void $tableUser = $this->table('participant'); $tableUser->removeColumn('medications'); $tableUser->removeColumn('psychical_health_problems'); + $tableUser->removeColumn('printed_handbook'); $tableUser->save(); } } diff --git a/src/Application/migrations/20231127201235_add_printed_handbook_switch.php b/src/Application/migrations/20231127201235_add_printed_handbook_switch.php deleted file mode 100644 index d347552e..00000000 --- a/src/Application/migrations/20231127201235_add_printed_handbook_switch.php +++ /dev/null @@ -1,22 +0,0 @@ -table('participant'); - $tableUser->addColumn('printed_handbook', 'string', ['null' => true]); - $tableUser->save(); - } - - public function down(): void - { - $tableUser = $this->table('participant'); - $tableUser->removeColumn('printed_handbook'); - $tableUser->save(); - } -} diff --git a/src/Event/AbstractContentArbiter.php b/src/Event/AbstractContentArbiter.php index ae1f553e..4736e8ca 100755 --- a/src/Event/AbstractContentArbiter.php +++ b/src/Event/AbstractContentArbiter.php @@ -19,7 +19,7 @@ abstract class AbstractContentArbiter public bool $birthDate = true; public bool $birthPlace = false; public bool $health = true; - public bool $medicaments = false; + public bool $medicaments = true; public bool $psychicalHealth = true; public bool $food = false; public bool $idNumber = false; diff --git a/src/Event/EventType/Obrok/EventTypeObrok.php b/src/Event/EventType/Obrok/EventTypeObrok.php index 0af59f7c..67f737ec 100644 --- a/src/Event/EventType/Obrok/EventTypeObrok.php +++ b/src/Event/EventType/Obrok/EventTypeObrok.php @@ -27,7 +27,7 @@ public function getContentArbiterIst(): ContentArbiterIst { $ca = parent::getContentArbiterIst(); $ca->tshirt = true; - + $ca->printedHandbook = true; return $ca; } @@ -38,8 +38,6 @@ public function getContentArbiterTroopLeader(): ContentArbiterTroopLeader $ca->phone = true; $ca->email = true; $ca->unit = true; - $ca->medicaments = true; - $ca->psychicalHealth = true; $ca->printedHandbook = true; return $ca; @@ -52,8 +50,6 @@ public function getContentArbiterTroopParticipant(): ContentArbiterTroopParticip $ca->phone = true; $ca->email = true; $ca->unit = true; - $ca->medicaments = true; - $ca->psychicalHealth = true; $ca->printedHandbook = true; return $ca; diff --git a/src/Participant/Participant.php b/src/Participant/Participant.php index 28064f29..fc1401f4 100755 --- a/src/Participant/Participant.php +++ b/src/Participant/Participant.php @@ -50,7 +50,7 @@ * @property string|null $skills * @property array|null $preferredPosition m:useMethods(getPreferredPosition|setPreferredPosition) * @property string|null $driversLicense - * @property string|null $printedHandbook + * @property boolean|null $printedHandbook * @property string|null $notes * @property DateTimeInterface|null $registrationCloseDate m:passThru(dateFromString|dateToString) * @property DateTimeInterface|null $registrationApproveDate m:passThru(dateFromString|dateToString) diff --git a/src/Participant/ParticipantService.php b/src/Participant/ParticipantService.php index 99960715..86d850cc 100755 --- a/src/Participant/ParticipantService.php +++ b/src/Participant/ParticipantService.php @@ -91,7 +91,7 @@ private function addParamsIntoPerson(array $params, Participant $p): Participant $preferredPosition = $params['preferredPosition'] ?? []; $p->preferredPosition = $preferredPosition; $p->driversLicense = $params['driversLicense'] ?? null; - $p->printedHandbook = $params['printedHandbook'] ?? null; + $p->printedHandbook = array_key_exists('printedhandbook', $params) ? true : NULL; $p->notes = $params['notes'] ?? null; return $p; diff --git a/src/Templates/cs.yaml b/src/Templates/cs.yaml index 11a4c915..6cb9bf87 100755 --- a/src/Templates/cs.yaml +++ b/src/Templates/cs.yaml @@ -135,6 +135,8 @@ detail: uploadFileMissing: "soubor zatím není nahraný :(" printedHandbook: "Tištěný handbook" printedHandbook-detail: "Chci na akci dostat vytištěný handbook" + handbook-yes: "ano" + handbook-no: "ne" notice: "Poznámky" notice-placeholder: "cokoli dalšího?" skills: "Dovednosti" diff --git a/src/Templates/en.yaml b/src/Templates/en.yaml index 7c647a1a..c3225499 100755 --- a/src/Templates/en.yaml +++ b/src/Templates/en.yaml @@ -136,6 +136,8 @@ detail: printedHandbook: "Paper Handbook" printedHandbook-detail: "I want to obtain paper printed event handbook" notice: "Notice" + handbook-yes: "yes" + handbook-no: "no" notice-placeholder: "anything else?" skills: "Skills" skills-placeholder: "sailing; food handling certificate; advanced first aid; ..." diff --git a/src/Templates/sk.yaml b/src/Templates/sk.yaml index 629197d3..1357376f 100644 --- a/src/Templates/sk.yaml +++ b/src/Templates/sk.yaml @@ -93,7 +93,11 @@ detail: foodOther: "iné - prosím upresni v poznámke" food-placeholder: "V prípade inej diéty, než sú uvedené vyššie, uved svou preferenciu v poznámke" issues: "Zdravotné údaje" - issues-placeholder: "pravidelne užívané lieky, prekonané operácie, závažné choroby, alergie - spúšťač, symptómy, podávané lieky..." + issues-placeholder: "prekonané operácie, závažné choroby, alergie - spúšťač, symptómy" + medicaments: "léky" + medicaments-placeholder: "pravidelně užívané léky" + psychicalIssues: "psychická onemocnění" + psychicalIssues-placeholder: "psychická onemocnění, jakékoliv psychické obtíže" language: "Ovládané jazyky + úroveň" language-placeholder: "např. angličtina B1, francouština C1, němčina pasivně" idNumber: "Číslo občianskeho preukazu/pasu" @@ -111,6 +115,10 @@ detail: uploadedFileSuccessful: "soubor úspěšně nahraný!" uploadedFileNote: "PDF s potvrzením najdeš na našem webu" uploadFileMissing: "soubor zatím není nahraný :(" + printedHandbook: "Tištěný handbook" + printedHandbook-detail: "Chci na akci dostat vytištěný handbook" + handbook-yes: "ano" + handbook-no: "ne" notice: "Poznámka" notice-placeholder: "ešte niečo?" skills: "Zručnosti" diff --git a/src/Templates/translatable/widgets/changeDetails.twig b/src/Templates/translatable/widgets/changeDetails.twig index ad500682..8d11e33b 100644 --- a/src/Templates/translatable/widgets/changeDetails.twig +++ b/src/Templates/translatable/widgets/changeDetails.twig @@ -463,7 +463,7 @@ type="checkbox" name="printedHandbook" value="yes" - {% if personDetails.getPrintedHandbook == 'yes' %} checked{% endif %} + {% if personDetails.getPrintedHandbook %} checked{% endif %} /> {% endif %}{% if ca.notes %} diff --git a/src/Templates/translatable/widgets/details.twig b/src/Templates/translatable/widgets/details.twig index 34d061bc..ef4e248a 100644 --- a/src/Templates/translatable/widgets/details.twig +++ b/src/Templates/translatable/widgets/details.twig @@ -89,7 +89,7 @@ {{ detail.uploadFileMissing|trans }} {% endif %}
{% endif %}{% if ca.printedHandbook %} - {% trans %}detail.printedHandbook{% endtrans %}:{{ person.getPrintedHandbook ?? 'no' }}
+ {% trans %}detail.printedHandbook{% endtrans %}:{{ (person.getPrintedHandbook ? detail.handbook-yes : detail.handbook-no)|trans }}
{% endif %}{% if ca.notes %} {% trans %}detail.notice{% endtrans %}: {{ person.getNotes }}
{% endif %}