diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php index 9b03c33ea48..d1b0561cb73 100644 --- a/htdocs/bom/class/api_boms.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -116,7 +116,7 @@ class Boms extends DolibarrApi $obj_ret = array(); $tmpobject = new BOM($this->db); - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; + $socid = DolibarrApiAccess::$user->socid ?: ''; $restrictonsocid = 0; // Set to 1 if there is a field socid in table of object diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index aacc32d6ddc..ebe9174c1b1 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -130,7 +130,7 @@ class AgendaEvents extends DolibarrApi } // case of external user - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : 0; + $socid = DolibarrApiAccess::$user->socid ?: 0; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 43a182561dc..d004b27175f 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -193,7 +193,7 @@ class Proposals extends DolibarrApi $obj_ret = array(); // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index ab01d260763..3c45c5f3362 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -186,7 +186,7 @@ class Orders extends DolibarrApi $obj_ret = array(); // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 514a399ed66..8123044ea62 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -203,7 +203,7 @@ class Invoices extends DolibarrApi $obj_ret = array(); // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index e4fbcca102e..d6ecec7a5ef 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -114,7 +114,7 @@ class Contracts extends DolibarrApi $obj_ret = array(); // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 6b7ad5b0444..27a422c2f2d 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -110,7 +110,7 @@ class Donations extends DolibarrApi $obj_ret = array(); // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids; $sql = "SELECT t.rowid"; if ((!DolibarrApiAccess::$user->hasRight('societe', 'client', 'voir') && !$socids)) { diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index d5b6382ef0f..fac4ccb9de4 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -112,7 +112,7 @@ class Shipments extends DolibarrApi $obj_ret = array(); // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index d74a8a7a09a..462b76623d7 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -131,7 +131,7 @@ class ExpenseReports extends DolibarrApi $obj_ret = array(); // case of external user, $societe param is ignored and replaced by user's socid - //$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $societe; + //$socid = DolibarrApiAccess::$user->socid ?: $societe; $sql = "SELECT t.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport AS t LEFT JOIN ".MAIN_DB_PREFIX."expensereport_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index da498e6159e..023c1604c95 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -147,7 +147,7 @@ class Interventions extends DolibarrApi $obj_ret = array(); // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index bfdd2adc449..0e8a46dffd6 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -117,7 +117,7 @@ class SupplierInvoices extends DolibarrApi $obj_ret = array(); // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index ab61fee4f25..9cf52085dfe 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -111,7 +111,7 @@ class SupplierOrders extends DolibarrApi $obj_ret = array(); // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index 3d64ee58d55..12d387ab09c 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -147,7 +147,7 @@ class KnowledgeManagement extends DolibarrApi throw new RestException(403); } - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : 0; + $socid = DolibarrApiAccess::$user->socid ?: 0; $restrictonsocid = 0; // Set to 1 if there is a field socid in table of object diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 6292c20020c..a264a2b668c 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -121,7 +121,7 @@ class MyModuleApi extends DolibarrApi throw new RestException(403); } - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : 0; + $socid = DolibarrApiAccess::$user->socid ?: 0; $restrictonsocid = 0; // Set to 1 if there is a field socid in table of object diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index 11e68b4c722..6fb2532df67 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -108,7 +108,7 @@ class Mos extends DolibarrApi $obj_ret = array(); $tmpobject = new Mo($this->db); - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : 0; + $socid = DolibarrApiAccess::$user->socid ?: 0; $restrictonsocid = 0; // Set to 1 if there is a field socid in table of object diff --git a/htdocs/partnership/class/api_partnerships.class.php b/htdocs/partnership/class/api_partnerships.class.php index 0b3cd1513d1..119e2931a0f 100644 --- a/htdocs/partnership/class/api_partnerships.class.php +++ b/htdocs/partnership/class/api_partnerships.class.php @@ -113,7 +113,7 @@ class Partnerships extends DolibarrApi throw new RestException(403); } - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : 0; + $socid = DolibarrApiAccess::$user->socid ?: 0; $restrictonsocid = 0; // Set to 1 if there is a field socid in table of object diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 07e4d544378..79034aaf5b3 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -204,7 +204,7 @@ class Products extends DolibarrApi $obj_ret = array(); - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; + $socid = DolibarrApiAccess::$user->socid ?: ''; $sql = "SELECT t.rowid, t.ref, t.ref_ext"; $sql .= " FROM ".$this->db->prefix()."product as t"; @@ -798,7 +798,7 @@ class Products extends DolibarrApi throw new RestException(400, 'API not available: this mode of pricing is not enabled by setup'); } - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; + $socid = DolibarrApiAccess::$user->socid ?: ''; if ($socid > 0 && $socid != $thirdparty_id) { throw new RestException(403, 'Getting prices for all customers or for the customer ID '.$thirdparty_id.' is not allowed for login '.DolibarrApiAccess::$user->login); } @@ -918,7 +918,7 @@ class Products extends DolibarrApi throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; + $socid = DolibarrApiAccess::$user->socid ?: ''; if ($socid > 0 && $socid != $fourn_id) { throw new RestException(403, 'Adding purchase price for the supplier ID '.$fourn_id.' is not allowed for login '.DolibarrApiAccess::$user->login); } @@ -1016,7 +1016,7 @@ class Products extends DolibarrApi $obj_ret = array(); // Force id of company for external users - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; + $socid = DolibarrApiAccess::$user->socid ?: ''; if ($socid > 0) { if ($supplier != $socid || empty($supplier)) { throw new RestException(403, 'As an external user, you can request only for your supplier id = '.$socid); @@ -1129,7 +1129,7 @@ class Products extends DolibarrApi throw new RestException(403); } - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; + $socid = DolibarrApiAccess::$user->socid ?: ''; $result = $this->product->fetch($id, $ref, $ref_ext, $barcode); if (!$result) { diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 842522ff561..b1395c436d4 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -209,7 +209,7 @@ class Projects extends DolibarrApi $obj_ret = array(); // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 508d3eff782..0c2b1c6b859 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -120,7 +120,7 @@ class Tasks extends DolibarrApi $obj_ret = array(); // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : 0; + $socids = DolibarrApiAccess::$user->socid ?: 0; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/reception/class/api_receptions.class.php b/htdocs/reception/class/api_receptions.class.php index f860207193a..05eb602f526 100644 --- a/htdocs/reception/class/api_receptions.class.php +++ b/htdocs/reception/class/api_receptions.class.php @@ -112,7 +112,7 @@ class Receptions extends DolibarrApi $obj_ret = array(); // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/recruitment/class/api_recruitments.class.php b/htdocs/recruitment/class/api_recruitments.class.php index 29e908f1e91..d8ec32e7405 100644 --- a/htdocs/recruitment/class/api_recruitments.class.php +++ b/htdocs/recruitment/class/api_recruitments.class.php @@ -152,7 +152,7 @@ class Recruitments extends DolibarrApi throw new RestException(403); } - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : 0; + $socid = DolibarrApiAccess::$user->socid ?: 0; $restrictonsocid = 0; // Set to 1 if there is a field socid in table of object @@ -268,7 +268,7 @@ class Recruitments extends DolibarrApi throw new RestException(403); } - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : 0; + $socid = DolibarrApiAccess::$user->socid ?: 0; $restrictonsocid = 0; // Set to 1 if there is a field socid in table of object diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index f53e7d323fb..5a449dc3a81 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -193,7 +193,7 @@ class Contacts extends DolibarrApi } // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php index d2fa85fa69d..308f899886b 100644 --- a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php +++ b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php @@ -238,7 +238,7 @@ class SupplierProposals extends DolibarrApi $obj_ret = array(); // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + $socids = DolibarrApiAccess::$user->socid ?: $thirdparty_ids; // If the internal user must only see his customers, force searching by him $search_sale = 0; diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index da0eb4c4d87..4586e5b375d 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -213,7 +213,7 @@ class Tickets extends DolibarrApi $obj_ret = array(); - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $socid; + $socid = DolibarrApiAccess::$user->socid ?: $socid; $search_sale = null; // If the internal user must only see his customers, force searching by him diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 1a3f1c458d8..c77e65b6966 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -90,7 +90,7 @@ class Users extends DolibarrApi $obj_ret = array(); // case of external user, $societe param is ignored and replaced by user's socid - //$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $societe; + //$socid = DolibarrApiAccess::$user->socid ?: $societe; $sql = "SELECT t.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."user AS t LEFT JOIN ".MAIN_DB_PREFIX."user_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields @@ -645,7 +645,7 @@ class Users extends DolibarrApi } // case of external user, $societe param is ignored and replaced by user's socid - //$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $societe; + //$socid = DolibarrApiAccess::$user->socid ?: $societe; $sql = "SELECT t.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."usergroup AS t LEFT JOIN ".MAIN_DB_PREFIX."usergroup_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields diff --git a/htdocs/workstation/class/api_workstations.class.php b/htdocs/workstation/class/api_workstations.class.php index 1a70145db60..5e1661e08f9 100644 --- a/htdocs/workstation/class/api_workstations.class.php +++ b/htdocs/workstation/class/api_workstations.class.php @@ -117,7 +117,7 @@ class Workstations extends DolibarrApi $obj_ret = array(); - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; + $socid = DolibarrApiAccess::$user->socid ?: ''; $sql = "SELECT t.rowid, t.ref"; $sql .= " FROM ".$this->db->prefix()."workstation_workstation as t"; diff --git a/htdocs/zapier/class/api_zapier.class.php b/htdocs/zapier/class/api_zapier.class.php index 859d2f7a598..fa4eea88769 100644 --- a/htdocs/zapier/class/api_zapier.class.php +++ b/htdocs/zapier/class/api_zapier.class.php @@ -155,7 +155,7 @@ class Zapier extends DolibarrApi $obj_ret = array(); - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : 0; + $socid = DolibarrApiAccess::$user->socid ?: 0; // Set to 1 if there is a field socid in table of object $restrictonsocid = 0;