From 9b7b253e21307ab5c2b19e694b47dd07bae5adb6 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Tue, 29 Oct 2024 15:24:00 +0000 Subject: [PATCH] fix clicking through from search result with a postcode --- classes/AlertView/Standard.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/classes/AlertView/Standard.php b/classes/AlertView/Standard.php index 39ce877547..3bc26b7893 100644 --- a/classes/AlertView/Standard.php +++ b/classes/AlertView/Standard.php @@ -142,6 +142,8 @@ private function getBasicData() { $this->data['this_step'] = trim(get_http_var("this_step")); $this->data['shown_related'] = get_http_var('shown_related'); $this->data['match_all'] = get_http_var('match_all') == 'on'; + $this->data['keyword'] = trim(get_http_var("keyword")); + $this->data['search_section'] = ''; if ($this->data['addword'] || $this->data['step']) { $alert = $this->alert->check_token($this->data['token']); @@ -219,9 +221,6 @@ private function getBasicData() { $this->data['results'] = ''; $this->getSearchSections(); - } else { - $this->data['keyword'] = trim(get_http_var("keyword")); - $this->data['search_section'] = ''; } $this->data['pid'] = trim(get_http_var("pid")); @@ -235,6 +234,7 @@ private function getBasicData() { $ACTIONURL = new \MySociety\TheyWorkForYou\Url($this_page); $ACTIONURL->reset(); $this->data['actionurl'] = $ACTIONURL->generate(); + } private function wrap_phrase_in_quotes($phrase) { @@ -560,8 +560,12 @@ protected function setUserData() { $this->data['keyword_alerts'][] = $alert; } } + } else { + if ($this->data['pc']) { + $this->data['step'] = 'mp_alert'; + } } - if ($this->data['addword'] != '' || ($this->data['step'] && count($this->data['errors']) > 0)) { + if ($this->data['addword'] != '' || ($this->data['step'] && $this->data['step'] != 'mp_alert' && count($this->data['errors']) > 0)) { $this->data["step"] = get_http_var('this_step'); } else { $this->data['this_step'] = '';