Fix can reset filter in setup

This commit is contained in:
Laurent Destailleur 2021-09-14 17:24:53 +02:00
parent aeead15a62
commit 21462d0b82
3 changed files with 18 additions and 12 deletions

View File

@ -264,7 +264,7 @@ if ($action == 'edit') {
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany = new FormCompany($db);
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname);
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname, 'customerorprospect', 'form', '', 1);
} elseif ($val['type'] == 'securekey') {
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">';
if (!empty($conf->use_javascript_ajax)) {

View File

@ -998,16 +998,16 @@ class FormCompany extends Form
/**
* Return a HTML select for thirdparty type
*
* @param int $selected selected value
* @param string $htmlname HTML select name
* @param string $htmlidname HTML select id
* @param string $typeinput HTML output
* @param string $morecss More css
* @return string HTML string
* @param int $selected Selected value
* @param string $htmlname HTML select name
* @param string $htmlidname HTML select id
* @param string $typeinput HTML output
* @param string $morecss More css
* @param string $allowempty Allow empty value or not
* @return string HTML string
*/
public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '')
public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '', $allowempty = '')
{
global $conf, $langs;
if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->fournisseur->enabled)) {
return '' ;
@ -1015,8 +1015,14 @@ class FormCompany extends Form
$out = '<select class="flat '.$morecss.'" name="'.$htmlname.'" id="'.$htmlidname.'">';
if ($typeinput == 'form') {
if ($selected == '' || $selected == '-1') {
$out .= '<option value="-1">&nbsp;</option>';
if ($allowempty || ($selected == '' || $selected == '-1')) {
$out .= '<option value="-1">';
if (is_numeric($allowempty)) {
$out .= '&nbsp;';
} else {
$out .= $langs->trans($allowempty);
}
$out .= '</option>';
}
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
$out .= '<option value="2"'.($selected == 2 ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';

View File

@ -197,7 +197,7 @@ class ConferenceOrBoothAttendee extends CommonObject
if (!empty($conf->global->EVENTORGANIZATION_FILTERATTENDEES_CAT)) {
$this->fields['fk_soc']['type'] .= ' AND rowid IN (SELECT DISTINCT c.fk_soc FROM '.MAIN_DB_PREFIX.'categorie_societe as c WHERE c.fk_categorie='.(int) $conf->global->EVENTORGANIZATION_FILTERATTENDEES_CAT.')';
}
if ($conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE!=='') {
if ($conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE !== '') {
$this->fields['fk_soc']['type'] .= ' AND client='.(int) $conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE;
}