Merge pull request #12140 from ptibogxiv/patch-268

NEW mode for list thirdparty API (add easy filter for supplier only)
This commit is contained in:
Laurent Destailleur 2019-10-16 13:25:05 +02:00 committed by GitHub
commit 363000f5b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,6 +117,7 @@ class Thirdparties extends DolibarrApi
* @param int $mode Set to 1 to show only customers
* Set to 2 to show only prospects
* Set to 3 to show only those are not customer neither prospect
* Set to 4 to show only suppliers
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.nom:like:'TheCompany%') and (t.date_creation:<:'20160101')"
* @return array Array of thirdparty objects
*/
@ -143,6 +144,7 @@ class Thirdparties extends DolibarrApi
if ($mode == 1) $sql.= " AND t.client IN (1, 3)";
if ($mode == 2) $sql.= " AND t.client IN (2, 3)";
if ($mode == 3) $sql.= " AND t.client IN (0)";
if ($mode == 4) $sql.= " AND t.fournisseur IN (1)";
$sql.= ' AND t.entity IN ('.getEntity('societe').')';
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc";
//if ($email != NULL) $sql.= " AND s.email = \"".$email."\"";