Skip to content

Commit

Permalink
NEW mode for list thirdparty API (add supplier)
Browse files Browse the repository at this point in the history
add new mode for more universel use of the api and easy switch between customer's and supplier's modes
  • Loading branch information
ptibogxiv committed Oct 15, 2019
1 parent 33cc0c0 commit 0d69ae9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions htdocs/societe/class/api_thirdparties.class.php
Expand Up @@ -117,6 +117,7 @@ public function get($id)
* @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
*/
Expand All @@ -143,6 +144,7 @@ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100,
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."\"";
Expand Down

0 comments on commit 0d69ae9

Please sign in to comment.