From dfef8d7acff62304ed94dce1f24d4cc480729401 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 27 Jan 2017 10:53:12 -0500 Subject: [PATCH] Update form to fix the arrival and departure dates. They weren't being put into email correctly. Also update the top form so it hold the arrival departure and numbers. --- Toolkit/Page.php | 17 +++++++++++++++-- index.php | 2 ++ priceQuoteForm.inc | 29 +++++++++++++++++++++++------ templates/template.html | 20 ++++++++++++++------ 4 files changed, 54 insertions(+), 14 deletions(-) diff --git a/Toolkit/Page.php b/Toolkit/Page.php index 8456ea2..172bb6c 100755 --- a/Toolkit/Page.php +++ b/Toolkit/Page.php @@ -416,8 +416,21 @@ class Toolkit_Page public function fetchPage() { $nextWeek = mktime(0, 0, 0, date('m'), date('d') + 7, date('Y')); - $this->arrivalDate = date('m').'/'.date('d').'/'.date('Y'); - $this->departureDate = date('m', $nextWeek).'/'.date('d', $nextWeek).'/'.date('Y', $nextWeek); + $this->arrivalDate + = ($_SESSION['bfForm']['arrival']) + ? $_SESSION['bfForm']['arrival']['m'].'/'.$_SESSION['bfForm']['arrival']['d'].'/'.$_SESSION['bfForm']['arrival']['Y'] + : date('m').'/'.date('d').'/'.date('Y'); + $this->departureDate + = ($_SESSION['bfForm']['departure']) + ? $_SESSION['bfForm']['departure']['m'].'/'.$_SESSION['bfForm']['departure']['d'].'/'.$_SESSION['bfForm']['departure']['Y'] + : date('m', $nextWeek).'/'.date('d', $nextWeek).'/'.date('Y', $nextWeek); + $this->golfers = ($_SESSION['bfForm']['golfers']) + ? $_SESSION['bfForm']['golfers'] + : ''; + $this->nongolfers = ($_SESSION['bfForm']['nongolfers']) + ? $_SESSION['bfForm']['golfers'] + : ''; + if (defined('MEMBERS_DB') && MEMBERS_DB) { // check to see if this page is a member only page $memberOnlyPage = Toolkit_Template_Page::isMemberOnly( diff --git a/index.php b/index.php index a9fd406..366df68 100644 --- a/index.php +++ b/index.php @@ -75,6 +75,8 @@ if ($catid == ORDER_FORM_PAGE) { = $_POST['departure']; $_SESSION['bfForm']['departure'] = $_POST['departure']; } + $_SESSION['bfForm']['golfers'] = $_POST['golfers']; + $_SESSION['bfForm']['nongolfers'] = $_POST['nongolfers']; } } include 'priceQuoteForm.inc'; diff --git a/priceQuoteForm.inc b/priceQuoteForm.inc index 9c0e4b2..551976f 100644 --- a/priceQuoteForm.inc +++ b/priceQuoteForm.inc @@ -334,8 +334,16 @@ class PageFourth extends PageBase $GLOBALS['styleSheets'][] = MEDIA_BASE_URL . 'css/orderForm.css'; $this->_formBuilt = true; - $arrival = $this->controller->exportValue('page1', 'arrival'); - $departure = $this->controller->exportValue('page1', 'departure'); + //$arrival = $this->controller->exportValue('page1', 'arrival'); + //$departure = $this->controller->exportValue('page1', 'departure'); + + $arrival = ($_SESSION['bfForm']['arrival']) + ? $_SESSION['bfForm']['arrival'] + : $page->controller->exportValue('page1', 'arrival'); + $departure = ($_SESSION['bfForm']['departure']) + ? $_SESSION['bfForm']['departure'] + : $page->controller->exportValue('page1', 'departure'); + list($arrivalMonth, $arrivalDay, $arrivalYear) = array_values($arrival); list($departureMonth, $departureDay, $departureYear) = array_values($departure); @@ -510,7 +518,12 @@ class ActionProcess extends HTML_QuickForm_Action private function _getEntireForm(&$page) { $values = $page->controller->exportValues(); -// $return .= print_r($values, true); + $values['arrival'] = ($_SESSION['bfForm']['arrival']) + ? $_SESSION['bfForm']['arrival'] + : $page->controller->exportValue('page1', 'arrival'); + $values['departure'] = ($_SESSION['bfForm']['departure']) + ? $_SESSION['bfForm']['departure'] + : $page->controller->exportValue('page1', 'departure'); unset($temp); unset($renderer); $rmvElements = array( @@ -526,7 +539,6 @@ class ActionProcess extends HTML_QuickForm_Action $back = $temp->getButtonName('back'); $next = $temp->getButtonName('next'); $temp->buildForm(); -// $return .= print_r($temp, true); if ($temp->elementExists($back)) { $temp->removeElement($back); } @@ -575,6 +587,12 @@ class ActionProcess extends HTML_QuickForm_Action private function _process(&$page, $email) { $values = $page->controller->exportValues(); + $values['arrival'] = ($_SESSION['bfForm']['arrival']) + ? $_SESSION['bfForm']['arrival'] + : $page->controller->exportValue('page1', 'arrival'); + $values['departure'] = ($_SESSION['bfForm']['departure']) + ? $_SESSION['bfForm']['departure'] + : $page->controller->exportValue('page1', 'departure'); try { $dbh = Toolkit_Database::getInstance(); $dbh->beginTransaction(); @@ -741,6 +759,7 @@ class ActionProcess extends HTML_QuickForm_Action // } $dbh->commit(); + unset($_SESSION['bfForm']); if ($values['lodging'] === 'Trout Creek Condominiums') { $toEmail = TROUT_CREEK_EMAILS; @@ -778,8 +797,6 @@ class ActionProcess extends HTML_QuickForm_Action echo 'Error: ' . $e->getMessage() . '
'; echo 'File: ' . $e->getFile() . '
'; echo 'Line: ' . $e->getLine() . '
'; -// echo 'PDO::errorInfo():
' . print_r($dbh->errorInfo(), true) . '

'; -// echo 'TraceAsString:
' . print_r($e->getTrace(), true) . '

'; return false; } return false; diff --git a/templates/template.html b/templates/template.html index 56e015d..2f3aa47 100755 --- a/templates/template.html +++ b/templates/template.html @@ -34,14 +34,22 @@ -- 2.17.1