diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 59bea619be2b5..485e1a3cc1009 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -286,7 +286,8 @@ } }*/ -if (!$user->hasRight('societe', 'client', 'voir')) { +// Check only if it's an internal user +if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 29225c9e178d7..c48e14971de6d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -304,7 +304,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); '@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan -if (!$user->hasRight('societe', 'client', 'voir')) { +// Check only if it's an internal user +if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 382a69e0e2a03..7616d21227f3e 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -217,7 +217,8 @@ $error = 0; -if (!$user->hasRight('societe', 'client', 'voir')) { +// Check only if it's an internal user +if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } @@ -511,6 +512,7 @@ } $tva_tx = $lines[$i]->tva_tx; + // @phan-suppress-next-line PhanTypeMismatchArgumentInternal if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', (string) $tva_tx)) { $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c4aada9dd7cea..a7d7df70c2551 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1339,6 +1339,7 @@ } $tva_tx = $lines[$i]->tva_tx; + // @phan-suppress-next-line PhanTypeMismatchArgumentInternal if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', (string) $tva_tx)) { $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; } diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index e6597b29ce3e5..c7e10e2317c60 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -226,7 +226,8 @@ accessforbidden(); } -if (!$user->hasRight('societe', 'client', 'voir')) { +// Check only if it' an internal user +if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } @@ -307,7 +308,6 @@ $search_categ_sup = 0; $filter = ''; $option = ''; - $socid = ""; } // Mass actions diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index cbf4e637cbac3..b00bb69b3fb1a 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1388,7 +1388,7 @@ function formatCustomerSelection (selection) { if (getDolGlobalString('THIRDPARTY_SUPPLIER_BY_DEFAULT')) { $default = 1; } - print $form->selectyesno("fournisseur", ((GETPOST("type") == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type") == '' ? 1 : 0), 1); + print $form->selectyesno("fournisseur", (GETPOSTINT('fournisseur') > 0 ? GETPOSTINT('fournisseur') : (GETPOST("type") == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type") == '' ? 1 : 0), 1); print ''; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 6622a28fec3ec..3e8b03d3d2256 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -65,8 +65,8 @@ $search_user = GETPOST('search_user', 'intcomma'); $search_sale = GETPOST('search_sale', 'intcomma'); $search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); -$search_societe = GETPOST('search_societe', 'alpha'); -$search_societe_alias = GETPOST('search_societe_alias', 'alpha'); +$search_company = GETPOST('search_company', 'alpha'); +$search_company_alias = GETPOST('search_company_alias', 'alpha'); $search_login = GETPOST('search_login', 'alpha'); $search_town = GETPOST('search_town', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha'); @@ -198,7 +198,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); '@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan -if (!$user->hasRight('societe', 'client', 'voir')) { +// Check only if it's an internal user +if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } @@ -236,8 +237,8 @@ $search_user = ''; $search_sale = ''; $search_ref = ''; - $search_societe = ''; - $search_societe_alias = ''; + $search_company = ''; + $search_company_alias = ''; $search_montant_ht = ''; $search_montant_vat = ''; $search_montant_ttc = ''; @@ -294,6 +295,14 @@ $now = dol_now(); +if ($socid > 0) { + $soc = new Societe($db); + $soc->fetch($socid); + if (empty($search_company)) { + $search_company = $soc->name; + } +} + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields @@ -362,14 +371,14 @@ if ($search_ref) { $sql .= natural_search('sp.ref', $search_ref); } -if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) { - $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe); +if (empty($arrayfields['s.name_alias']['checked']) && $search_company) { + $sql .= natural_search(array("s.nom", "s.name_alias"), $search_company); } else { - if ($search_societe) { - $sql .= natural_search('s.nom', $search_societe); + if ($search_company) { + $sql .= natural_search('s.nom', $search_company); } - if ($search_societe_alias) { - $sql .= natural_search('s.name_alias', $search_societe_alias); + if ($search_company_alias) { + $sql .= natural_search('s.name_alias', $search_company_alias); } } if ($search_login) { @@ -571,11 +580,11 @@ if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } - if ($search_societe) { - $param .= '&search_societe='.urlencode($search_societe); + if ($search_company) { + $param .= '&search_company='.urlencode($search_company); } - if ($search_societe_alias) { - $param .= '&search_societe_alias='.urlencode($search_societe_alias); + if ($search_company_alias) { + $param .= '&search_company_alias='.urlencode($search_company_alias); } if ($search_user > 0) { $param .= '&search_user='.urlencode((string) ($search_user)); @@ -742,12 +751,12 @@ } if (!empty($arrayfields['s.nom']['checked'])) { print ''; - print ''; + print ''; print ''; } if (!empty($arrayfields['s.name_alias']['checked'])) { print ''; - print ''; + print ''; print ''; } if (!empty($arrayfields['s.town']['checked'])) {