diff --git a/load_search.php b/load_search.php index 5ec2393b81..20996bd898 100644 --- a/load_search.php +++ b/load_search.php @@ -294,16 +294,11 @@ $domaine1 = $form->getElementByName('extra_domaine[0]'); $domaine2 = $form->getElementByName('extra_domaine[1]'); $domaine3 = $form->getElementByName('extra_domaine[2]'); $userForm->setDefaults($defaults); -$domainList = []; -if ($domaine1) { - $domainList[] = $domaine1->getValue(); -} -if ($domaine2) { - $domainList[] = $domaine2->getValue(); -} -if ($domaine3) { - $domainList[] = $domaine3->getValue(); -} +$domainList = array_merge( + $domaine1->getValue(), + $domaine3->getValue(), + $domaine2->getValue() +); $themeList = []; $extraField = new ExtraField('session'); $resultOptions = $extraField->searchOptionsFromTags('extra_domaine', 'extra_'.$theme, $domainList); diff --git a/search.php b/search.php index 1f2c727d87..d7594f4ee9 100644 --- a/search.php +++ b/search.php @@ -41,8 +41,8 @@ $diagnosisComplete = $extraFieldValue->get_values_by_handler_and_field_variable( if ($diagnosisComplete && isset($diagnosisComplete['value']) && $diagnosisComplete['value'] == 1) { if (!isset($_GET['result'])) { - header('Location:'.api_get_self().'?result=1'); - exit; + //header('Location:'.api_get_self().'?result=1'); + //exit; } } @@ -530,25 +530,26 @@ $(document).ready(function(){ '; $userForm->addButtonSave(get_lang('Save')); +$userForm->setDefaults($defaults); /** @var HTML_QuickForm_select $element */ -$domaine1 = $form->getElementByName('extra_domaine[0]'); -$domaine2 = $form->getElementByName('extra_domaine[1]'); -$domaine3 = $form->getElementByName('extra_domaine[2]'); -$userForm->setDefaults($defaults); -$domainList = []; -if ($domaine1) { - $domainList[] = $domaine1->getValue(); -} -if ($domaine2) { - $domainList[] = $domaine2->getValue(); -} -if ($domaine3) { - $domainList[] = $domaine3->getValue(); -} +$domaine1 = $userForm->getElementByName('extra_domaine[0]'); +$domaine2 = $userForm->getElementByName('extra_domaine[1]'); +$domaine3 = $userForm->getElementByName('extra_domaine[2]'); + +$domainList = array_merge( + $domaine1->getValue(), + $domaine3->getValue(), + $domaine2->getValue() +); + $themeList = []; $extraField = new ExtraField('session'); -$resultOptions = $extraField->searchOptionsFromTags('extra_domaine', 'extra_'.$theme, $domainList); +$resultOptions = $extraField->searchOptionsFromTags( + 'extra_domaine', + 'extra_'.$theme, + $domainList +); if ($resultOptions) { $resultOptions = array_column($resultOptions, 'tag', 'id'); @@ -556,7 +557,7 @@ if ($resultOptions) { for ($i = 0; $i < 5; $i++) { /** @var HTML_QuickForm_select $theme */ - $themeElement = $form->getElementByName('extra_'.$theme.'['.$i.']'); + $themeElement = $userForm->getElementByName('extra_'.$theme.'['.$i.']'); foreach ($resultOptions as $key => $value) { $themeElement->addOption($value, $value); }