diff options
| author | Greg Roach <fisharebest@gmail.com> | 2016-01-15 17:10:34 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2016-01-15 17:10:34 +0000 |
| commit | 0dd3afd33cb8f585432c84a25afb75cdb1117ba1 (patch) | |
| tree | 2432f0b713e3be53b145fa35a9a1c81eeab421bb /app/Controller | |
| parent | 622637a34bcb43444615f6adcb51ce141b457144 (diff) | |
| download | webtrees-0dd3afd33cb8f585432c84a25afb75cdb1117ba1.tar.gz webtrees-0dd3afd33cb8f585432c84a25afb75cdb1117ba1.tar.bz2 webtrees-0dd3afd33cb8f585432c84a25afb75cdb1117ba1.zip | |
Fix #801 - search/replace with one result
Diffstat (limited to 'app/Controller')
| -rw-r--r-- | app/Controller/SearchController.php | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/app/Controller/SearchController.php b/app/Controller/SearchController.php index 2a3226567a..831a9bb636 100644 --- a/app/Controller/SearchController.php +++ b/app/Controller/SearchController.php @@ -261,34 +261,36 @@ class SearchController extends PageController { $this->mynotelist = FunctionsDb::searchNotes($query_terms, $this->search_trees); } - // If only 1 item is returned, automatically forward to that item - // If ID cannot be displayed, continue to the search page. - if (count($this->myindilist) == 1 && !$this->myfamlist && !$this->mysourcelist && !$this->mynotelist) { - $indi = reset($this->myindilist); - if ($indi->canShowName()) { - header('Location: ' . WT_BASE_URL . $indi->getRawUrl()); - exit; + if ($this->action === 'general') { + // If only 1 item is returned, automatically forward to that item + // If ID cannot be displayed, continue to the search page. + if (count($this->myindilist) == 1 && !$this->myfamlist && !$this->mysourcelist && !$this->mynotelist) { + $indi = reset($this->myindilist); + if ($indi->canShowName()) { + header('Location: ' . WT_BASE_URL . $indi->getRawUrl()); + exit; + } } - } - if (!$this->myindilist && count($this->myfamlist) == 1 && !$this->mysourcelist && !$this->mynotelist) { - $fam = reset($this->myfamlist); - if ($fam->canShowName()) { - header('Location: ' . WT_BASE_URL . $fam->getRawUrl()); - exit; + if (!$this->myindilist && count($this->myfamlist) == 1 && !$this->mysourcelist && !$this->mynotelist) { + $fam = reset($this->myfamlist); + if ($fam->canShowName()) { + header('Location: ' . WT_BASE_URL . $fam->getRawUrl()); + exit; + } } - } - if (!$this->myindilist && !$this->myfamlist && count($this->mysourcelist) == 1 && !$this->mynotelist) { - $sour = reset($this->mysourcelist); - if ($sour->canShowName()) { - header('Location: ' . WT_BASE_URL . $sour->getRawUrl()); - exit; + if (!$this->myindilist && !$this->myfamlist && count($this->mysourcelist) == 1 && !$this->mynotelist) { + $sour = reset($this->mysourcelist); + if ($sour->canShowName()) { + header('Location: ' . WT_BASE_URL . $sour->getRawUrl()); + exit; + } } - } - if (!$this->myindilist && !$this->myfamlist && !$this->mysourcelist && count($this->mynotelist) == 1) { - $note = reset($this->mynotelist); - if ($note->canShowName()) { - header('Location: ' . WT_BASE_URL . $note->getRawUrl()); - exit; + if (!$this->myindilist && !$this->myfamlist && !$this->mysourcelist && count($this->mynotelist) == 1) { + $note = reset($this->mynotelist); + if ($note->canShowName()) { + header('Location: ' . WT_BASE_URL . $note->getRawUrl()); + exit; + } } } } |
