diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 000f14ee59f05c10930424d271aa161d56a0485f..4a03afcbb4b80c1b8ad28da6868293d4e97f819f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -681,6 +681,7 @@ class Form if (! empty($user->societe_id)) $sql.= " AND s.rowid = ".$user->societe_id; if ($filter) $sql.= " AND (".$filter.")"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if (! empty($conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND s.status<>0 "; $sql.= " ORDER BY nom ASC"; dol_syslog(get_class($this)."::select_company sql=".$sql); diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 6bb15f60a38d7c1f25a8877081836caab3f0a3da..9c122e43280b6ba9dc67bfa6cc5c94c7a3f8a511 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -116,6 +116,13 @@ class modSociete extends DolibarrModules $this->const[$r][4] = 0; $r++; + $this->const[$r][0] = "COMPANY_HIDE_INACTIVE_IN_COMBOBOX"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "0"; + $this->const[$r][3] = "hide thirdparty customer inative in combobox"; + $this->const[$r][4] = 0; + $r++; + // Boxes $this->boxes = array(); $r=0; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f13698ad1a114e22d0d8b519f9681e62eed3b41d..cac27722e610da3fae4b30c8be77111b77a6b77a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -53,6 +53,7 @@ ConfirmAjax=Use Ajax confirmation popups UseSearchToSelectCompany=Use autocompletion fields to choose third parties (instead of using a list box).<br><br>Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant SOCIETE_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. ActivityStateToSelectCompany= Add a filter option to show/hide thirdparties which are currently in activity or has ceased it UseSearchToSelectContact=Use autocompletion fields to choose contact (instead of using a list box).<br><br>Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant CONTACT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. +HideClosedThirdpartyComboBox=Hide Third party with Status to Closed into customer select list (or combobox) SearchFilter=Search filters options NumberOfKeyToSearch=Nbr of characters to trigger search: %s ViewFullDateActions=Show full dates events in the third sheet diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 4bb7b8335960a1eb1fe16f2e587a66e95b0a1d36..29333762881b55bb8d2c4bce67c4ed9d8e2c1f48 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -52,6 +52,7 @@ ConfirmAjax= Utiliser les popups de confirmation Ajax UseSearchToSelectCompany= Utiliser un champ avec autocomplétion pour choisir un tiers (plutôt qu'une liste déroulante).<br><br>Notez que si vous avez un nombre important de tiers (> 100 000), vous pouvez améliorer les performances en définissant la constante SOCIETE_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine. ActivityStateToSelectCompany= Ajouter une option de filtrage lors des recherches pour afficher/masquer les tiers en exercice ou ayant cessés d'exercer UseSearchToSelectContact= Utiliser un champ avec autocomplétion pour choisir un contact (plutôt qu'une liste déroulante).<br><br>Notez que si vous avez un nombre important de contacts (> 100 000), vous pouvez améliorer les performances en définissant la constante CONTACT_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine. +HideClosedThirdpartyComboBox=Ne pas afficher les clients à l'état "Clos" dans les listes déroulantes (ou champ avec autocomplétion) SearchFilter=Options des filtres de recherche NumberOfKeyToSearch=Nb carac. déclenchant recherche: %s ViewFullDateActions= Visualiser les dates des actions en entier dans la fiche tiers diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index c8dcbb5d7f2bf7600eb64ff2737cf74c23fca7d9..85768ba5c8cbd088ad7a6d301be56c4dbc733fca 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -245,6 +245,22 @@ if ($action == 'setprofidinvoicemandatory') } } +//Set hide closed customer into combox or select +if ($action == 'sethideinactivethirdparty') +{ + $status = GETPOST('status','alpha'); + + if (dolibarr_set_const($db, "COMPANY_HIDE_INACTIVE_IN_COMBOBOX",$status,'chaine',0,'',$conf->entity) > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } +} + /* * View */ @@ -728,6 +744,27 @@ else print "</td>"; } print '</tr>'; + + +// COMPANY_USE_SEARCH_TO_SELECT +$var=!$var; +print "<tr ".$bc[$var].">"; +print '<td width="80%">'.$langs->trans("HideClosedThirdpartyComboBox").'</td>'; +if (! empty($conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) +{ + print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=sethideinactivethirdparty&status=0">'; + print img_picto($langs->trans("Activated"),'switch_on'); + print '</a></td>'; +} +else +{ + print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=sethideinactivethirdparty&status=1">'; + print img_picto($langs->trans("Disabled"),'switch_off'); + print '</a></td>'; +} +print '</tr>'; + + print '</table>';