]> _ Git - pmi.git/commitdiff
wait #6410 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 16 Oct 2023 12:10:18 +0000 (14:10 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 16 Oct 2023 12:10:18 +0000 (14:10 +0200)
app/Http/Controllers/AjaxController.php

index 8de68ade5a241c6e1433b8ad3494724004c0aef2..a181533e2b4d0ac5994d7157aa2a31dedf120c94 100644 (file)
@@ -25,6 +25,7 @@ use Illuminate\Support\Facades\Validator;
 use Illuminate\Support\Facades\Hash;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\HtmlString;
+use function Symfony\Component\String\s;
 
 class AjaxController extends CubistFrontController
 {
@@ -39,8 +40,9 @@ class AjaxController extends CubistFrontController
         'ref' => 'Reference',
         'phone' => 'Téléphone',
         'email' => 'Adresse e-mail',
+        'subject' => 'Sujet',
         'message' => 'Message',
-        'subject' => 'Sujet'];
+    ];
 
     // Shared validation logic for dynamic CMS forms
 
@@ -143,17 +145,13 @@ class AjaxController extends CubistFrontController
                 }
             }
 
-            dd($page);
-
             $subject = '';
-            if ($page->form_prefix) {
+            if ($page->get('form_prefix')) {
                 $subject .= '[';
-                $subject .= $subject_ ?? $page->form_prefix;
+                $subject .= $page->form_prefix;
                 $subject .= '] ';
-            } else {
-                if ($subject_) {
-                    $subject .= '[' . $subject_ . '] ';
-                }
+            } else if ($subject_) {
+                $subject .= '[' . $subject_ . '] ';
             }
 
             if ($subject_ === "Nouvelle commande") {
@@ -546,7 +544,7 @@ class AjaxController extends CubistFrontController
         $data = $this->validation_form($request, $validation);
         $page = Page::find($request['page'])->getPageData();
 
-        if($data['vat']) {
+        if ($data['vat']) {
             if (!strstr($data['vat'], $data['siren']) || substr($data['vat'], '-9') !== $data['siren']) {
                 throw ValidationException::withMessages(['siren' => __('Le numero de siren est incorrect')]);
             }