]> _ Git - fluidbook-v3.git/commitdiff
fix #3393 @0.25
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 10 Apr 2020 08:12:27 +0000 (08:12 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 10 Apr 2020 08:12:27 +0000 (08:12 +0000)
framework/application/controllers/AjaxController.php
framework/application/controllers/IndexController.php

index 63651f85a812273339246032b1eab28f33d79a0c..af668d1d693eabf41cc669df39f592d6b51ce4bb 100644 (file)
@@ -1,45 +1,51 @@
 <?php
 
-class AjaxController extends CubeIT_Controller_AjaxController {
-
-       public function requestQuote($formID = null) {
-               $form = new Fluidbook_Form_RequestQuote();
-
-               // Take form ID from URL so we can differentiate between the popup and the embedded versions of the form
-               if ($formID) {
-                       $form->setId($formID);
-                       $form->setAction($form->getAction() . '/' . $formID);
-               } else {
-                       $formID = $form->getId();
-               }
-
-               if ($form->isValid($_POST)) {
-                       $url = 'https://workshop.fluidbook.com/ajax/demandeDevis?devis_form=' . base64_encode(json_encode($_POST));
-                       $xml = simplexml_load_file($url);
-                       $xml_alert = $xml->xpath('//alert');
-
-                       $okmessage = array_pop($xml_alert);
-                       if (null !== $okmessage) {
-                               $okmessage = (string)$okmessage->content;
-                       }
-
-                       // If we're processing the popup form, the success message will replace the whole section including the text
+class AjaxController extends CubeIT_Controller_AjaxController
+{
+
+    public function requestQuote($formID = null)
+    {
+        $form = new Fluidbook_Form_RequestQuote();
+
+        // Take form ID from URL so we can differentiate between the popup and the embedded versions of the form
+        if ($formID) {
+            $form->setId($formID);
+            $form->setAction($form->getAction() . '/' . $formID);
+        } else {
+            $formID = $form->getId();
+        }
+
+        if ($form->isValid($_POST)) {
+            $data = $_POST;
+            if (isset(Bootstrap::getInstance()->getSession()->gclid)) {
+                $data['gclid'] = Bootstrap::getInstance()->getSession()->gclid;
+            }
+            $url = 'https://workshop.fluidbook.com/ajax/demandeDevis?devis_form=' . base64_encode(json_encode($data));
+            $xml = simplexml_load_file($url);
+            $xml_alert = $xml->xpath('//alert');
+
+            $okmessage = array_pop($xml_alert);
+            if (null !== $okmessage) {
+                $okmessage = (string)$okmessage->content;
+            }
+
+            // If we're processing the popup form, the success message will replace the whole section including the text
             // Otherwise, just the form itself is replaced.
-                       if ($formID == 'requestQuotePopup') {
-                           // Todo: work out why CSS isn't taking effect (see #confirmationQuote in 315-quote.less) - using inline CSS for now.
+            if ($formID == 'requestQuotePopup') {
+                // Todo: work out why CSS isn't taking effect (see #confirmationQuote in 315-quote.less) - using inline CSS for now.
                 // Todo: see issue https://team.cubedesigners.com/redmine/issues/737 for possible cause
-                $this->_datas->addReplace('#' . $formID .'Wrapper', '<div id="confirmationQuote" style="background-color:#fff">' . $okmessage . '</div>');
+                $this->_datas->addReplace('#' . $formID . 'Wrapper', '<div id="confirmationQuote" style="background-color:#fff">' . $okmessage . '</div>');
             } else {
                 $this->_datas->addReplace('#' . $formID, '<div id="confirmationQuote">' . $okmessage . '</div>');
             }
 
-                       $this->_datas->addGAEvent('form', 'sent', 'quote');
-               } else {
-                       $this->_datas->refreshForm($form); // Respond with validation errors
-                       $this->_datas->addAction('eval', "displayErrors('$formID')");
-                       $this->_datas->addGAEvent('form', 'error', 'quote');
-               }
+            $this->_datas->addGAEvent('form', 'sent', 'quote');
+        } else {
+            $this->_datas->refreshForm($form); // Respond with validation errors
+            $this->_datas->addAction('eval', "displayErrors('$formID')");
+            $this->_datas->addGAEvent('form', 'error', 'quote');
+        }
 
-       }
+    }
 
 }
index d4df5311020553dadfecd5af7a3a490b7f6d1b15..86dcaf7592c7de0ab8163fa9199bb6e0be1b74da 100644 (file)
@@ -1,6 +1,14 @@
 <?php
 
-class IndexController extends CubeIT_Controller_IndexController {
-       
+class IndexController extends CubeIT_Controller_IndexController
+{
+    public function init()
+    {
+        if (isset($_GET['gclid'])) {
+            Bootstrap::getInstance()->getSession()->gclid = $_GET['gclid'];
+        }
+        parent::init(); // TODO: Change the autogenerated stub
+
+    }
 }