NEW mode for list thirdparty API (add supplier)

add new mode for more universel use of the api and easy switch between customer's and supplier's modes
This commit is contained in:
ptibogxiv 2019-10-15 09:52:14 +02:00 committed by GitHub
parent 33cc0c017c
commit 0d69ae9e8c
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."\"";