Merge pull request #36607 from Boushabazakaria/fix/filter-closed-thirdparty-contacts

FIX|Fix Exclude closed third parties from contacts selection
This commit is contained in:
Laurent Destailleur 2025-12-11 03:18:14 +01:00 committed by GitHub
commit 48d3b2d953
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -747,7 +747,8 @@ class FormCompany extends Form
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
}
$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
// Filter on active third parties only (status = 1) Closed third parties must not be selectable
$sql .= " WHERE s.entity IN (" . getEntity('societe') . ") AND s.status = 1";
// For ajax search we limit here. For combo list, we limit later
if (is_array($limitto) && count($limitto)) {
$sql .= " AND s.rowid IN (" . $this->db->sanitize(implode(',', $limitto)) . ")";

View file

@ -108,7 +108,8 @@ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as dictp ON dictp.rowid = s.fk_pays";
}
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
// Filter on active third parties only (status = 1) Closed third parties must not be selectable
$sql .= " WHERE s.entity IN (".getEntity('societe').") AND s.status = 1";
if ($socid) {
$sql .= " AND (";
// Add criteria on name/code