From de2bf199a8d1bd642ae43d23a5f3b6fc650f049e Mon Sep 17 00:00:00 2001 From: Stephen Cameron Date: Tue, 27 Oct 2020 18:48:43 +0100 Subject: [PATCH] WIP #3462 @1.75 --- wp-content/mu-plugins/cube/src/Forms/Base.php | 4 ++++ wp-content/mu-plugins/cube/src/Forms/Consultation.php | 11 +++++++++-- .../CCV/resources/views/forms/consultation.blade.php | 10 +++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/wp-content/mu-plugins/cube/src/Forms/Base.php b/wp-content/mu-plugins/cube/src/Forms/Base.php index 45c58a3..0bf5a88 100644 --- a/wp-content/mu-plugins/cube/src/Forms/Base.php +++ b/wp-content/mu-plugins/cube/src/Forms/Base.php @@ -288,6 +288,10 @@ class Base return $default; } + public function set_data($name, $value) { + $this->data[$name] = $value; + } + public function get_destination() { return $this->destination; } diff --git a/wp-content/mu-plugins/cube/src/Forms/Consultation.php b/wp-content/mu-plugins/cube/src/Forms/Consultation.php index 3b8b409..7a16b3d 100644 --- a/wp-content/mu-plugins/cube/src/Forms/Consultation.php +++ b/wp-content/mu-plugins/cube/src/Forms/Consultation.php @@ -51,7 +51,7 @@ class Consultation extends Base Textarea::field('message', __('Avez vous un message (ou une demande) spécifique à nous formuler ?', 'ccv'))->required(false), // Special field: if a surgeon is selected, their e-mail address will be override the default delivery address - Select::field('surgeon', __('Chirurgien spécifique')) + Select::field('surgeon', __('Chirurgien spécifique', 'ccv')) ->required(false) ->options([ 'Dr Guilhaume GENESTE' => 'dr.geneste@ccv-montpellier.fr', @@ -123,9 +123,16 @@ class Consultation extends Base public function pre_process() { + // Due to the complexity of the "Imagery" section of the form, there's no validation on these fields + // so it's possible to submit the form without ever selecting an imagery-type. In this case, we update + // the field value so it is clear to CCV that the client never filled out this section... + if (empty($this->get_data('imagery-type'))) { + $this->set_data('imagery-type', __('Aucune image envoyée', 'ccv')); + } + // If the user didn't select the NAS upload option, there's no point including the NAS ID in the form data // NOTE: This relies on the value of the field so make sure it is always the same in both places (consultation.blade.php) - if ($this->get_data('imagery-type') !== __('Images téléversées depuis portable')) { + if ($this->get_data('imagery-type') !== __('Images téléversées depuis portable', 'ccv')) { $this->remove_field('imagery-phone-token'); } diff --git a/wp-content/themes/CCV/resources/views/forms/consultation.blade.php b/wp-content/themes/CCV/resources/views/forms/consultation.blade.php index 516231a..2ecce5f 100644 --- a/wp-content/themes/CCV/resources/views/forms/consultation.blade.php +++ b/wp-content/themes/CCV/resources/views/forms/consultation.blade.php @@ -127,7 +127,7 @@ {{-- IMAGES FROM CD --}}
- +
@@ -197,7 +197,7 @@ {!! $form->input('imagery-phone-token') !!} {{-- ### NOTE: when this option isn't selected, the 'imagery-phone-token' field will be removed from the form --}} {{-- This field is matched based on the value of the translated text below, so make sure to update Consultation::pre_process() too --}} - +
{{-- IMAGES SENT BY POST --}}
- +
@@ -283,7 +283,7 @@
-- 2.39.5