diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index bc8fff8395c..e34cd54863b 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -46,7 +46,7 @@ $search_pcgtype = GETPOST('search_pcgtype', 'alpha'); $search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha'); // Security check -if ($user->societe_id > 0) accessforbidden(); +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->chartofaccount) accessforbidden(); // Load variable for pagination diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 2f23cd3eae8..6f30f5ac7ec 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -71,7 +71,7 @@ $search_country_id = GETPOST('search_country_id', 'int'); // Security check -if ($user->societe_id > 0) accessforbidden(); +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->chartofaccount) accessforbidden(); diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 03404bd4126..5b1fa9df4ec 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -43,7 +43,7 @@ if (! $sortorder) $sortorder="ASC"; $langs->loadLangs(array("admin","compta")); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->fiscalyear->write) // If we can read accounting records, we should be able to see fiscal year. accessforbidden(); diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index d9125a686c6..42b9d231fe3 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php'; $langs->loadLangs(array("admin","compta")); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (empty($user->rights->accounting->fiscalyear->write)) accessforbidden(); diff --git a/htdocs/accountancy/admin/fiscalyear_info.php b/htdocs/accountancy/admin/fiscalyear_info.php index dd62352e2b1..a02141f449e 100644 --- a/htdocs/accountancy/admin/fiscalyear_info.php +++ b/htdocs/accountancy/admin/fiscalyear_info.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php'; $langs->loadLangs(array("admin","compta")); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->fiscalyear->write) accessforbidden(); diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index cc6307bae2c..ca6403279e1 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -45,7 +45,7 @@ $mode = GETPOST('mode', 'aZ09'); // '' or 'tmp' $piece_num = GETPOST("piece_num", 'int'); // id of transaction (several lines share the same transaction id) // Security check -if ($user->societe_id > 0) { +if ($user->socid > 0) { accessforbidden(); } diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index 4bc60fc904f..2ed9eb4c2bd 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -83,7 +83,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', // Security check $socid = GETPOST("socid", 'int'); -// if ($user->societe_id) $socid=$user->societe_id; +// if ($user->socid) $socid=$user->socid; $lettering = new Lettering($db); $object = new Societe($db); @@ -139,7 +139,7 @@ dol_fiche_head($head, 'lettering_customer', $langs->trans("ThirdParty"), 0, 'com $linkback = ''.$langs->trans("BackToList").''; -dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); +dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); dol_fiche_end(); diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index df513f8d074..b381fc597ce 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -83,7 +83,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', // Security check $socid = GETPOST("socid", 'int'); -// if ($user->societe_id) $socid=$user->societe_id; +// if ($user->socid) $socid=$user->socid; $lettering = new Lettering($db); $object = new Societe($db); @@ -138,7 +138,7 @@ dol_fiche_head($head, 'lettering_supplier', $langs->trans("ThirdParty"), 0, 'com $linkback = ''.$langs->trans("BackToList").''; -dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); +dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); dol_fiche_end(); diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index ddf3b4cf2db..599742460ae 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -34,7 +34,7 @@ $langs->loadLangs(array("compta","bills","other","main","accountancy")); if (empty($conf->accounting->enabled)) { accessforbidden(); } -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->fiscalyear->write) accessforbidden(); diff --git a/htdocs/accountancy/closure/validate.php b/htdocs/accountancy/closure/validate.php index 26b53009fcc..0498e5e2dec 100644 --- a/htdocs/accountancy/closure/validate.php +++ b/htdocs/accountancy/closure/validate.php @@ -34,7 +34,7 @@ $langs->loadLangs(array("compta","bills","other","main","accountancy")); if (empty($conf->accounting->enabled)) { accessforbidden(); } -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->fiscalyear->write) accessforbidden(); diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 00c4a945ff9..62ae458d283 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -38,7 +38,7 @@ $codeventil = GETPOST('codeventil'); $id = GETPOST('id'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index c0e45916922..b3ef45c1feb 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -39,7 +39,7 @@ $langs->loadLangs(array("compta","bills","other","main","accountancy")); if (empty($conf->accounting->enabled)) { accessforbidden(); } -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->bind->write) accessforbidden(); diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 6a5196288e2..9d32bbaebf4 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -72,7 +72,7 @@ if (! $sortorder) { } // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->bind->write) accessforbidden(); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index d4cc5f59388..2969f2ff0a1 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -83,7 +83,7 @@ if (! $sortorder) { } // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->bind->write) accessforbidden(); diff --git a/htdocs/accountancy/expensereport/card.php b/htdocs/accountancy/expensereport/card.php index 2331111f620..8ee9f9c625d 100644 --- a/htdocs/accountancy/expensereport/card.php +++ b/htdocs/accountancy/expensereport/card.php @@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil'); $id = GETPOST('id'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index ea855921c5a..4efc8a15ba4 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -36,7 +36,7 @@ $langs->loadLangs(array("compta","bills","other","main","accountancy")); if (empty($conf->accounting->enabled)) { accessforbidden(); } -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->bind->write) accessforbidden(); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index c50031b82b2..56f7ee6ba96 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -67,7 +67,7 @@ if (! $sortorder) { } // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->bind->write) accessforbidden(); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 1ec89dfc9cc..f0e545f7853 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -77,7 +77,7 @@ if (! $sortorder) { } // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->bind->write) accessforbidden(); diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 0eeccbd3395..8dde1d0df22 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; $langs->loadLangs(array("compta","bills","other","accountancy","loans","banks","admin","dict")); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index f75fa48f544..e8e1da09dd0 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -80,7 +80,7 @@ $now = dol_now(); $action = GETPOST('action', 'aZ09'); // Security check -if ($user->societe_id > 0 && empty($id_journal)) +if ($user->socid > 0 && empty($id_journal)) accessforbidden(); diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index c61cdda4d48..a80036b3b05 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -56,7 +56,7 @@ if ($in_bookkeeping == '') $in_bookkeeping = 'notyet'; $now = dol_now(); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); /* diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index a3728c7f6f9..711a54f37a6 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -56,7 +56,7 @@ if ($in_bookkeeping == '') $in_bookkeeping = 'notyet'; $now = dol_now(); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); $hookmanager->initHooks(array('purchasesjournal')); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 367fa2eb817..7781d612575 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -58,7 +58,7 @@ if ($in_bookkeeping == '') $in_bookkeeping = 'notyet'; $now = dol_now(); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); $hookmanager->initHooks(array('sellsjournal')); diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index 7e9d7fbbd7c..63bce528ccb 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil'); $id = GETPOST('id'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index bfb6e7b02e4..a1eb1ce4a45 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -37,7 +37,7 @@ $langs->loadLangs(array("compta","bills","other","main","accountancy")); if (empty($conf->accounting->enabled)) { accessforbidden(); } -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->bind->write) accessforbidden(); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 730aecf9dc1..00ac4d02d73 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -74,7 +74,7 @@ if (! $sortorder) { } // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->bind->write) accessforbidden(); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 3c61b7a0608..27cd97dfea3 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -83,7 +83,7 @@ if (! $sortorder) { } // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->bind->write) accessforbidden(); diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php index 9c6f657d5e0..51f121ad903 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php @@ -118,7 +118,7 @@ if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['act control->tpl['showend']; -if (empty($user->societe_id)) { +if (empty($user->socid)) { echo '
'; if ($user->rights->adherent->creer) { diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 8478288ba69..76556feb4ee 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1885,7 +1885,7 @@ else } // Create user - if (! $user->societe_id && ! $object->user_id) + if (! $user->socid && ! $object->user_id) { if ($user->rights->user->user->creer) { diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 9ef8e122c9b..1357e4a3b4b 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -70,7 +70,7 @@ class AdherentStats extends Stats $this->where.= " m.statut != 0"; $this->where.= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")"; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + //if (!$user->rights->societe->client->voir && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if($this->memberid) { $this->where .= " AND m.rowid = ".$this->memberid; @@ -92,7 +92,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql.= " FROM ".$this->from; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; @@ -112,7 +112,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%Y') as dm, count(*)"; $sql.= " FROM ".$this->from; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm', 'DESC'); @@ -133,7 +133,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql.= " FROM ".$this->from; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index fafa69b8b3f..99326241485 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -37,9 +37,9 @@ $action = GETPOST('action', 'aZ09'); // Protection $socid=0; -if ($user->societe_id > 0) +if ($user->socid > 0) { - $socid = $user->societe_id; + $socid = $user->socid; } $object = new Adherent($db); diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index d954484c839..b2f302fea45 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -33,10 +33,10 @@ $mode=GETPOST('mode')?GETPOST('mode'):''; // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $result=restrictedArea($user, 'adherent', '', '', 'cotisation'); diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index afc2e2b5218..3c469e658e5 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -34,10 +34,10 @@ $mode=GETPOST('mode')?GETPOST('mode'):''; // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $result=restrictedArea($user, 'adherent', '', '', 'cotisation'); diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 2f2c6f33920..d89a8a4a8c0 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -35,10 +35,10 @@ $userid=GETPOST('userid', 'int'); if ($userid < 0) $userid=0; $socid=GETPOST('socid', 'int'); if ($socid < 0) $socid=0; // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $result=restrictedArea($user, 'adherent', '', '', 'cotisation'); diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index ac9a269bf29..5a4f84868e1 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -41,7 +41,7 @@ $cancel=GETPOST('cancel', 'alpha'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; // Security check $result=restrictedArea($user, 'adherent', $id, 'adherent_type'); diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index cb0288b44ba..04accc01bbf 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -75,8 +75,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 09ba5f7224f..e8b2e280a7f 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -78,9 +78,9 @@ if (! $sortorder) $sortorder="ASC"; // Security check $socid=0; -if ($user->societe_id > 0) // Protection if external user +if ($user->socid > 0) // Protection if external user { - //$socid = $user->societe_id; + //$socid = $user->socid; accessforbidden(); } //$result = restrictedArea($user, 'emailcollector', $id, ''); diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 58f107dfdf5..adb54c7434f 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -71,9 +71,9 @@ if (! $sortorder) $sortorder="ASC"; // Protection if external user $socid=0; -if ($user->societe_id > 0) +if ($user->socid > 0) { - //$socid = $user->societe_id; + //$socid = $user->socid; accessforbidden(); } diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 9bbe81993c4..c0d08f4b505 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -35,10 +35,10 @@ $action=GETPOST('action', 'alpha'); $confirm=GETPOST('confirm', 'alpha'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } // Load translation files required by the page diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php index 1fedf9e40de..06bed7a3f3a 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -35,10 +35,10 @@ $action=GETPOST('action', 'alpha'); $confirm=GETPOST('confirm', 'alpha'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $sortfield = GETPOST("sortfield", 'alpha'); diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 7c2f1b42f32..7d49d253755 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -60,8 +60,8 @@ foreach($object->fields as $key => $val) if (empty($action) && empty($id) && empty($ref)) $action='view'; // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'asset', $id); // Load object diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index d1fa8c1e04b..976b8974f5a 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -40,8 +40,8 @@ $id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); $ref = GETPOST('ref', 'alpha'); // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'asset', $id); // Get parameters diff --git a/htdocs/asset/info.php b/htdocs/asset/info.php index f3758ebca8e..f3c385831a1 100644 --- a/htdocs/asset/info.php +++ b/htdocs/asset/info.php @@ -34,7 +34,7 @@ $ref=GETPOST('ref', 'alpha'); $action=GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'asset', $id, ''); $object = new Asset($db); diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index bd2d19bbc87..697f3becd9b 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -72,9 +72,9 @@ if (! $sortorder) $sortorder="ASC"; // Protection if external user $socid=0; -if ($user->societe_id > 0) +if ($user->socid > 0) { - //$socid = $user->societe_id; + //$socid = $user->socid; accessforbidden(); } //$result = restrictedArea($user, 'asset', $id,''); diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php index 0c03619d31c..dce1daaa3ca 100644 --- a/htdocs/asset/note.php +++ b/htdocs/asset/note.php @@ -46,8 +46,8 @@ $hookmanager->initHooks(array('assetnote')); // Note that conf->hooks_module $extrafields->fetch_name_optionals_label($object->table_element); // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'asset', $id); // Load object diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index 87fb55a6541..c38d0a82a69 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -53,8 +53,8 @@ else $search_agenda_label=GETPOST('search_agenda_label'); // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'bom', $id); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index eea20d6721c..231679f7b3a 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -70,8 +70,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->statut == BillOfMaterials::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index 826222af8b0..f0dac37a5a0 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -41,8 +41,8 @@ $id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); $ref = GETPOST('ref', 'alpha'); // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'bom', $id); // Get parameters diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 6e192a06545..0775c2cc370 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -73,9 +73,9 @@ if (! $sortorder) $sortorder="ASC"; // Security check $socid=0; -if ($user->societe_id > 0) // Protection if external user +if ($user->socid > 0) // Protection if external user { - //$socid = $user->societe_id; + //$socid = $user->socid; accessforbidden(); } //$result = restrictedArea($user, 'bom', $id, ''); diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php index 481d8f1d799..e733b96d12b 100644 --- a/htdocs/bom/bom_note.php +++ b/htdocs/bom/bom_note.php @@ -47,8 +47,8 @@ $hookmanager->initHooks(array('bomnote','globalcard')); // Note that conf->h $extrafields->fetch_name_optionals_label($object->table_element); // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'bom', $id); // Load object diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index d60b3251f0d..c8244bc307e 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -779,9 +779,9 @@ class Categorie extends CommonObject $sql .= " AND c.fk_categorie = ".$this->id; $sql .= " AND c.fk_" . $this->MAP_CAT_FK[$type] . " = o.rowid"; // Protection for external users - if (($type == 'customer' || $type == 'supplier') && $user->societe_id > 0) + if (($type == 'customer' || $type == 'supplier') && $user->socid > 0) { - $sql.= " AND o.rowid = ".$user->societe_id; + $sql.= " AND o.rowid = ".$user->socid; } if ($limit > 0 || $offset > 0) $sql .= $this->db->plimit($limit + 1, $offset); $sql .= $this->db->order($sortfield, $sortorder); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 6def65666a0..754b846576d 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -136,7 +136,7 @@ if ($object->id) } $morehtmlref.='
'; - dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); + dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); /* * Confirmation de la suppression de photo diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 3c9c7eb64e4..1c082dfe332 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -207,7 +207,7 @@ foreach ($ways as $way) } $morehtmlref.=''; -dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); +dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); print '
'; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index fb246b5358b..45926847df4 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -226,7 +226,7 @@ foreach ($ways as $way) } $morehtmlref.=''; -dol_banner_tab($object, 'label', $linkback, ($user->societe_id?0:1), 'label', 'label', $morehtmlref, '', 0, '', '', 1); +dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '', 0, '', '', 1); /* diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 15a6f820647..e0a29db412b 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -69,9 +69,9 @@ $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fullda // Security check $socid = GETPOST('socid', 'int'); $id = GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); -if ($user->societe_id && $socid) $result = restrictedArea($user, 'societe', $socid); +if ($user->socid && $socid) $result = restrictedArea($user, 'societe', $socid); $error=GETPOST("error"); $donotclearsession=GETPOST('donotclearsession')?GETPOST('donotclearsession'):0; @@ -1024,8 +1024,8 @@ if ($action == 'create') $events=array(); $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); //For external user force the company to user company - if (!empty($user->societe_id)) { - print $form->select_company($user->societe_id, 'socid', '', 1, 1, 0, $events, 0, 'minwidth300'); + if (!empty($user->socid)) { + print $form->select_company($user->socid, 'socid', '', 1, 1, 0, $events, 0, 'minwidth300'); } else { print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, $events, 0, 'minwidth300'); } @@ -1612,7 +1612,7 @@ if ($id > 0) $morehtmlref.=''; - dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref); + dol_banner_tab($object, 'id', $linkback, ($user->socid?0:1), 'id', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f79e973bc5b..f197b82b77b 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1163,13 +1163,13 @@ class ActionComm extends CommonObject $sql = "SELECT count(a.id) as nb"; } $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; - if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; + if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " WHERE 1 = 1"; if(empty($load_state_board)) $sql.= " AND a.percent >= 0 AND a.percent < 100"; $sql.= " AND a.entity IN (".getEntity('agenda').")"; - if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; - if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id; + if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; + if ($user->socid) $sql.=" AND a.fk_soc = ".$user->socid; if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")"; $resql=$this->db->query($sql); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 6f0875be879..f01f49921e7 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -45,8 +45,8 @@ $confirm = GETPOST('confirm', 'alpha'); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; -if ($user->societe_id > 0) +if ($user->socid) $socid=$user->socid; +if ($user->socid > 0) { unset($_GET["action"]); $action=''; @@ -159,7 +159,7 @@ if ($object->id > 0) } $morehtmlref.='
'; - dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref); + dol_banner_tab($object, 'id', $linkback, ($user->socid?0:1), 'id', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 3b2e334e2ef..031918b194b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -67,7 +67,7 @@ if (! $sortfield) $sortfield="a.datec"; // Security check $socid = GETPOST("search_socid", "int")?GETPOST("search_socid", "int"):GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'agenda', 0, '', 'myactions'); if ($socid < 0) $socid=''; diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 02277fc30e8..a88ff67fd91 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -39,10 +39,10 @@ $langs->load("commercial"); $id = GETPOST('id', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); @@ -102,7 +102,7 @@ if (! empty($conf->projet->enabled)) } $morehtmlref.='
'; -dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref); +dol_banner_tab($object, 'id', $linkback, ($user->socid?0:1), 'id', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index ac474881732..65852d053b4 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -110,7 +110,7 @@ if (! $sortfield) // Security check $socid = GETPOST("search_socid", 'int')?GETPOST("search_socid", 'int'):GETPOST("socid", 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'agenda', 0, '', 'myactions'); if ($socid < 0) $socid=''; diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 15d98465e3c..134e239b66f 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -65,7 +65,7 @@ if (! $sortfield) $sortfield="a.datec"; // Security check $socid = GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'agenda', 0, '', 'myactions'); if ($socid < 0) $socid=''; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index fe125820daf..3280ddc7af4 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -65,7 +65,7 @@ if (! $sortfield) $sortfield="a.datec"; // Security check $socid = GETPOST("search_socid", "int")?GETPOST("search_socid", "int"):GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'agenda', 0, '', 'myactions'); if ($socid < 0) $socid=''; diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 8cc1774cba2..c6549c5c39a 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -49,7 +49,7 @@ if (! $sortfield) $sortfield="a.datep"; // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'agenda', $socid, '', 'myactions'); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 57239c355b4..a0263065dee 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -59,7 +59,7 @@ if (! empty($conf->notification->enabled)) $langs->load("mails"); // Security check $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); -if ($user->societe_id > 0) $id=$user->societe_id; +if ($user->socid > 0) $id=$user->socid; $result = restrictedArea($user, 'societe', $id, '&societe'); $action = GETPOST('action', 'aZ09'); @@ -240,7 +240,7 @@ if ($object->id > 0) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; @@ -387,7 +387,7 @@ if ($object->id > 0) print ''; print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index cac784ba8f9..0df1af873a8 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3263,7 +3263,7 @@ class Propal extends CommonObject $sql = "SELECT p.rowid, p.ref, p.datec as datec, p.fin_validite as datefin, p.total_ht"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; @@ -3272,7 +3272,7 @@ class Propal extends CommonObject $sql.= $clause." p.entity IN (".getEntity('propal').")"; if ($mode == 'opened') $sql.= " AND p.fk_statut = ".self::STATUS_VALIDATED; if ($mode == 'signed') $sql.= " AND p.fk_statut = ".self::STATUS_SIGNED; - if ($user->societe_id) $sql.= " AND p.fk_soc = ".$user->societe_id; + if ($user->socid) $sql.= " AND p.fk_soc = ".$user->socid; $resql=$this->db->query($sql); if ($resql) @@ -3442,7 +3442,7 @@ class Propal extends CommonObject $sql = "SELECT count(p.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index bd0f57bc801..0859bdb7974 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -112,7 +112,7 @@ class PropaleStats extends Stats $sql = "SELECT date_format(".$this->field_date.",'%m') as dm, COUNT(*) as nb"; $sql.= " FROM ".$this->from; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index cb798e2fdd6..14f5913c4ce 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -41,7 +41,7 @@ $lineid=GETPOST('lineid', 'int'); $action=GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'propal', $id); $object = new Propal($db); diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index c1719ddbe45..55a21445be2 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -46,9 +46,9 @@ $ref = GETPOST('ref', 'alpha'); // Security check $socid=''; -if (! empty($user->societe_id)) +if (! empty($user->socid)) { - $socid = $user->societe_id; + $socid = $user->socid; } $result = restrictedArea($user, 'propal', $id); diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index a1104682904..d802548ac6b 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -38,10 +38,10 @@ $langs->loadLangs(array('propal', 'companies')); // Security check $socid=GETPOST('socid', 'int'); -if (isset($user->societe_id) && $user->societe_id > 0) +if (isset($user->socid) && $user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $result = restrictedArea($user, 'propal'); @@ -87,7 +87,7 @@ $sql.= ", ".MAIN_DB_PREFIX."propal as p"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE p.fk_soc = s.rowid"; $sql.= " AND p.entity IN (".getEntity('propal').")"; -if ($user->societe_id) $sql.=' AND p.fk_soc = '.$user->societe_id; +if ($user->socid) $sql.=' AND p.fk_soc = '.$user->socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " AND p.fk_statut IN (0,1,2,3,4)"; $sql.= " GROUP BY p.fk_statut"; diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index 848d707f22f..1e27f187488 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -40,7 +40,7 @@ $ref=GETPOST('ref', 'alpha'); $socid=GETPOST('socid', 'int'); // Security check -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result = restrictedArea($user, 'propal', $id); $object = new Propal($db); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 01d4c264667..a83d7ee5161 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -112,7 +112,7 @@ if (! $sortorder) $sortorder='DESC'; $module='propal'; $dbtable=''; $objectid=''; -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; if (! empty($socid)) { $objectid=$socid; diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 7c3d58f64d5..ee9d9bd9c4f 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -41,7 +41,7 @@ $ref=GETPOST('ref', 'alpha'); $action=GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'propale', $id, 'propal'); $object = new Propal($db); diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 1d81b553f7a..a37006d60fb 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -42,10 +42,10 @@ $object_status=GETPOST('object_status'); $userid=GETPOST('userid', 'int'); $socid=GETPOST('socid', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $nowyear=strftime("%Y", dol_now()); @@ -94,7 +94,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenamenb = $dir.'/proposalsnbinyear-'.$user->id.'-'.$year.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnbinyear-'.$user->id.'-'.$year.'.png'; @@ -134,7 +134,7 @@ if (! $mesg) $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, 0); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenameamount = $dir.'/proposalsamountinyear-'.$user->id.'-'.$year.'.png'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$user->id.'-'.$year.'.png'; @@ -173,7 +173,7 @@ if (! $mesg) $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); $fileurl_avg=''; -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index cdd94c9cf6c..485771939c4 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -30,9 +30,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; $langs->load("propal"); -if ($user->societe_id > 0) +if ($user->socid > 0) { - $socid = $user->societe_id; + $socid = $user->socid; } diff --git a/htdocs/comm/prospect/recap-prospect.php b/htdocs/comm/prospect/recap-prospect.php index 192aaccbddf..07741635bcc 100644 --- a/htdocs/comm/prospect/recap-prospect.php +++ b/htdocs/comm/prospect/recap-prospect.php @@ -32,10 +32,10 @@ if (! empty($conf->facture->enabled)) $langs->load("bills"); // Security check $socid = $_GET["socid"]; -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } diff --git a/htdocs/comm/recap-client.php b/htdocs/comm/recap-client.php index 0759c47c06c..9605281d6ca 100644 --- a/htdocs/comm/recap-client.php +++ b/htdocs/comm/recap-client.php @@ -32,10 +32,10 @@ if (! empty($conf->facture->enabled)) $langs->load("bills"); // Security check $socid = $_GET["socid"]; -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index a704a4be173..32c6869d576 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -33,9 +33,9 @@ $id=GETPOST("id", 'int'); $socid = GETPOST('id', 'int')?GETPOST('id', 'int'):GETPOST('socid', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { - $socid = $user->societe_id; + $socid = $user->socid; } $backtopage = GETPOST('backtopage', 'alpha'); @@ -116,7 +116,7 @@ if ($socid > 0) dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"), -1, 'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', '', ($user->socid?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 002eb7288e2..523c6ebc7b1 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -40,9 +40,9 @@ $backtopage=GETPOST('backtopage', 'alpha'); // Security check $socid = GETPOST('id', 'int')?GETPOST('id', 'int'):GETPOST('socid', 'int'); -if ($user->societe_id > 0) +if ($user->socid > 0) { - $socid = $user->societe_id; + $socid = $user->socid; } @@ -252,7 +252,7 @@ if ($socid > 0) dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"), 0, 'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', '', ($user->socid?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e645bf3cee6..7fd0d7326c4 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -82,8 +82,8 @@ $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty( $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); // Security check -if (! empty($user->societe_id)) - $socid = $user->societe_id; +if (! empty($user->socid)) + $socid = $user->socid; $result = restrictedArea($user, 'commande', $id); $object = new Commande($db); @@ -1803,7 +1803,7 @@ if ($action == 'create' && $usercancreate) print '
'; // Note private - if (empty($user->societe_id)) { + if (empty($user->socid)) { print ''; print ''; print ''; // Private note - if (empty($user->societe_id)) + if (empty($user->socid)) { print ''; print ''; diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 696823f4e41..bdf277bc375 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -43,10 +43,10 @@ $object_status=GETPOST('object_status'); $userid=GETPOST('userid', 'int'); $socid=GETPOST('socid', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $nowyear=strftime("%Y", dol_now()); @@ -101,7 +101,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenamenb = $dir.'/ordersnbinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$user->id.'-'.$year.'.png'; @@ -144,7 +144,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear); //var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenameamount = $dir.'/ordersamountinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$user->id.'-'.$year.'.png'; @@ -185,7 +185,7 @@ if (! $mesg) $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index cbecd9cbc05..f9d7e44794c 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -73,7 +73,7 @@ $arrayfields=array( if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled)) { accessforbidden(); } -if ($user->societe_id > 0) { +if ($user->socid > 0) { accessforbidden(); } diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 7f96d9e28e7..b5839db2200 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -41,7 +41,7 @@ $ref=GETPOST('ref'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :'')); $fieldtype = (! empty($ref) ? 'ref' :'rowid'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'banque', $fieldvalue, 'bank_account&bank_account', '', '', $fieldtype); $year_start=GETPOST('year_start'); diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 457e311d01c..d2b998be2d9 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -66,12 +66,12 @@ $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :'')); $fieldtype = (! empty($ref) ? 'ref' :'rowid'); if ($fielvalue) { - if ($user->societe_id) $socid=$user->societe_id; + if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'banque', $fieldvalue, 'bank_account&bank_account', '', '', $fieldtype); } else { - if ($user->societe_id) $socid=$user->societe_id; + if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'banque'); } diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php index 41275ec2a40..c9c5a0f77fe 100644 --- a/htdocs/compta/bank/budget.php +++ b/htdocs/compta/bank/budget.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->loadLangs(array('banks', 'categories')); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'banque'); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 53fa268b750..57cff121010 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1188,7 +1188,7 @@ class Account extends CommonObject // phpcs:enable global $conf, $langs; - if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe + if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe $sql = "SELECT b.rowid, b.datev as datefin"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b,"; @@ -1244,7 +1244,7 @@ class Account extends CommonObject // phpcs:enable global $user; - if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe + if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe $sql = "SELECT count(b.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b,"; @@ -1283,7 +1283,7 @@ class Account extends CommonObject global $db, $conf, $user; //Protection against external users - if ($user->societe_id) { + if ($user->socid) { return 0; } diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 67a38e03cc6..1a250a83b10 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -46,12 +46,12 @@ if (isset($_SESSION['DolMessage'])) { } // Security check -if ($user->societe_id) { +if ($user->socid) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } -if ($user->societe_id) - $socid = $user->societe_id; +if ($user->socid) + $socid = $user->socid; // Get parameters $sortfield = GETPOST("sortfield", 'alpha'); diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 4ad0fe0e261..15f6a1236d5 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -40,7 +40,7 @@ if (isset($_GET["account"]) || isset($_GET["ref"])) $id = isset($_GET["account"])?$_GET["account"]:(isset($_GET["ref"])?$_GET["ref"]:''); } $fieldid = isset($_GET["ref"])?'ref':'rowid'; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid); $account=GETPOST("account"); diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 389cde747af..7e96ddf31be 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -53,7 +53,7 @@ $cancel=GETPOST('cancel', 'alpha'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :'')); $fieldtype = (! empty($ref) ? 'ref' :'rowid'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype); if (! $user->rights->banque->lire && ! $user->rights->banque->consolidate) accessforbidden(); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 1b06a0e222b..524e3f44cbc 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -50,7 +50,7 @@ $search_status=GETPOST('search_status')?GETPOST('search_status', 'alpha'):'opene $optioncss = GETPOST('optioncss', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; if (! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Dictionary with list of banks accounting account allowed to manager of chart account if (! $allowed) $result=restrictedArea($user, 'banque'); diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index ae01b761b1b..cb029902372 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -57,7 +57,7 @@ $newbankreceipt=GETPOST('newbankreceipt', 'alpha'); // Security check $fieldid = (! empty($ref)?$ref:$id); $fieldname = isset($ref)?'ref':'rowid'; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'banque', $fieldid, 'bank_account', '', '', $fieldname); if ($user->rights->banque->consolidate && $action == 'dvnext' && ! empty($dvid)) diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index a9294474115..7ca62b67ab8 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -42,7 +42,7 @@ if (isset($_GET["account"]) || isset($_GET["ref"])) $id = isset($_GET["account"])?$_GET["account"]:(isset($_GET["ref"])?$_GET["ref"]:''); } $fieldid = isset($_GET["ref"])?'ref':'rowid'; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid); diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 5cb9d3c9558..30472729d92 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -57,7 +57,7 @@ $category_transaction = GETPOST("category_transaction", 'alpha'); // Security check $socid = GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'banque', '', '', ''); $object = new PaymentVarious($db); diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 21598990aba..7070946e2c7 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -39,7 +39,7 @@ $confirm = GETPOST('confirm', 'alpha'); // Security check $socid = GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'banque', '', '', ''); // Get parameters diff --git a/htdocs/compta/bank/various_payment/info.php b/htdocs/compta/bank/various_payment/info.php index 7d55703802e..7498872881d 100644 --- a/htdocs/compta/bank/various_payment/info.php +++ b/htdocs/compta/bank/various_payment/info.php @@ -35,7 +35,7 @@ $action=GETPOST('action', 'aZ09'); // Security check $socid = GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'banque', '', '', ''); /* diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 6c15c40ecaa..cad88367aa0 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -35,7 +35,7 @@ $langs->loadLangs(array("compta","banks","bills","accountancy")); // Security check $socid = GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'banque', '', '', ''); $optioncss = GETPOST('optioncss', 'alpha'); diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index dce1c13bc40..e0461d35368 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -90,9 +90,9 @@ if (! $sortorder) $sortorder="ASC"; // Security check $socid=0; -if ($user->societe_id > 0) // Protection if external user +if ($user->socid > 0) // Protection if external user { - //$socid = $user->societe_id; + //$socid = $user->socid; accessforbidden(); } //$result = restrictedArea($user, 'monmodule', $id, ''); diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 9694166590f..5fe9853ec54 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -45,7 +45,7 @@ $hookmanager->initHooks(array('specialexpensesindex')); $langs->loadLangs(array('compta', 'bills')); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax|salaries', '', '', 'charges|'); $mode=GETPOST("mode", 'alpha'); diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index b7652587826..15f3504268b 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -30,10 +30,10 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $action=GETPOST('action', 'aZ09'); // Secrutiy check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } if (! $user->rights->facture->lire) diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 6a320970396..dd56e611545 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -40,7 +40,7 @@ $langs->load("trips"); // Security check $id = GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'deplacement', $id, ''); $action = GETPOST('action', 'alpha'); @@ -287,7 +287,7 @@ if ($action == 'create') print ''; // Private note - if (empty($user->societe_id)) + if (empty($user->socid)) { print ''; print ''; @@ -385,7 +385,7 @@ elseif ($id) print ""; // Private note - if (empty($user->societe_id)) + if (empty($user->socid)) { print ''; print ''; print ''; print ''; print ''; - if (empty($user->societe_id)) + if (empty($user->socid)) { print ''; print ''; print ''; } -if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id)) +if ($usemargins && ! empty($conf->margin->enabled) && empty($user->socid)) { if (!empty($user->rights->margins->creer)) { diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 165a4ba8a9a..ff66726b207 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -257,7 +257,7 @@ if ($this->situation_cycle_ref) print ''; } -if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id)) +if ($usemargins && ! empty($conf->margin->enabled) && empty($user->socid)) { if (!empty($user->rights->margins->creer)) { ?> diff --git a/htdocs/document.php b/htdocs/document.php index ac7d96e0b03..d31ccc47c48 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -88,7 +88,7 @@ if (empty($original_file) && empty($hashp)) accessforbidden('Bad link. Missing i if ($modulepart == 'fckeditor') $modulepart='medias'; // For backward compatibility $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; // For some module part, dir may be privates if (in_array($modulepart, array('facture_paiement','unpaid'))) @@ -187,7 +187,7 @@ if (! empty($hashp)) else { // Basic protection (against external users only) - if ($user->societe_id > 0) + if ($user->socid > 0) { if ($sqlprotectagainstexternals) { @@ -199,7 +199,7 @@ else while ($i < $num) { $obj = $db->fetch_object($resql); - if ($user->societe_id != $obj->fk_soc) + if ($user->socid != $obj->fk_soc) { $accessallowed=0; break; diff --git a/htdocs/don/card.php b/htdocs/don/card.php index bc3d8302afa..51244206516 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -432,7 +432,7 @@ if ($action == 'create') print ''; // Private note - if (empty($user->societe_id)) { + if (empty($user->socid)) { print ''; print ''; print '"; // Note Private - if ($object->note_private && ! $user->societe_id) + if ($object->note_private && ! $user->socid) { print ''; print ''; // Private note - if (empty($user->societe_id)) { + if (empty($user->socid)) { print ''; print ''; print ''; // Private note - if (empty($user->societe_id)) + if (empty($user->socid)) { print ''; print ''; @@ -1608,7 +1608,7 @@ elseif ($id > 0 || ! empty($ref)) // modified by hook if (empty($reshook)) { - if ($user->societe_id == 0) + if ($user->socid == 0) { if ($action != 'editdescription' && ($action != 'presend')) { // Validate diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 429341cb490..ac0b7609520 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -160,7 +160,7 @@ class Fichinter extends CommonObject $sql = "SELECT count(fi.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter as fi"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON fi.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; diff --git a/htdocs/fichinter/class/fichinterstats.class.php b/htdocs/fichinter/class/fichinterstats.class.php index d762657caec..98eb218e9ef 100644 --- a/htdocs/fichinter/class/fichinterstats.class.php +++ b/htdocs/fichinter/class/fichinterstats.class.php @@ -200,7 +200,7 @@ class FichinterStats extends Stats $sql = "SELECT product.ref, COUNT(product.ref) as nb, 0 as total, 0 as avg"; $sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE ".$this->where; $sql.= " AND c.rowid = tl.fk_fichinter AND tl.fk_product = product.rowid"; $sql.= " AND c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'"; diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index 1a43bf8e9f8..562a38f7ea8 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -39,7 +39,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); $object = new Fichinter($db); diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index f9f67d5a05b..3b6b2bd6299 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -47,7 +47,7 @@ $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 178a7597626..bf20d6b5c12 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -42,10 +42,10 @@ $langs->load("interventions"); // Security check $socid=GETPOST('socid', 'int'); -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } @@ -89,7 +89,7 @@ $sql.= ", ".MAIN_DB_PREFIX."fichinter as f"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE f.entity IN (".getEntity('intervention').")"; $sql.= " AND f.fk_soc = s.rowid"; -if ($user->societe_id) $sql.=' AND f.fk_soc = '.$user->societe_id; +if ($user->socid) $sql.=' AND f.fk_soc = '.$user->socid; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " GROUP BY f.fk_statut"; $resql = $db->query($sql); diff --git a/htdocs/fichinter/info.php b/htdocs/fichinter/info.php index 30aec089ee6..3261ce84d89 100644 --- a/htdocs/fichinter/info.php +++ b/htdocs/fichinter/info.php @@ -40,7 +40,7 @@ $id = GETPOST('id', 'int'); $ref=GETPOST('ref', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); $object = new Fichinter($db); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index d45dadf2589..9cee1ec691c 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -59,7 +59,7 @@ $socid=GETPOST('socid', 'int'); // Security check $id = GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); $diroutputmassaction=$conf->ficheinter->dir_output . '/temp/massgeneration/'.$user->id; diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php index 954027a99da..2982a0ea8c8 100644 --- a/htdocs/fichinter/note.php +++ b/htdocs/fichinter/note.php @@ -39,7 +39,7 @@ $ref = GETPOST('ref', 'alpha'); $action=GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); $object = new Fichinter($db); diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index 326901728da..02bec47ed86 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -35,10 +35,10 @@ if (! $user->rights->ficheinter->lire) accessforbidden(); $userid=GETPOST('userid', 'int'); $socid=GETPOST('socid', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $nowyear=strftime("%Y", dol_now()); @@ -77,7 +77,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenamenb = $dir.'/interventionsnbinyear-'.$user->id.'-'.$year.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsnbinyear-'.$user->id.'-'.$year.'.png'; @@ -117,7 +117,7 @@ if (! $mesg) $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenameamount = $dir.'/interventionsamountinyear-'.$user->id.'-'.$year.'.png'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsamountinyear-'.$user->id.'-'.$year.'.png'; @@ -156,7 +156,7 @@ if (! $mesg) $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filename_avg = $dir.'/interventionsaverage-'.$user->id.'-'.$year.'.png'; $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=interventionstats&file=interventionsaverage-'.$user->id.'-'.$year.'.png'; diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index f3535d3cd1c..47f44aff059 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -52,7 +52,7 @@ $cancelbutton = GETPOST('cancel', 'alpha'); // Security check $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); -if ($user->societe_id) $id=$user->societe_id; +if ($user->socid) $id=$user->socid; $result = restrictedArea($user, 'societe&fournisseur', $id, '&societe', '', 'rowid'); $object = new Fournisseur($db); @@ -162,7 +162,7 @@ if ($object->id > 0) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; @@ -266,7 +266,7 @@ if ($object->id > 0) print '
'; print $langs->trans("CustomerRelativeDiscountShort"); print ''; - if ($user->rights->societe->creer && !$user->societe_id > 0) + if ($user->rights->societe->creer && !$user->socid > 0) { print ''.img_edit($langs->trans("Modify")).''; } @@ -401,7 +401,7 @@ if ($object->id > 0) print '
'; print $langs->trans("CustomerAbsoluteDiscountShort"); print ''; - if ($user->rights->societe->creer && !$user->societe_id > 0) + if ($user->rights->societe->creer && !$user->socid > 0) { print ''.img_edit($langs->trans("Modify")).''; } @@ -1274,7 +1274,7 @@ if ($object->id > 0) } // Add invoice - if ($user->societe_id == 0) + if ($user->socid == 0) { if (! empty($conf->deplacement->enabled) && $object->status==1) { diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index 10314b597e7..6c0aea2f935 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -47,7 +47,7 @@ $begin=GETPOST('begin', 'alpha'); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'societe', $socid, ''); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 725d60b8041..245d3874d92 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -51,10 +51,10 @@ $bid=GETPOST('bid', 'int'); // Securite acces client $socid=GETPOST('socid', 'int'); -if (isset($user->societe_id) && $user->societe_id > 0) +if (isset($user->socid) && $user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $max=3; @@ -561,10 +561,10 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) $sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm"; $sql.= ", s.code_fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fournisseur = 1"; $sql.= " AND s.entity IN (".getEntity($companystatic->element).")"; - if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; $sql.= " ORDER BY s.datec DESC"; $sql.= $db->plimit($max, 0); diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index 1049431b7f2..d9fbd9a37b2 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -41,7 +41,7 @@ if (! empty($conf->categorie->enabled)) { } // Security check -if (! $user->rights->mailing->lire || $user->societe_id > 0) +if (! $user->rights->mailing->lire || $user->socid > 0) accessforbidden(); // Load variable for pagination diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index c16d7237439..714a84fe95a 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load translation files required by the page $langs->load("mails"); -if (! $user->rights->mailing->lire || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->societe_id > 0)) accessforbidden(); +if (! $user->rights->mailing->lire || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) accessforbidden(); $id=(GETPOST('mailid', 'int') ? GETPOST('mailid', 'int') : GETPOST('id', 'int')); $action=GETPOST('action', 'alpha'); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index fc83b20d58f..819e0acf562 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $langs->load("mails"); // Security check -if (! $user->rights->mailing->lire || $user->societe_id > 0) accessforbidden(); +if (! $user->rights->mailing->lire || $user->socid > 0) accessforbidden(); // Load variable for pagination diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index 8d15f86915d..c0b01050d8f 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -33,7 +33,7 @@ $id=GETPOST('id'); $langs->load("mails"); // Security check -if (! $user->rights->mailing->lire || $user->societe_id > 0) +if (! $user->rights->mailing->lire || $user->socid > 0) accessforbidden(); diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 429e7f3dacf..c99048a8955 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -33,9 +33,9 @@ $langs->loadLangs(array('orders', 'companies')); $id = GETPOST('id', 'int'); $_socid = GETPOST("id", 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { - $_socid = $user->societe_id; + $_socid = $user->socid; } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 113d3baf503..17a4c485b3e 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -86,7 +86,7 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($co $NBLINES = 4; // Security check -if (! empty($user->societe_id)) $socid = $user->societe_id; +if (! empty($user->socid)) $socid = $user->socid; $result = restrictedArea($user, 'propal', $id); $object = new Propal($db); @@ -1717,7 +1717,7 @@ if ($action == 'create') print $doleditor->Create(1); // Private note - if (empty($user->societe_id)) + if (empty($user->socid)) { print '
' . $langs->trans('NotePrivate') . '
' . $langs->trans('NotePrivate') . ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4735da31060..6e01ba2f5e2 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3416,7 +3416,7 @@ class Commande extends CommonOrder $sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut, c.total_ht"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; @@ -3425,7 +3425,7 @@ class Commande extends CommonOrder $sql.= $clause." c.entity IN (".getEntity('commande').")"; //$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0"; $sql.= " AND ((c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_SHIPMENTONPROCESS.")) OR (c.fk_statut = ".self::STATUS_CLOSED." AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected - if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id; + if ($user->socid) $sql.=" AND c.fk_soc = ".$user->socid; $resql=$this->db->query($sql); if ($resql) @@ -3797,7 +3797,7 @@ class Commande extends CommonOrder $sql = "SELECT count(co.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as co"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index 10276e34c0e..0311f4c49ed 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -212,7 +212,7 @@ class CommandeStats extends Stats $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; $sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE ".$this->where; $sql.= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid"; $sql.= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'"; diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 57e37f9f903..97890c9d2ef 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -40,7 +40,7 @@ $ref=GETPOST('ref', 'alpha'); $action=GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'commande', $id, ''); $object = new Commande($db); diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 2f275adadb9..bcb445c546c 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -33,10 +33,10 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $action=GETPOST('action', 'aZ09'); // Secrutiy check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } if (! $user->rights->facture->creer) diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index fa825086c4a..565583e1fae 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -45,9 +45,9 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref'); // Security check -if ($user->societe_id) +if ($user->socid) { - $socid = $user->societe_id; + $socid = $user->socid; } $result=restrictedArea($user, 'commande', $id, ''); diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 2149c48121b..da1a4fc55df 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -42,10 +42,10 @@ $langs->loadLangs(array('orders', 'bills')); // Security check $socid=GETPOST('socid', 'int'); -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } @@ -92,7 +92,7 @@ $sql.= ", ".MAIN_DB_PREFIX."commande as c"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " AND c.entity IN (".getEntity('societe').")"; -if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id; +if ($user->socid) $sql.=' AND c.fk_soc = '.$user->socid; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " GROUP BY c.fk_statut"; diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index 7d8e319c5ae..4ca81f77771 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -42,7 +42,7 @@ $id = GETPOST("id", 'int'); $ref=GETPOST('ref', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'commande', $comid, ''); $object = new Commande($db); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 37dd5a8d570..fffb58429be 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -88,7 +88,7 @@ $search_project=GETPOST('search_project', 'alpha'); // Security check $id = (GETPOST('orderid')?GETPOST('orderid', 'int'):GETPOST('id', 'int')); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'commande', $id, ''); $diroutputmassaction=$conf->commande->multidir_output[$conf->entity] . '/temp/massgeneration/'.$user->id; diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 2cb69bd698b..5b8fe052b06 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -42,7 +42,7 @@ $action=GETPOST('action', 'alpha'); // Security check $socid=0; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'commande', $id, ''); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index fae23fa8bcd..35756a56487 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -139,7 +139,7 @@ if (($action == 'create' || $action == 'add') && !$error) // Security check $fieldid = GETPOST('ref', 'alpha')?'ref':'rowid'; - if ($user->societe_id) $socid=$user->societe_id; + if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); $usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE; @@ -503,7 +503,7 @@ if ($action == 'create' && !$error) print '
'.$langs->trans('NotePrivate').'
'.$langs->trans('NotePrivate').'
'.$langs->trans("NotePrivate").''; diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index 3f2faa267ea..96c8013c18c 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -43,7 +43,7 @@ $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'deplacement', $id, ''); diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index 0208f9da89f..659744a2ba0 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -32,7 +32,7 @@ $langs->loadLangs(array('companies', 'users', 'trips')); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'deplacement', '', ''); $sortfield = GETPOST("sortfield", 'alpha'); @@ -143,11 +143,11 @@ $langs->load("boxes"); $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut"; $sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u"; -if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE u.rowid = d.fk_user"; $sql.= " AND d.entity = ".$conf->entity; if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',', $childids).')'; -if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND d.fk_soc = ".$socid; $sql.= $db->order("d.tms", "DESC"); $sql.= $db->plimit($max, 0); diff --git a/htdocs/compta/deplacement/info.php b/htdocs/compta/deplacement/info.php index 510675265a0..28d1d8e68da 100644 --- a/htdocs/compta/deplacement/info.php +++ b/htdocs/compta/deplacement/info.php @@ -32,7 +32,7 @@ $langs->load("trips"); // Security check $id = GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'deplacement', $id, ''); diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 9b5b2b7d9c9..6d5d952d104 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -36,7 +36,7 @@ $langs->loadLangs(array('companies', 'users', 'trips')); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'deplacement', '', ''); $search_ref=GETPOST('search_ref', 'int'); diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 54e1cd1524e..ccb2ecb60fe 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -38,12 +38,12 @@ $socid=GETPOST('socid', 'int'); if ($socid < 0) $socid=0; $id = GETPOST('id', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'deplacement', $id, ''); // Other security check @@ -162,7 +162,7 @@ if (! $mesg) $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 08fbb019fd2..7296bc524e2 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -130,7 +130,7 @@ $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatede // Security check $fieldid = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid = $user->societe_id; +if ($user->socid) $socid = $user->socid; $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft); @@ -3334,7 +3334,7 @@ if ($action == 'create') print $doleditor->Create(1); // Private note - if (empty($user->societe_id)) + if (empty($user->socid)) { print '
'; @@ -3460,7 +3460,7 @@ elseif ($id > 0 || ! empty($ref)) // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); - if ($user->societe_id > 0 && $user->societe_id != $object->socid) + if ($user->socid > 0 && $user->socid != $object->socid) { accessforbidden('', 0, 1); } @@ -4547,7 +4547,7 @@ elseif ($id > 0 || ! empty($ref)) } print '' . price($sign * $objp->amount) . ''; - if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) + if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0) { print 'rowid.'">'; print img_delete(); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 20459641d66..ac39b84e428 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3961,7 +3961,7 @@ class Facture extends CommonInvoice $sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut, f.total"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON f.fk_soc = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; @@ -3970,7 +3970,7 @@ class Facture extends CommonInvoice $sql.= $clause." f.paye=0"; $sql.= " AND f.entity IN (".getEntity('invoice').")"; $sql.= " AND f.fk_statut = ".self::STATUS_VALIDATED; - if ($user->societe_id) $sql.= " AND f.fk_soc = ".$user->societe_id; + if ($user->socid) $sql.= " AND f.fk_soc = ".$user->socid; $resql=$this->db->query($sql); if ($resql) @@ -4211,7 +4211,7 @@ class Facture extends CommonInvoice $sql = "SELECT count(f.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 62960b71346..72bb79545e5 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -45,7 +45,7 @@ $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'facture', $id); $object = new Facture($db); diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 9527f66b79e..36f768991f8 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -49,9 +49,9 @@ $action=GETPOST('action', 'alpha'); $confirm=GETPOST('confirm', 'alpha'); // Security check -if ($user->societe_id) +if ($user->socid) { - $socid = $user->societe_id; + $socid = $user->socid; } $result=restrictedArea($user, 'facture', $id, ''); diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 79780402108..2c5cd1a87c7 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -58,7 +58,7 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'invoice $id=(GETPOST('facid', 'int')?GETPOST('facid', 'int'):GETPOST('id', 'int')); $lineid=GETPOST('lineid', 'int'); $ref=GETPOST('ref', 'alpha'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $objecttype = 'facture_rec'; if ($action == "create" || $action == "add") $objecttype = ''; $result = restrictedArea($user, 'facture', $id, $objecttype); @@ -1039,7 +1039,7 @@ if ($action == 'create') print $doleditor->Create(1); // Private note - if (empty($user->societe_id)) + if (empty($user->socid)) { print '
'; diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index f714d51cf6e..09873f5ee61 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -58,7 +58,7 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'invoice $id=(GETPOST('facid', 'int')?GETPOST('facid', 'int'):GETPOST('id', 'int')); $lineid=GETPOST('lineid', 'int'); $ref=GETPOST('ref', 'alpha'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $objecttype = 'facture_rec'; if ($action == "create" || $action == "add") $objecttype = ''; $result = restrictedArea($user, 'facture', $id, $objecttype); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 5f1ce9e44c3..ae24277a896 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -128,7 +128,7 @@ $pagenext = $page + 1; // Security check $fieldid = (! empty($ref)?'ref':'rowid'); -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); $diroutputmassaction=$conf->facture->dir_output . '/temp/massgeneration/'.$user->id; diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index beeb5f730ab..ff71b1ff9af 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -43,7 +43,7 @@ $action=GETPOST('action', 'alpha'); // Security check $socid=0; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'facture', $id, ''); $object = new Facture($db); diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index cf59af89cf6..485401d340e 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -47,7 +47,7 @@ $socid=GETPOST('socid', 'int'); $action=GETPOST('action', 'alpha'); $fieldid = (! empty($ref)?'ref':'rowid'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); $object = new Facture($db); diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index dadbb27b30d..5f81d34a092 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -41,10 +41,10 @@ $object_status=GETPOST('object_status'); $userid=GETPOST('userid', 'int'); $socid=GETPOST('socid', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $nowyear=strftime("%Y", dol_now()); @@ -159,7 +159,7 @@ if (! $mesg) $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index dc8a610f908..8531249afdb 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -56,10 +56,10 @@ $bid=GETPOST('bid', 'int'); // Security check $socid=''; -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $max=3; diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 1d7a1c1d406..54a8513fc0c 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -45,7 +45,7 @@ $date_endday=GETPOST('date_endday'); $date_endyear=GETPOST('date_endyear'); // Security check -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat'); if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport'); diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 74032e34d18..f6cc0ec03b6 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -47,7 +47,7 @@ $date_endday=GETPOST('date_endday'); $date_endyear=GETPOST('date_endyear'); // Security check -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat'); if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport'); diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index e7762b834e4..4acb3f108a3 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -40,7 +40,7 @@ $lttype=GETPOST('localTaxType', 'int'); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', '', '', 'charges'); $object = new Localtax($db); diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 97f97bbc735..c31a02b5b33 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -82,7 +82,7 @@ if (empty($modetax)) $modetax=0; // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', '', '', 'charges'); if (empty($local)) diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index c02de96035d..6fa963ad25e 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -76,7 +76,7 @@ if (empty($modetax)) $modetax=0; // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', '', '', 'charges'); diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index 0b0716b53a9..cfa1d492a60 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -29,7 +29,7 @@ $langs->load("compta"); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', '', '', 'charges'); $ltt=GETPOST("localTaxType"); diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 0251173a863..0c49f23dc3d 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -94,7 +94,7 @@ if (empty($modetax)) $modetax=0; // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', '', '', 'charges'); if (empty($local)) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index d0377ad9ff1..5590a45f97f 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -59,9 +59,9 @@ $multicurrency_amounts=array(); $multicurrency_amountsresttopay=array(); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { - $socid = $user->societe_id; + $socid = $user->socid; } $object=new Facture($db); diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 3def70036ee..1fd4f735a50 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -44,7 +44,7 @@ $confirm=GETPOST('confirm', 'alpha'); $backtopage=GETPOST('backtopage', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; // TODO ajouter regle pour restreindre acces paiement //$result = restrictedArea($user, 'facture', $id,''); @@ -429,7 +429,7 @@ print '
'; if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { - if ($user->societe_id == 0 && $object->statut == 0 && $_GET['action'] == '') + if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '') { if ($user->rights->facture->paiement) { @@ -438,7 +438,7 @@ if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) } } -if ($user->societe_id == 0 && $action == '') +if ($user->socid == 0 && $action == '') { if ($user->rights->facture->paiement) { diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 3afce69e94b..f91ac35f678 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -43,7 +43,7 @@ $confirm=GETPOST('confirm', 'alpha'); // Security check $fieldname = (! empty($ref)?'ref':'rowid'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque', '', 'fk_user_author', $fieldname); $sortfield=GETPOST('sortfield', 'alpha'); @@ -770,12 +770,12 @@ else print '
'; -if ($user->societe_id == 0 && ! empty($object->id) && $object->statut == 0 && $user->rights->banque->cheque) +if ($user->socid == 0 && ! empty($object->id) && $object->statut == 0 && $user->rights->banque->cheque) { print ''.$langs->trans('Validate').''; } -if ($user->societe_id == 0 && ! empty($object->id) && $user->rights->banque->cheque) +if ($user->socid == 0 && ! empty($object->id) && $user->rights->banque->cheque) { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 940013df44e..6f0438644a6 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -506,7 +506,7 @@ class RemiseCheque extends CommonObject // phpcs:enable global $conf, $langs; - if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe + if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe $sql = "SELECT b.rowid, b.datev as datefin"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; @@ -561,7 +561,7 @@ class RemiseCheque extends CommonObject // phpcs:enable global $user; - if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe + if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe $sql = "SELECT count(b.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index cdbc56896cb..bbec9e1fba7 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->loadLangs(array('banks', 'categories', 'compta', 'bills')); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'banque', '', ''); diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 396432545d9..2201412f3f8 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->loadLangs(array('banks', 'categories', 'bills')); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'banque', '', ''); $search_ref = GETPOST('search_ref', 'alpha'); diff --git a/htdocs/compta/paiement/index.php b/htdocs/compta/paiement/index.php index fa47915f216..89136ec5712 100644 --- a/htdocs/compta/paiement/index.php +++ b/htdocs/compta/paiement/index.php @@ -19,7 +19,7 @@ require '../../main.inc.php'; // Security check -if (!$user->admin && $user->societe_id > 0) +if (!$user->admin && $user->socid > 0) accessforbidden(); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 090cc7c83fb..7913d1f8dea 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -51,7 +51,7 @@ $month = GETPOST('month', 'int'); $year = GETPOST('year', 'int'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'facture', $facid, ''); $paymentstatic=new Paiement($db); diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 35325dce4cb..0140031431f 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -34,10 +34,10 @@ if (! $user->rights->facture->lire) accessforbidden(); $action=GETPOST('action', 'aZ09'); $socid=0; -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $dir = $conf->facture->dir_output.'/payments'; diff --git a/htdocs/compta/paiement/tovalidate.php b/htdocs/compta/paiement/tovalidate.php index 120e326d6a2..e3c23041ec8 100644 --- a/htdocs/compta/paiement/tovalidate.php +++ b/htdocs/compta/paiement/tovalidate.php @@ -32,10 +32,10 @@ if (! $user->rights->facture->lire) accessforbidden(); $socid=0; -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index e2a4bdac11f..238ac01fd1a 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -36,9 +36,9 @@ $amounts = array(); // Security check $socid=0; -if ($user->societe_id > 0) +if ($user->socid > 0) { - $socid = $user->societe_id; + $socid = $user->socid; } diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index ebfad45bb67..ecc3a23430a 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -39,7 +39,7 @@ $langs->loadLangs(array('bills', 'banks', 'companies')); $id=GETPOST("id", 'int'); $action=GETPOST('action', 'aZ09'); $confirm=GETPOST('confirm'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; // TODO ajouter regle pour restreindre acces paiement //$result = restrictedArea($user, 'facture', $id,''); @@ -299,7 +299,7 @@ print '
'; /* if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { - if ($user->societe_id == 0 && $object->statut == 0 && $_GET['action'] == '') + if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '') { if ($user->rights->facture->paiement) { diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index ecea96b7a09..eb18618ab62 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -33,7 +33,7 @@ $langs->loadLangs(array('banks', 'categories', 'widthdrawals')); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 1282226623c..6c60cdaa059 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -37,7 +37,7 @@ if (!$user->rights->prelevement->bons->lire) accessforbidden(); // Security check -if ($user->societe_id > 0) accessforbidden(); +if ($user->socid > 0) accessforbidden(); // Get supervariables $action = GETPOST('action', 'alpha'); diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 3aaad5662a3..c4cad05d1f6 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bills')); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); // Get supervariables diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 4ea74e83b4f..52b312e6b4c 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -36,7 +36,7 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies')); // Security check $socid = GETPOST('socid', 'int'); $status = GETPOST('status', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectlist'; // To manage different context of search diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index fbc36418222..334e36c5a68 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->loadLangs(array('banks', 'categories', 'companies', 'withdrawals', 'bills')); // Securite acces client -if ($user->societe_id > 0) accessforbidden(); +if ($user->socid > 0) accessforbidden(); // Get supervariables $prev_id = GETPOST('id', 'int'); diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 3dbfec69461..17e8dcebe98 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->loadLangs(array("banks","categories",'withdrawals','bills')); // Securite acces client -if ($user->societe_id > 0) accessforbidden(); +if ($user->socid > 0) accessforbidden(); // Get supervariables $prev_id = GETPOST('id', 'int'); diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index c8914b41f26..01fde1b2450 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->loadLangs(array("banks","categories",'withdrawals','bills')); // Security check -if ($user->societe_id > 0) accessforbidden(); +if ($user->socid > 0) accessforbidden(); // Get supervariables $prev_id = GETPOST('id', 'int'); diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index b800339031d..3af40c84dcb 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -38,7 +38,7 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals')); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'prelevement', '', ''); diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 41ac08b0fb2..454861dea73 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->loadlangs(array('banks', 'categories', 'bills', 'withdrawals')); // Security check -if ($user->societe_id > 0) accessforbidden(); +if ($user->socid > 0) accessforbidden(); // Get supervariables $action = GETPOST('action', 'alpha'); diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 2ffb8def303..c016f1e6c02 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -34,7 +34,7 @@ $langs->loadLangs(array('banks', 'withdrawals', 'companies', 'categories')); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index 6cde242ae93..4235f5d7fc3 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -35,7 +35,7 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies')); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); // Get supervariables diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index 0dd5087869c..1b9396a411a 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -33,7 +33,7 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies')); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index 6fc1a3b16b2..88a72344f52 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -35,7 +35,7 @@ if (! empty($conf->facture->enabled)) $langs->load("bills"); $id = GETPOST('id')?GETPOST('id', 'int'):GETPOST('socid', 'int'); // Security check -if ($user->societe_id) $id=$user->societe_id; +if ($user->socid) $id=$user->socid; $result = restrictedArea($user, 'societe', $id, '&societe'); $object = new Societe($db); @@ -96,7 +96,7 @@ if ($id > 0) $head = societe_prepare_head($object); dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), 0, 'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 1); + dol_banner_tab($object, 'socid', '', ($user->socid?0:1), 'rowid', 'nom', '', '', 0, '', '', 1); dol_fiche_end(); if (! empty($conf->facture->enabled) && $user->rights->facture->lire) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 5fb1a9755cc..c85894c60d6 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -50,7 +50,7 @@ $showaccountdetail = GETPOST('showaccountdetail', 'aZ09')?GETPOST('showaccountde // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat'); if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport'); diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 2f9c55ea9d2..33609f98997 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -98,7 +98,7 @@ $nbofyear = ($year_end - $year_start) + 1; // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat'); if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport'); diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 8b8f7126568..9af5a559f5e 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -130,7 +130,7 @@ if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING'; if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta", 'alpha'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) accessforbidden(); if (! $user->rights->accounting->comptarapport->lire) accessforbidden(); diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 79b0e97b8b1..f35b145b969 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -49,7 +49,7 @@ $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', $id, 'chargesociales', 'charges'); $object = new ChargeSociales($db); diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index dfdca9cdf6a..4a714df8bae 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -47,7 +47,7 @@ $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', $id, 'chargesociales', 'charges'); diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php index 7fedbbba700..e449f907bc8 100644 --- a/htdocs/compta/sociales/info.php +++ b/htdocs/compta/sociales/info.php @@ -39,7 +39,7 @@ $action=GETPOST('action', 'aZ09'); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', $id, 'chargesociales', 'charges'); $object = new ChargeSociales($db); diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 06e0135dd67..6fbf174abc5 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -42,7 +42,7 @@ $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'sclist'; // Security check $socid = isset($_GET["socid"])?$_GET["socid"]:''; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', '', '', 'charges'); $search_ref = GETPOST('search_ref', 'int'); diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 96a64a76bd5..d22bd80722a 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->loadLangs(array('compta', 'bills')); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax|salaries', '', '', 'charges|'); $mode=GETPOST("mode", 'alpha'); diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 590269b332c..08ddd9a576e 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -107,7 +107,7 @@ if (empty($modetax)) $modetax=0; // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', '', '', 'charges'); diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 5570b08435b..138bff4a525 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -36,7 +36,7 @@ $langs->loadLangs(array("products","categories","errors",'accountancy')); // Security pack (data & check) $socid = GETPOST('socid', 'int'); -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat'); if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport'); diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 8973c92f68f..286e6aeb29a 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -35,7 +35,7 @@ $langs->load("accountancy"); $socid = GETPOST('socid', 'int'); // Security check -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat'); if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport'); diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 139e9f22160..68f9e0d9f99 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -57,7 +57,7 @@ if (GETPOST('subcat', 'alpha') === 'yes') { } // Security check -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat'); if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport'); diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index cf28a4cd5d6..ac3e800e6e4 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -98,7 +98,7 @@ if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING'; if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta", 'alpha'); // Security check -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat'); if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport'); diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index e58fa66acaf..dbbaa8d56fc 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -40,7 +40,7 @@ if (empty($refund)) $refund=0; // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', '', '', 'charges'); $object = new Tva($db); diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 576ea819fda..e97e4554b41 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -90,7 +90,7 @@ if (empty($modetax)) $modetax=0; // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', '', '', 'charges'); diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index d26d8954cc4..d3a5b60d7ba 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -48,7 +48,7 @@ $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', $id, 'vat', 'charges'); diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index d6019c1eef5..1ed3658b37a 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -76,7 +76,7 @@ if (empty($modetax)) $modetax=0; // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', '', '', 'charges'); diff --git a/htdocs/compta/tva/info.php b/htdocs/compta/tva/info.php index 667cffd065b..6190a30f316 100644 --- a/htdocs/compta/tva/info.php +++ b/htdocs/compta/tva/info.php @@ -34,7 +34,7 @@ $action=GETPOST('action', 'aZ09'); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', '', '', 'charges'); $object = new Tva($db); diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index cffa9152a92..e27093ff89f 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -36,7 +36,7 @@ $langs->loadLangs(array('compta', 'bills')); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', '', '', 'charges'); $search_ref = GETPOST('search_ref', 'int'); diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index bb9067d5a04..791c360ff67 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -91,7 +91,7 @@ if (empty($modetax)) $modetax=0; // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'tax', '', '', 'charges'); diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 30efcd28632..8ffc88d1a14 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -84,7 +84,7 @@ else $search_agenda_label=GETPOST('search_agenda_label'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php index d7cfe53b0bc..8ab92047daa 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php @@ -133,7 +133,7 @@ if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['act control->tpl['showend']; -if (empty($user->societe_id)) { +if (empty($user->socid)) { print '
'; if ($user->rights->societe->contact->creer) { print ''.$langs->trans('Modify').''; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 3e255c80d4f..fe64122b52c 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -74,7 +74,7 @@ if (! empty($canvas)) } // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 2779a0398eb..033c9471f51 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -155,7 +155,7 @@ class Contact extends CommonObject $sql = "SELECT count(sp.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -164,7 +164,7 @@ class Contact extends CommonObject } $sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element).')'; $sql.= " AND (sp.priv='0' OR (sp.priv='1' AND sp.fk_user_creat=".$user->id."))"; - if ($user->societe_id > 0) $sql.=" AND sp.fk_soc = ".$user->societe_id; + if ($user->socid > 0) $sql.=" AND sp.fk_soc = ".$user->socid; $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 56427347dd4..4b08d3cb95a 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -121,7 +121,7 @@ if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) } $morehtmlref.='
'; -dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', $morehtmlref); +dol_banner_tab($object, 'id', $linkback, ($user->socid?0:1), 'rowid', 'nom', $morehtmlref); print '
'; diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 1dbc22d1a51..8533cb13feb 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -51,7 +51,7 @@ if (! empty($canvas)) } // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission // Get parameters diff --git a/htdocs/contact/info.php b/htdocs/contact/info.php index 3cb46276d43..2546f5d19e4 100644 --- a/htdocs/contact/info.php +++ b/htdocs/contact/info.php @@ -34,7 +34,7 @@ $langs->load("companies"); // Security check $id = GETPOST("id", 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); $object = new Contact($db); diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 826b5d3db39..cf2bf91bf99 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -36,7 +36,7 @@ $action=GETPOST('action', 'aZ09'); // Security check $id = GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); $object = new Contact($db); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 8eae77faa56..f8d92d19b34 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -52,7 +52,7 @@ $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'contactl $id = GETPOST('id', 'int'); $contactid = GETPOST('id', 'int'); $ref = ''; // There is no ref for contacts -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'contact', $contactid, ''); $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index 72ee557c085..230211cca5e 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -36,7 +36,7 @@ $langs->load("companies"); // Security check $id = GETPOST('id', 'int'); -if ($user->societe_id) $id=$user->societe_id; +if ($user->socid) $id=$user->socid; $result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); $object = new Contact($db); diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 3a09f294849..093245025cd 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -35,7 +35,7 @@ $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); $object = new Contact($db); @@ -319,7 +319,7 @@ else if ($action != 'edit') { // Barre d'actions - if ($user->societe_id == 0) + if ($user->socid == 0) { print '
'; diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index df1629b46a6..4eb794a3054 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -52,7 +52,7 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'contrat', $id, ''); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 3a8e4f99a65..4e0226d4cae 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -62,7 +62,7 @@ $datecontrat=''; $usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:0); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'contrat', $id); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -1256,7 +1256,7 @@ if ($action == 'create') print $doleditor->Create(1); print '
'.$langs->trans("NotePrivate").''; $doleditor=new DolEditor('note_private', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, '90%'); @@ -1890,7 +1890,7 @@ else print '
'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).''; - if ($user->societe_id == 0) + if ($user->socid == 0) { if ($object->statut > 0 && $action != 'activateline' && $action != 'unactivateline') { @@ -2098,7 +2098,7 @@ else * Buttons */ - if ($user->societe_id == 0) + if ($user->socid == 0) { print '
'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 62c3d1bd312..0b9c6768eda 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2157,7 +2157,7 @@ class Contrat extends CommonObject $this->from = " FROM ".MAIN_DB_PREFIX."contrat as c"; $this->from.= ", ".MAIN_DB_PREFIX."contratdet as cd"; $this->from.= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $this->from.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $this->from.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($mode == 'inactive') { @@ -2188,8 +2188,8 @@ class Contrat extends CommonObject } $sql.= " AND c.fk_soc = s.rowid"; $sql.= " AND c.entity = ".$conf->entity; - if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($user->socid) $sql.=" AND c.fk_soc = ".$user->socid; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; $resql=$this->db->query($sql); if ($resql) @@ -2260,7 +2260,7 @@ class Contrat extends CommonObject $sql = "SELECT count(c.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 85247327dda..56a0c198db3 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -43,7 +43,7 @@ $id = GETPOST('id', 'int'); $ref=GETPOST('ref', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'contrat', $id); $object = new Contrat($db); diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 7fbc291839d..fceba285f47 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -46,11 +46,11 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { unset($_GET["action"]); $action=''; - $socid = $user->societe_id; + $socid = $user->socid; } $result = restrictedArea($user, 'contrat', $id); diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 8fd54a4f8e4..9d96ca7be5e 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -46,7 +46,7 @@ $statut=GETPOST('statut')?GETPOST('statut'):1; // Security check $socid=0; $id = GETPOST('id', 'int'); -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result = restrictedArea($user, 'contrat', $id); $staticcompany=new Societe($db); @@ -114,7 +114,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX $sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid"; $sql.= " AND (cd.statut != 4 OR (cd.statut = 4 AND (cd.date_fin_validite is null or cd.date_fin_validite >= '".$db->idate($now)."')))"; $sql.= " AND c.entity IN (".getEntity('contract', 0).")"; -if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id; +if ($user->socid) $sql.=' AND c.fk_soc = '.$user->socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " GROUP BY cd.statut"; $resql = $db->query($sql); @@ -151,7 +151,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX $sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid"; $sql.= " AND (cd.statut = 4 AND cd.date_fin_validite < '".$db->idate($now)."')"; $sql.= " AND c.entity IN (".getEntity('contract', 0).")"; -if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id; +if ($user->socid) $sql.=' AND c.fk_soc = '.$user->socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " GROUP BY cd.statut"; $resql = $db->query($sql); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 0fd27d29826..3df193d53d2 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -84,7 +84,7 @@ if (! $sortorder) $sortorder='DESC'; // Security check $id=GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'contrat', $id); $diroutputmassaction=$conf->contrat->dir_output . '/temp/massgeneration/'.$user->id; diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 25772c08193..e4cceff10e0 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -41,7 +41,7 @@ $id=GETPOST('id', 'int'); $ref=GETPOST('ref', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'contrat', $id); $object = new Contrat($db); diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 81c0b13449b..a7656289fdd 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -90,7 +90,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, // Security check $contratid = GETPOST('id', 'int'); -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result = restrictedArea($user, 'contrat', $contratid); if ($search_status != '') diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index d6a2ba77f05..b369550dda2 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -104,7 +104,7 @@ if (empty($url)) $langs->loadLangs(array("ecm","companies","other")); // Security check -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; //print 'xxx'.$upload_dir; diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index e812e8b9a3c..0d662b6a0bd 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -39,8 +39,8 @@ $element=GETPOST('element', 'alpha'); $object = new GenericObject($db); // Security check -if (! empty($user->societe_id)) - $socid = $user->societe_id; +if (! empty($user->socid)) + $socid = $user->socid; diff --git a/htdocs/core/ajax/pingresult.php b/htdocs/core/ajax/pingresult.php index 9de6e53a0f5..eec1c9f0aca 100644 --- a/htdocs/core/ajax/pingresult.php +++ b/htdocs/core/ajax/pingresult.php @@ -36,8 +36,8 @@ $hash_algo=GETPOST('hash_algo', 'alpha'); // Security check -if (! empty($user->societe_id)) - $socid = $user->societe_id; +if (! empty($user->socid)) + $socid = $user->socid; $now = dol_now(); diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index af86e73ce2c..c104384434d 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -90,13 +90,13 @@ class box_actions extends ModeleBoxes $sql.= ", s.rowid as socid"; $sql.= ", s.code_client"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm AS ta, ".MAIN_DB_PREFIX."actioncomm AS a"; - if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; + if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " WHERE a.fk_action = ta.id"; $sql.= " AND a.entity = ".$conf->entity; $sql.= " AND a.percent >= 0 AND a.percent < 100"; - if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")"; $sql.= " ORDER BY a.datec DESC"; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index c18bf2f3bf3..9609f596618 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -84,7 +84,7 @@ class box_activity extends ModeleBoxes $totalnb = 0; $line = 0; $cachetime = 3600; - $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache'; + $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache'; $now = dol_now(); $nbofperiod=3; @@ -113,12 +113,12 @@ class box_activity extends ModeleBoxes { $sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ")"; $sql.= " WHERE p.entity IN (".getEntity('propal').")"; $sql.= " AND p.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; $sql.= " AND p.datep >= '".$this->db->idate($tmpdate)."'"; $sql.= " AND p.date_cloture IS NULL"; // just unclosed $sql.= " GROUP BY p.fk_statut"; @@ -202,12 +202,12 @@ class box_activity extends ModeleBoxes if ($refresh) { $sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ")"; $sql.= " WHERE c.entity = ".$conf->entity; $sql.= " AND c.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; $sql.= " AND c.date_commande >= '".$this->db->idate($tmpdate)."'"; $sql.= " GROUP BY c.fk_statut"; $sql.= " ORDER BY c.fk_statut DESC"; @@ -286,11 +286,11 @@ class box_activity extends ModeleBoxes { $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ")"; $sql.= " WHERE f.entity IN (".getEntity('invoice').')'; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; $sql.= " AND f.fk_soc = s.rowid"; $sql.= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=1"; $sql.= " GROUP BY f.fk_statut"; diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 185f581b5c5..feb7564cdaf 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -97,11 +97,11 @@ class box_clients extends ModeleBoxes $sql.= ", s.email"; $sql.= ", s.datec, s.tms, s.status"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (1, 3)"; $sql.= " AND s.entity IN (".getEntity('societe').")"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($user->societe_id) $sql.= " AND s.rowid = $user->societe_id"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($user->socid) $sql.= " AND s.rowid = $user->socid"; $sql.= " ORDER BY s.tms DESC"; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 327f06fc0c9..40d809fd6e7 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -102,12 +102,12 @@ class box_commandes extends ModeleBoxes $sql.= ", c.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."commande as c"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " AND c.entity = ".$conf->entity; if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY)) $sql.=" AND c.fk_statut = 1"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($user->socid) $sql.= " AND s.rowid = ".$user->socid; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC "; else $sql.= " ORDER BY c.tms DESC, c.ref DESC "; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 02ed249d3b6..c4259b6252a 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -64,7 +64,7 @@ class box_comptes extends ModeleBoxes // disable module for such cases $listofmodulesforexternal=explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); - if (! in_array('banque', $listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0; // disabled for external users + if (! in_array('banque', $listofmodulesforexternal) && ! empty($user->socid)) $this->enabled=0; // disabled for external users $this->hidden = ! ($user->rights->banque->lire); } diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 09e33c5f6a8..5bdb17ba0b9 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -90,10 +90,10 @@ class box_contacts extends ModeleBoxes $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON sp.fk_pays = co.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid"; - if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE sp.entity IN (".getEntity('socpeople').")"; - if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($user->societe_id) $sql.= " AND sp.fk_soc = ".$user->societe_id; + if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($user->socid) $sql.= " AND sp.fk_soc = ".$user->socid; $sql.= " ORDER BY sp.tms DESC"; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 0d155f158e9..37fdf45f118 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -87,11 +87,11 @@ class box_contracts extends ModeleBoxes $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture"; $sql.= ", c.ref_customer, c.ref_supplier"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " AND c.entity = ".$conf->entity; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_contrat DESC, c.ref DESC "; else $sql.= " ORDER BY c.tms DESC, c.ref DESC "; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 09841f4a4a8..65724f5fa4b 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -97,12 +97,12 @@ class box_factures extends ModeleBoxes $sql.= ", s.rowid as socid, s.nom as name, s.code_client, s.email, s.tva_intra, s.code_compta, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6"; $sql.= ", f.date_lim_reglement as datelimite"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ")"; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.entity IN (".getEntity('invoice').")"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY f.datef DESC, f.ref DESC "; else $sql.= " ORDER BY f.tms DESC, f.ref DESC "; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 46e2da3ab62..9eb836fe1e2 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -99,11 +99,11 @@ class box_factures_fourn extends ModeleBoxes $sql.= ' f.date_lim_reglement as datelimite, f.tms, f.type'; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.entity = ".$conf->entity; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY f.datef DESC, f.ref DESC "; else $sql.= " ORDER BY f.tms DESC, f.ref DESC "; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 0a6c7e904a3..3c0fc6444a2 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -91,13 +91,13 @@ class box_factures_fourn_imp extends ModeleBoxes $sql.= " f.paye, f.fk_statut, f.type"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ",".MAIN_DB_PREFIX."facture_fourn as f"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.paye=0"; $sql.= " AND fk_statut = 1"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; $sql.= " ORDER BY datelimite DESC, f.ref_supplier DESC "; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 3c4ba1c9736..992e1333390 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -100,15 +100,15 @@ class box_factures_imp extends ModeleBoxes $sql.= " f.paye, f.fk_statut, f.rowid as facid"; $sql.= ", sum(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.entity IN (".getEntity('invoice').")"; $sql.= " AND f.paye = 0"; $sql.= " AND fk_statut = 1"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; $sql.= " GROUP BY s.nom, s.rowid, s.code_client, s.logo, f.ref, f.date_lim_reglement,"; $sql.= " f.type, f.amount, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid"; //$sql.= " ORDER BY f.datef DESC, f.ref DESC "; diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index ed3569cc3e4..b0851ed28c0 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -92,8 +92,8 @@ class box_ficheinter extends ModeleBoxes $sql.= ", ".MAIN_DB_PREFIX."fichinter as f"; $sql.= " WHERE f.fk_soc = s.rowid "; $sql.= " AND f.entity = ".$conf->entity; - if (! $user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (! $user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; $sql.= " ORDER BY f.tms DESC"; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 6369b25987a..5f26351affe 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -88,11 +88,11 @@ class box_fournisseurs extends ModeleBoxes $sql.= " s.code_fournisseur, s.email as semail,"; $sql.= " s.logo"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fournisseur = 1"; $sql.= " AND s.entity IN (".getEntity('societe').")"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($user->socid) $sql.= " AND s.rowid = ".$user->socid; $sql.= " ORDER BY s.tms DESC "; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 5f951362be7..91ec36fd500 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -92,7 +92,7 @@ class box_graph_invoices_permonth extends ModeleBoxes $dir=''; // We don't need a path because image file will not be saved into disk $prefix=''; $socid=0; - if ($user->societe_id) $socid=$user->societe_id; + if ($user->socid) $socid=$user->socid; if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user if ($user->rights->facture->lire) diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 6d65ea7f534..9be3a986fa9 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -91,7 +91,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $dir=''; // We don't need a path because image file will not be saved into disk $prefix=''; $socid=0; - if ($user->societe_id) $socid=$user->societe_id; + if ($user->socid) $socid=$user->socid; if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user if ($user->rights->fournisseur->facture->lire) diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 53952bb437b..5ea1bb9f764 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -92,7 +92,7 @@ class box_graph_orders_permonth extends ModeleBoxes $dir=''; // We don't need a path because image file will not be saved into disk $prefix=''; $socid=0; - if ($user->societe_id) $socid=$user->societe_id; + if ($user->socid) $socid=$user->socid; if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user if ($user->rights->commande->lire) diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 911ac7a91b1..fba42b42eba 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -91,7 +91,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $dir=''; // We don't need a path because image file will not be saved into disk $prefix=''; $socid=0; - if ($user->societe_id) $socid=$user->societe_id; + if ($user->socid) $socid=$user->socid; if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user if ($user->rights->fournisseur->commande->lire) diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 332f92b7ace..7bcc85aa47f 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -128,7 +128,7 @@ class box_graph_product_distribution extends ModeleBoxes ); - $socid=empty($user->societe_id)?0:$user->societe_id; + $socid=empty($user->socid)?0:$user->socid; $userid=0; // No filter on user creation $WIDTH=($nbofgraph >= 2 || ! empty($conf->dol_optimize_smallscreen))?'160':'320'; diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index a06c5d8ff83..150e9517c8a 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -94,7 +94,7 @@ class box_graph_propales_permonth extends ModeleBoxes $dir=''; // We don't need a path because image file will not be saved into disk $prefix=''; $socid=0; - if ($user->societe_id) $socid=$user->societe_id; + if ($user->socid) $socid=$user->socid; if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user if ($user->rights->propale->lire) diff --git a/htdocs/core/boxes/box_last_modified_ticket.php b/htdocs/core/boxes/box_last_modified_ticket.php index 56299c60429..de2bbd79181 100644 --- a/htdocs/core/boxes/box_last_modified_ticket.php +++ b/htdocs/core/boxes/box_last_modified_ticket.php @@ -96,9 +96,9 @@ class box_last_modified_ticket extends ModeleBoxes $sql.= " WHERE t.entity = ".$conf->entity; // $sql.= " AND e.rowid = er.fk_event"; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($user->societe_id) { - $sql.= " AND t.fk_soc= ".$user->societe_id; + //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($user->socid) { + $sql.= " AND t.fk_soc= ".$user->socid; } $sql.= " ORDER BY t.tms DESC, t.rowid DESC "; diff --git a/htdocs/core/boxes/box_last_ticket.php b/htdocs/core/boxes/box_last_ticket.php index cf4b7f305f7..4c66c647477 100644 --- a/htdocs/core/boxes/box_last_ticket.php +++ b/htdocs/core/boxes/box_last_ticket.php @@ -96,9 +96,9 @@ class box_last_ticket extends ModeleBoxes $sql .= " WHERE t.entity = " . $conf->entity; // $sql.= " AND e.rowid = er.fk_event"; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($user->societe_id) { - $sql .= " AND t.fk_soc= " . $user->societe_id; + //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($user->socid) { + $sql .= " AND t.fk_soc= " . $user->socid; } //$sql.= " AND t.fk_statut > 9"; diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 1e4588f05cf..29f37751ce9 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -63,7 +63,7 @@ class box_members extends ModeleBoxes // disable module for such cases $listofmodulesforexternal=explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); - if (! in_array('adherent', $listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0; // disabled for external users + if (! in_array('adherent', $listofmodulesforexternal) && ! empty($user->socid)) $this->enabled=0; // disabled for external users $this->hidden = ! ($user->rights->adherent->lire); } diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 23c4cc368cf..5cccd24ad6a 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -63,7 +63,7 @@ class box_produits extends ModeleBoxes $listofmodulesforexternal=explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); $tmpentry=array('enabled'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'perms'=>(! empty($user->rights->produit->lire) || ! empty($user->rights->service->lire)), 'module'=>'product|service'); - $showmode=isVisibleToUserType(($user->societe_id > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal); + $showmode=isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal); $this->hidden = ($showmode != 1); } diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 22509a6c9a2..3c674cd32c0 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -65,7 +65,7 @@ class box_produits_alerte_stock extends ModeleBoxes $listofmodulesforexternal=explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); $tmpentry=array('enabled'=>((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && ! empty($conf->stock->enabled)), 'perms'=>($user->rights->stock->lire), 'module'=>'product|service|stock'); - $showmode=isVisibleToUserType(($user->societe_id > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal); + $showmode=isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal); $this->hidden = ($showmode != 1); } diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 9053e5f2ab3..48a6d260e2c 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -89,7 +89,7 @@ class box_project extends ModeleBoxes $projectstatic = new Project($this->db); $socid=0; - //if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. + //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. // Get list of project id allowed to user (in a string list separated by coma) $projectsListId=''; diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 0ba1b1565f8..1fe8c2a0ed8 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -88,11 +88,11 @@ class box_propales extends ModeleBoxes $sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE p.fk_soc = s.rowid"; $sql.= " AND p.entity = ".$conf->entity; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY p.datep DESC, p.ref DESC "; else $sql.= " ORDER BY p.tms DESC, p.ref DESC "; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index b489247e0b1..9d6a10b6225 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -94,11 +94,11 @@ class box_prospect extends ModeleBoxes $sql.= ", s.logo"; $sql.= ", s.fk_stcomm, s.datec, s.tms, s.status"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (2, 3)"; $sql.= " AND s.entity IN (".getEntity('societe').")"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($user->socid) $sql.= " AND s.rowid = ".$user->socid; $sql.= " ORDER BY s.tms DESC"; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index f080403aba3..dbb26408b6f 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -96,10 +96,10 @@ class box_services_contracts extends ModeleBoxes $sql.= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= ")"; $sql.= " WHERE c.entity = ".$conf->entity; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; $sql.= $this->db->order("c.tms", "DESC"); $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index b56674adaa0..9ddfa229e55 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -87,12 +87,12 @@ class box_services_expired extends ModeleBoxes $sql.= " s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql.= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '".$this->db->idate($now)."'"; $sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0"; - if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($user->socid) $sql.=' AND c.fk_soc = '.$user->socid; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, c.ref_customer, c.ref_supplier, s.nom, s.rowid"; $sql.= " ORDER BY date_line ASC"; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 42c1b7464b9..a95c008688b 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -93,11 +93,11 @@ class box_supplier_orders extends ModeleBoxes $sql.= " c.fk_statut"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " AND c.entity = ".$conf->entity; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($user->socid) $sql.= " AND s.rowid = ".$user->socid; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC "; else $sql.= " ORDER BY c.tms DESC, c.ref DESC "; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 8cc8de94295..f5399cd9eea 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -216,7 +216,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box $cachetime = 900; // 900 : 15mn $cachedir = DOL_DATA_ROOT.'/boxes/temp'; - $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'.cache'; + $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'.cache'; $filename = '/box-'.$fileid; $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $out = ''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4461f409b42..0f70652242c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1746,7 +1746,7 @@ abstract class CommonObject // Security on socid $socid = 0; - if ($user->societe_id > 0) $socid = $user->societe_id; + if ($user->socid > 0) $socid = $user->socid; // this->ismultientitymanaged contains // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4c057b3bdb6..0aca6a94213 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1651,7 +1651,7 @@ class Form $sql.= " WHERE u.entity IN (0,".$conf->entity.")"; } } - if (! empty($user->societe_id)) $sql.= " AND u.fk_soc = ".$user->societe_id; + if (! empty($user->socid)) $sql.= " AND u.fk_soc = ".$user->socid; if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN (".$excludeUsers.")"; if ($includeUsers) $sql.= " AND u.rowid IN (".$includeUsers.")"; if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) $sql.= " AND u.statut <> 0"; diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 25a46090b1d..613992bdd2a 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -195,7 +195,7 @@ class FormMargin { global $langs, $conf, $user; - if (! empty($user->societe_id)) return; + if (! empty($user->socid)) return; if (! $user->rights->margins->liretous) return; diff --git a/htdocs/core/get_menudiv.php b/htdocs/core/get_menudiv.php index 1fe50a963b4..edebf8a31b4 100644 --- a/htdocs/core/get_menudiv.php +++ b/htdocs/core/get_menudiv.php @@ -174,7 +174,7 @@ $(document).ready(function(){ '; -if (empty($user->societe_id)) // If internal user or not defined +if (empty($user->socid)) // If internal user or not defined { $conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED); } @@ -202,7 +202,7 @@ if (! class_exists('MenuManager')) include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu; } } -$menumanager = new MenuManager($db, empty($user->societe_id)?0:1); +$menumanager = new MenuManager($db, empty($user->socid)?0:1); $menumanager->loadMenu('all', 'all'); // Load this->tabMenu with sql menu entries //var_dump($menumanager);exit; $menumanager->showmenu('jmobile'); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index ced8c37c6d7..9f4f1021b4c 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -268,7 +268,7 @@ function societe_prepare_head(Societe $object) // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'thirdparty'); - if ($user->societe_id == 0) + if ($user->socid == 0) { // Notifications if (! empty($conf->notification->enabled)) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index a4b96a6b650..d5226bb7e3d 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -217,7 +217,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f { $featureforlistofmodule=$feature; if ($featureforlistofmodule == 'produit') $featureforlistofmodule='product'; - if (! empty($user->societe_id) && ! empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && ! in_array($featureforlistofmodule, $listofmodules)) // If limits on modules for external users, module must be into list of modules for external users + if (! empty($user->socid) && ! empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && ! in_array($featureforlistofmodule, $listofmodules)) // If limits on modules for external users, module must be into list of modules for external users { $readok=0; $nbko++; continue; diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 7beadc9496b..a65d51d5f04 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -108,7 +108,7 @@ function user_prepare_head($object) } // Notifications - if ($user->societe_id == 0 && ! empty($conf->notification->enabled)) + if ($user->socid == 0 && ! empty($conf->notification->enabled)) { $nbNote = 0; $sql = "SELECT COUNT(n.rowid) as nb"; @@ -157,7 +157,7 @@ function user_prepare_head($object) } // Such info on users is visible only by internal user - if (empty($user->societe_id)) + if (empty($user->socid)) { // Notes $nbNote = 0; diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 5f27a68d63a..6819ab864b3 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -316,7 +316,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t // We update newmenu with entries found into database $menuArbo = new Menubase($db, 'auguria'); - $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, ($user->societe_id?1:0), 'auguria', $tabMenu); + $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, ($user->socid?1:0), 'auguria', $tabMenu); // We update newmenu for special dynamic menus if ($conf->banque->enabled && $user->rights->banque->lire && $mainmenu == 'bank') // Entry for each bank account diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 380b6a22355..d9f0d663754 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1852,7 +1852,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Add personalized menus and modules menus //var_dump($newmenu->liste); // $menuArbo = new Menubase($db, 'eldy'); - $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->societe_id)?0:1), 'eldy', $tabMenu); + $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->socid)?0:1), 'eldy', $tabMenu); //var_dump($newmenu->liste); // // We update newmenu for special dynamic menus diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php index 5ad2ba0d03a..aca3f4686e5 100644 --- a/htdocs/core/modules/modMargin.class.php +++ b/htdocs/core/modules/modMargin.class.php @@ -86,7 +86,7 @@ class modMargin extends DolibarrModules // New pages on tabs $this->tabs = array( 'product:+margin:Margins:margins:$user->rights->margins->liretous:/margin/tabs/productMargins.php?id=__ID__', - 'thirdparty:+margin:Margins:margins:empty($user->societe_id) && $user->rights->margins->liretous && ($object->client > 0):/margin/tabs/thirdpartyMargins.php?socid=__ID__' + 'thirdparty:+margin:Margins:margins:empty($user->socid) && $user->rights->margins->liretous && ($object->client > 0):/margin/tabs/thirdpartyMargins.php?socid=__ID__' ); diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 2eaaef08447..7393f0e198d 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -101,7 +101,7 @@ class pdf_paiement global $conf, $hookmanager, $langs, $user; $socid=0; - if ($user->societe_id) $socid=$user->societe_id; + if ($user->socid) $socid=$user->socid; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO diff --git a/htdocs/core/tools.php b/htdocs/core/tools.php index 4f517603d63..f598bd31d83 100644 --- a/htdocs/core/tools.php +++ b/htdocs/core/tools.php @@ -29,7 +29,7 @@ $langs->loadLangs(array("companies","other")); // Security check $socid=0; -if ($user->societe_id > 0) $socid=$user->societe_id; +if ($user->socid > 0) $socid=$user->socid; diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 14c65c9cbf1..c2be08aa5da 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -86,7 +86,7 @@ if ($module != 'product') { print '
'."\n"; print ''."\n"; } -if (empty($user->societe_id)) { +if (empty($user->socid)) { print '
'."\n"; print '
'."\n"; print $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0); diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 82362e9d113..157e24f64b9 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -86,7 +86,7 @@ if ($this->situation_cycle_ref) { print '
' . $langs->trans('TotalHT100Short') . '' . price($tmp[0]) . 'pa_ht); ?>
' . $langs->trans('NotePrivate') . ''; diff --git a/htdocs/don/document.php b/htdocs/don/document.php index 93004163b2e..982de549969 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -50,7 +50,7 @@ $confirm = GETPOST('confirm', 'alpha'); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'don', $id, ''); diff --git a/htdocs/don/info.php b/htdocs/don/info.php index 12444938fdf..c16cfce10bb 100644 --- a/htdocs/don/info.php +++ b/htdocs/don/info.php @@ -39,7 +39,7 @@ $action=GETPOST('action', 'alpha'); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'don', $id, ''); $object = new Don($db); diff --git a/htdocs/don/note.php b/htdocs/don/note.php index b076ce60350..e1db83bdb7a 100644 --- a/htdocs/don/note.php +++ b/htdocs/don/note.php @@ -45,7 +45,7 @@ $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); // Security check $socid=0; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'don', $id, ''); $object = new Don($db); diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php index 1aa6b8072ae..36b9b78cf10 100644 --- a/htdocs/don/payment/card.php +++ b/htdocs/don/payment/card.php @@ -36,7 +36,7 @@ $langs->loadLangs(array("bills","banks","companies")); $id=GETPOST('rowid')?GETPOST('rowid', 'int'):GETPOST('id', 'int'); $action=GETPOST('action', 'aZ09'); $confirm=GETPOST('confirm'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; // TODO Add rule to restrict access payment //$result = restrictedArea($user, 'facture', $id,''); @@ -272,7 +272,7 @@ print '
'; /* if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { - if ($user->societe_id == 0 && $object->statut == 0 && $_GET['action'] == '') + if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '') { if ($user->rights->facture->paiement) { diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index 72882a79068..6a7871ba31b 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -35,8 +35,8 @@ $amounts = array(); // Security check $socid=0; -if ($user->societe_id > 0) { - $socid = $user->societe_id; +if ($user->socid > 0) { + $socid = $user->socid; } $object = new Don($db); diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index 8a740ff6941..1604ceb3870 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -35,10 +35,10 @@ $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height'); $userid=GETPOST('userid', 'int'); $socid=GETPOST('socid', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $nowyear=strftime("%Y", dol_now()); @@ -72,7 +72,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenamenb = $dir.'/shipmentsnbinyear-'.$user->id.'-'.$year.'.png'; } @@ -112,7 +112,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); //var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenameamount = $dir.'/shipmentsamountinyear-'.$user->id.'-'.$year.'.png'; } @@ -150,7 +150,7 @@ if (! $mesg) /* $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filename_avg = $dir.'/shipmentsaverage-'.$user->id.'-'.$year.'.png'; } diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php index 4c28e4c159d..56120d206b4 100644 --- a/htdocs/ecm/dir_add_card.php +++ b/htdocs/ecm/dir_add_card.php @@ -44,10 +44,10 @@ $pageid = GETPOST('pageid', 'int'); if (empty($module)) $module='ecm'; // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $section=$urlsection=GETPOST('section', 'alpha'); diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php index 4e8585508c6..fcfa5b71205 100644 --- a/htdocs/ecm/file_card.php +++ b/htdocs/ecm/file_card.php @@ -40,10 +40,10 @@ if (!$user->rights->ecm->setup) accessforbidden(); $socid = GETPOST("socid", "int"); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $sortfield = GETPOST("sortfield", 'alpha'); diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 9d78ad5fd32..e51efb01aaa 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; $langs->loadLangs(array("ecm","companies","other","users","orders","propal","bills","contracts")); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'ecm', 0); // Get parameters diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 86d34080789..2fb4e88368a 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; $langs->loadLangs(array("ecm","companies","other","users","orders","propal","bills","contracts")); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'ecm', 0); // Get parameters diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 37f6e22798b..a801b6fca3b 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; $langs->loadLangs(array("ecm","companies","other","users","orders","propal","bills","contracts")); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'ecm', ''); // Load permissions diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 6f61403211a..0c5874a5563 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -69,7 +69,7 @@ $line_id = GETPOST('lineid', 'int')?GETPOST('lineid', 'int'):''; // Security check $socid=''; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; if ($origin == 'expedition') $result=restrictedArea($user, $origin, $id); else { @@ -980,7 +980,7 @@ if ($action == 'create') print "
'.$langs->trans("NotePrivate").''; @@ -2492,7 +2492,7 @@ elseif ($id || $ref) * Boutons actions */ - if (($user->societe_id == 0) && ($action!='presend')) + if (($user->socid == 0) && ($action!='presend')) { print '
'; diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index b8e6af1db85..1cd050cb89e 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -42,7 +42,7 @@ $ref=GETPOST('ref', 'alpha'); $action=GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'expedition', $id, ''); $object = new Expedition($db); diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index 9faaaf1f88e..0018ba3cd06 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -46,9 +46,9 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref'); // Security check -if ($user->societe_id) +if ($user->socid) { - $socid = $user->societe_id; + $socid = $user->socid; } $result=restrictedArea($user, 'expedition', $id, ''); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 1840569fd0e..888f7037efb 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -46,7 +46,7 @@ $toselect = GETPOST('toselect', 'array'); // Security check $expeditionid = GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'expedition', $expeditionid, ''); $search_ref_exp = GETPOST("search_ref_exp", 'alpha'); diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 25ccf938963..1ae26471eb8 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -41,7 +41,7 @@ $action=GETPOST('action', 'alpha'); // Security check $socid=''; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, $origin, $origin_id); $object = new Expedition($db); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index a5c9125d844..2bc1e9a23ef 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -53,7 +53,7 @@ $hookmanager->initHooks(array('ordershipmentcard')); // Security check $socid=0; -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result=restrictedArea($user, 'commande', $id); $object = new Commande($db); @@ -856,7 +856,7 @@ if ($id > 0 || ! empty($ref)) * Boutons Actions */ - if (empty($user->societe_id)) + if (empty($user->socid)) { print '
'; diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php index b6c3f7355a9..b2aea807b5f 100644 --- a/htdocs/expedition/stats/index.php +++ b/htdocs/expedition/stats/index.php @@ -34,10 +34,10 @@ $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height'); $userid=GETPOST('userid', 'int'); $socid=GETPOST('socid', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $nowyear=strftime("%Y", dol_now()); @@ -71,7 +71,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenamenb = $dir.'/shipmentsnbinyear-'.$user->id.'-'.$year.'.png'; } @@ -111,7 +111,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); //var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenameamount = $dir.'/shipmentsamountinyear-'.$user->id.'-'.$year.'.png'; } @@ -149,7 +149,7 @@ if (! $mesg) /* $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filename_avg = $dir.'/shipmentsaverage-'.$user->id.'-'.$year.'.png'; } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 0f7242442fe..ecf1803cb50 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -68,7 +68,7 @@ $childids = $user->getAllChildIds(1); // Security check $id=GETPOST("id", 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'expensereport', $id, 'expensereport'); @@ -1521,7 +1521,7 @@ if ($action == 'create') print '
' . $langs->trans('NotePrivate') . ''; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index aed8a4e8693..42011fafaf9 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2336,7 +2336,7 @@ class ExpenseReport extends CommonObject // phpcs:enable global $conf, $langs; - if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe + if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe $now=dol_now(); diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php index 6a8bd90f95f..1bf2c0db8da 100644 --- a/htdocs/expensereport/document.php +++ b/htdocs/expensereport/document.php @@ -43,7 +43,7 @@ $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'expensereport', $id, 'expensereport'); diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index 83d60990b4e..e893fdf43f4 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -42,7 +42,7 @@ $langs->loadLangs(array('companies', 'users', 'trips')); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'expensereport', '', ''); $sortfield = GETPOST("sortfield", 'alpha'); @@ -165,7 +165,7 @@ $langs->load("boxes"); $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut, u.photo, d.rowid, d.ref, d.date_debut as dated, d.date_fin as datef, d.date_create as dm, d.total_ht, d.total_ttc, d.fk_statut as fk_status"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."user as u"; -if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE u.rowid = d.fk_user_author"; // RESTRICT RIGHTS if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) @@ -176,7 +176,7 @@ if (empty($user->rights->expensereport->readall) && empty($user->rights->expense $sql.= " AND d.fk_user_author IN (".join(',', $childids).")\n"; } $sql.= ' AND d.entity IN ('.getEntity('expensereport').')'; -if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_user_author = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND d.fk_user_author = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND d.fk_user_author = ".$socid; $sql.= $db->order($sortfield, $sortorder); $sql.= $db->plimit($max, 0); diff --git a/htdocs/expensereport/info.php b/htdocs/expensereport/info.php index b9605a92eec..715530e9199 100644 --- a/htdocs/expensereport/info.php +++ b/htdocs/expensereport/info.php @@ -33,7 +33,7 @@ $langs->load("trips"); // Security check $id = GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'expensereport', $id, 'expensereport'); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 5a0bb291596..6f837fb866c 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -53,7 +53,7 @@ $childids = $user->getAllChildIds(1); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'expensereport', '', ''); $id = GETPOST('id', 'int'); // If we are on the view of a specific user diff --git a/htdocs/expensereport/note.php b/htdocs/expensereport/note.php index b29e24d4374..a5038b32b0e 100644 --- a/htdocs/expensereport/note.php +++ b/htdocs/expensereport/note.php @@ -39,7 +39,7 @@ $action=GETPOST('action', 'alpha'); // Security check $socid=0; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'expensereport', $id, 'expensereport'); diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php index 99c4c81d294..72b7296ac6b 100644 --- a/htdocs/expensereport/payment/card.php +++ b/htdocs/expensereport/payment/card.php @@ -36,7 +36,7 @@ $action=GETPOST('action', 'aZ09'); $confirm=GETPOST('confirm'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; // TODO Add rule to restrict access payment //$result = restrictedArea($user, 'facture', $id,''); diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index fd3f725da5a..7fb79573ab2 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -39,9 +39,9 @@ $accountid=GETPOST('accountid', 'int'); // Security check $socid=0; -if ($user->societe_id > 0) +if ($user->socid > 0) { - $socid = $user->societe_id; + $socid = $user->socid; } diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index 670142836cd..5d6301353db 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -42,12 +42,12 @@ $socid=GETPOST('socid', 'int'); if ($socid < 0) $socid=0; $id = GETPOST('id', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'expensereport', $id, ''); $nowyear=strftime("%Y", dol_now()); @@ -146,7 +146,7 @@ if (! $mesg) $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index caead930491..aaf2aec0490 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -52,7 +52,7 @@ $langs->loadLangs(array("interventions","admin","compta","bills")); // Security check $id=(GETPOST('fichinterid', 'int')?GETPOST('fichinterid', 'int'):GETPOST('id', 'int')); $action=GETPOST('action', 'alpha'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $objecttype = 'fichinter_rec'; if ($action == "create" || $action == "add") $objecttype = ''; $result = restrictedArea($user, 'ficheinter', $id, $objecttype); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 1ed9432ffb0..8bb064ca803 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -74,7 +74,7 @@ $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empt $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -978,7 +978,7 @@ if ($action == 'create') print '
'.$langs->trans('NotePrivate').'
'; // Private note - if (empty($user->societe_id)) { + if (empty($user->socid)) { print ''; print ''; print ''; print '"; // Note Private - if ($object->note_private && ! $user->societe_id) + if ($object->note_private && ! $user->socid) { print ''; print ''; // Creation date @@ -889,7 +889,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd } // Show user list to assignate one if status is "read" - if (GETPOST('set', 'alpha') == "assign_ticket" && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) { + if (GETPOST('set', 'alpha') == "assign_ticket" && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { print ''; print ''; print ''; @@ -906,7 +906,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd print '
'; print $langs->trans("CustomerRelativeDiscountShort"); print ''; - if ($user->rights->societe->creer && !$user->societe_id > 0) + if ($user->rights->societe->creer && !$user->socid > 0) { print ''.img_edit($langs->trans("Modify")).''; } @@ -280,7 +280,7 @@ if ($object->id > 0) print '
'; print $langs->trans("CustomerAbsoluteDiscountShort"); print ''; - if ($user->rights->societe->creer && !$user->societe_id > 0) + if ($user->rights->societe->creer && !$user->socid > 0) { print ''.img_edit($langs->trans("Modify")).''; } diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index c0473759a6d..711261a161b 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -118,7 +118,7 @@ class Fournisseur extends Societe $sql = "SELECT count(s.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; @@ -191,10 +191,10 @@ class Fournisseur extends Societe $sql = "SELECT s.rowid, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fournisseur = 1"; $sql.= " AND s.entity IN (".getEntity('societe').")"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $resql=$this->db->query($sql); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 584cd7ecf64..96d56d98fdf 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2752,7 +2752,7 @@ class CommandeFournisseur extends CommonOrder $sql = "SELECT count(co.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as co"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; @@ -2795,7 +2795,7 @@ class CommandeFournisseur extends CommonOrder $sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.fk_statut, c.date_livraison as delivery_date"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; @@ -2808,7 +2808,7 @@ class CommandeFournisseur extends CommonOrder else{ $sql.= " AND c.fk_statut IN (".self::STATUS_VALIDATED.", ".self::STATUS_ACCEPTED.")"; } - if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id; + if ($user->socid) $sql.=" AND c.fk_soc = ".$user->socid; $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 247779583c6..783e8b3737e 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2191,12 +2191,12 @@ class FactureFournisseur extends CommonInvoice $sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin, ff.fk_statut'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as ff'; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ' WHERE ff.paye=0'; $sql.= ' AND ff.fk_statut > 0'; $sql.= " AND ff.entity = ".$conf->entity; - if ($user->societe_id) $sql.=' AND ff.fk_soc = '.$user->societe_id; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; + if ($user->socid) $sql.=' AND ff.fk_soc = '.$user->socid; + if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; $resql=$this->db->query($sql); if ($resql) @@ -2494,7 +2494,7 @@ class FactureFournisseur extends CommonInvoice $sql = "SELECT count(f.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 97ce70a8a28..2475b251f56 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -81,7 +81,7 @@ $datelivraison=dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -2329,7 +2329,7 @@ elseif (! empty($object->id)) * Boutons actions */ - if ($user->societe_id == 0 && $action != 'editline' && $action != 'delete') + if ($user->socid == 0 && $action != 'editline' && $action != 'delete') { print '
'; diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 4db112bcb0f..63a2935212e 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -41,7 +41,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande'); $object = new CommandeFournisseur($db); diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 0884a416d65..0d9782b3683 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -51,8 +51,8 @@ $id = GETPOST("id", 'int'); $ref = GETPOST('ref'); $lineid = GETPOST('lineid', 'int'); $action = GETPOST('action', 'aZ09'); -if ($user->societe_id) - $socid = $user->societe_id; +if ($user->socid) + $socid = $user->socid; $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande'); if (empty($conf->stock->enabled)) { diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 6ebb83a25dc..8fbe54e8580 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -47,7 +47,7 @@ $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande'); // Get parameters diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 6804f96545d..5a8e0446cea 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; // Security check $orderid = GETPOST('orderid'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande'); $hookmanager = new HookManager($db); @@ -81,7 +81,7 @@ $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE cf.fk_soc = s.rowid"; $sql.= " AND cf.entity = ".$conf->entity; -if ($user->societe_id) $sql.=' AND cf.fk_soc = '.$user->societe_id; +if ($user->socid) $sql.=' AND cf.fk_soc = '.$user->socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " GROUP BY cf.fk_statut"; @@ -168,7 +168,7 @@ $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE cf.fk_soc = s.rowid"; $sql.= " AND s.entity = ".$conf->entity; -if ($user->societe_id) $sql.=' AND cf.fk_soc = '.$user->societe_id; +if ($user->socid) $sql.=' AND cf.fk_soc = '.$user->socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " GROUP BY cf.fk_statut"; diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index 8b0b17c066b..4f73b373589 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -53,7 +53,7 @@ $search_agenda_label=GETPOST('search_agenda_label'); // Security check $socid=0; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande'); if (!$user->rights->fournisseur->commande->lire) accessforbidden(); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 4201321913f..f8325ce8b0f 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -91,7 +91,7 @@ $viewstatut=GETPOST('viewstatut'); // Security check $orderid = GETPOST('orderid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande'); $diroutputmassaction=$conf->fournisseur->commande->dir_output . '/temp/massgeneration/'.$user->id; diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 61e4029f795..63629af25bb 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -40,7 +40,7 @@ $ref = GETPOST('ref'); $action = GETPOST('action', 'aZ09'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande'); $object = new CommandeFournisseur($db); diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 6b546a04e91..7005d3029f4 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -139,8 +139,8 @@ if (($action == 'create' || $action == 'add') && ! $error) { $search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref') : GETPOST('search_ref'); // Security check - if ($user->societe_id) - $socid = $user->societe_id; + if ($user->socid) + $socid = $user->socid; $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); $usehm = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE; @@ -398,7 +398,7 @@ if ($action == 'create' && !$error) { print '
' . $langs->trans('NotePrivate') . ''; diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php index 99a1c85902a..649c24408a1 100644 --- a/htdocs/fourn/contact.php +++ b/htdocs/fourn/contact.php @@ -35,10 +35,10 @@ $langs->load("companies"); llxHeader(); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $sortfield = GETPOST("sortfield", 'alpha'); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index cef40f089e1..310f0fc065f 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -95,7 +95,7 @@ if ($id > 0 || ! empty($ref)) // Security check $socid=''; -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $isdraft = (($object->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture', 'fk_soc', 'rowid', $isdraft); @@ -2786,7 +2786,7 @@ else } print '' . price($sign * $objp->amount) . ''; - if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) + if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0) { print 'rowid.'">'; print img_delete(); @@ -3089,13 +3089,13 @@ else } // Make payments - if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) + if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0) { print ''; // must use facid because id is for payment id not invoice } // Classify paid - if ($action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) + if ($action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0) { print ''; diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 2d2f9006632..18f64d15734 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -41,7 +41,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); $object = new FactureFournisseur($db); diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index d8cf1ecda27..087325e3de0 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -46,7 +46,7 @@ $confirm=GETPOST('confirm', 'alpha'); $ref = GETPOST('ref', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); // Get parameters diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 78abccdc250..0a10d58764a 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -39,10 +39,10 @@ $socid=GETPOST('socid', 'int'); $option = GETPOST('option'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $sortfield = GETPOST("sortfield", 'alpha'); diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index 6b4af5dd290..8f10fd94dc4 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -40,7 +40,7 @@ $id = GETPOST("facid", 'int')?GETPOST("facid", 'int'):GETPOST("id", 'int'); $ref = GETPOST("ref", 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); $object = new FactureFournisseur($db); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 7c8a78cf8ce..b13e283ea65 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -60,11 +60,11 @@ $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'supplier $socid = GETPOST('socid', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action=''; $_GET["action"] = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $mode=GETPOST("mode"); diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 03a4dda960e..a7200495e96 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -40,7 +40,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); $object = new FactureFournisseur($db); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 38136aa3b64..1dc10406a24 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -78,9 +78,9 @@ $multicurrency_amounts=array(); $multicurrency_amountsresttopay=array(); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { - $socid = $user->societe_id; + $socid = $user->socid; } $object = new PaiementFourn($db); diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php index 94ef53f2372..59ad242fa05 100644 --- a/htdocs/fourn/facture/rapport.php +++ b/htdocs/fourn/facture/rapport.php @@ -30,16 +30,16 @@ $langs->loadLangs(array('bills')); // Security check $socid=''; -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); $action=GETPOST('action', 'aZ09'); $socid=0; -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $dir = $conf->fournisseur->facture->dir_output.'/payments'; diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index a7107f0a5c8..3615051fa2f 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -32,7 +32,7 @@ $langs->loadLangs(array("suppliers", "orders", "companies")); // Security check $socid = GETPOST("socid", 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'societe', $socid, ''); diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index 1d8f72d94a3..3977c6ad4be 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -342,7 +342,7 @@ if ($result > 0) print '
'; if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { - if ($user->societe_id == 0 && $object->statut == 0 && $action == '') + if ($user->socid == 0 && $object->statut == 0 && $action == '') { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate))) @@ -351,7 +351,7 @@ if ($result > 0) } } } - if ($user->societe_id == 0 && $action == '') + if ($user->socid == 0 && $action == '') { if ($user->rights->fournisseur->facture->supprimer) { diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index b7119e3ae67..860cbde73ba 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -54,7 +54,7 @@ if (! $sortfield) $sortfield="p.ref"; // Set here default search field if (! $sortorder) $sortorder="ASC"; $fourn_id = GETPOST('fourn_id', 'intcomma'); -if ($user->societe_id) $fourn_id=$user->societe_id; +if ($user->socid) $fourn_id=$user->socid; $catid = GETPOST('catid', 'intcomma'); diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index deee321187b..7f9a7fb11ab 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -32,10 +32,10 @@ $langs->loadLangs(array('bills', 'companies')); // Security check $socid = GETPOST("socid", 'int'); -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } @@ -62,7 +62,7 @@ if ($socid > 0) $head = societe_prepare_head($societe); dol_fiche_head($head, 'supplier', $langs->trans("ThirdParty"), 0, 'company'); - dol_banner_tab($societe, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($societe, 'socid', '', ($user->socid?0:1), 'rowid', 'nom'); dol_fiche_end(); if (! empty($conf->fournisseur->enabled) && $user->rights->facture->lire) diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index 32d8ed44bb4..354fa5c0921 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php'; $langs->loadLangs(array('ftp', 'companies', 'other')); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'ftp', ''); // Get parameters diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 530bb125241..1fedae6a61e 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -90,7 +90,7 @@ if (! empty($user->rights->holiday->delete)) $candelete=1; if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) $candelete=1; // Protection if external user -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'holiday', $object->id, 'holiday'); diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index e71993a97fd..f18cad2a266 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2172,7 +2172,7 @@ class Holiday extends CommonObject // phpcs:enable global $conf, $langs; - if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe + if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe $now=dol_now(); diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index c5ab5e0e5ec..3419d663e30 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -53,7 +53,7 @@ if (! $sortorder) $sortorder="ASC"; // Protection if external user -if ($user->societe_id > 0) accessforbidden(); +if ($user->socid > 0) accessforbidden(); // If the user does not have perm to read the page if (!$user->rights->holiday->read) accessforbidden(); diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index 02e29774e93..bbf6cac4c87 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -45,7 +45,7 @@ $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'holiday', $id, 'holiday'); // Get parameters diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 7666335d2f0..8b30c03a1a9 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; $langs->loadLangs(array('users', 'holiday', 'hrm')); // Protection if external user -if ($user->societe_id > 0) accessforbidden(); +if ($user->socid > 0) accessforbidden(); $action = GETPOST('action', 'aZ09'); // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) @@ -59,9 +59,9 @@ $childids = $user->getAllChildIds(1); // Security check $socid=0; -if ($user->societe_id > 0) // Protection if external user +if ($user->socid > 0) // Protection if external user { - //$socid = $user->societe_id; + //$socid = $user->socid; accessforbidden(); } $result = restrictedArea($user, 'holiday', '', ''); diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 1d490cc8da3..c09771e47a3 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -35,9 +35,9 @@ $langs->loadLangs(array("holiday")); // Security check $socid=0; -if ($user->societe_id > 0) // Protection if external user +if ($user->socid > 0) // Protection if external user { - //$socid = $user->societe_id; + //$socid = $user->socid; accessforbidden(); } $result = restrictedArea($user, 'holiday', $id, ''); diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 13d4cb7d23a..9e5f0ad0cba 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -60,7 +60,7 @@ $pagenext = $page + 1; // Protection if external user -if ($user->societe_id > 0) accessforbidden(); +if ($user->socid > 0) accessforbidden(); // Si l'utilisateur n'a pas le droit de lire cette page if(!$user->rights->holiday->read_all) accessforbidden(); diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 9fa758f8338..5f390ab1d45 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -46,7 +46,7 @@ $langs->loadLangs(array('users', 'holidays', 'trips', 'boxes')); $socid=GETPOST("socid", "int"); // Protection if external user -if ($user->societe_id > 0) accessforbidden(); +if ($user->socid > 0) accessforbidden(); if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1; @@ -180,7 +180,7 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) $sql.= " WHERE u.rowid = x.fk_user"; $sql.= " AND x.entity = ".$conf->entity; if (empty($user->rights->holiday->read_all)) $sql.=' AND x.fk_user IN ('.join(',', $childids).')'; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; //if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid; $sql.= $db->order("x.tms", "DESC"); $sql.= $db->plimit($max, 0); @@ -259,11 +259,11 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire { $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u"; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE u.rowid = x.fk_user_author"; $sql.= " AND x.entity = ".$conf->entity; if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $sql.=' AND x.fk_user_author IN ('.join(',', $childids).')'; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; //if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid; $sql.= $db->order("x.tms", "DESC"); $sql.= $db->plimit($max, 0); diff --git a/htdocs/imports/index.php b/htdocs/imports/index.php index f674daddddc..2ce0139f517 100644 --- a/htdocs/imports/index.php +++ b/htdocs/imports/index.php @@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/imports/class/import.class.php'; // Load translation files required by the page $langs->load("exports"); -if (! $user->societe_id == 0) +if (! $user->socid == 0) accessforbidden(); $import=new Import($db); diff --git a/htdocs/index.php b/htdocs/index.php index 504f77d113e..37ea818817a 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -115,7 +115,7 @@ $boxstatFromHook = ''; // Load translation files required by page $langs->loadLangs(array('commercial', 'bills', 'orders', 'contracts')); -if (empty($user->societe_id) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) +if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) { $object=new stdClass(); $parameters=array(); @@ -437,7 +437,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of transactions to conciliate - if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id) { + if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid) { include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; $board = new Account($db); $nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate @@ -447,14 +447,14 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of cheque to send - if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) { + if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) { include_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php'; $board = new RemiseCheque($db); $dashboardlines['RemiseCheque'] = $board->load_board($user); } // Number of foundation members - if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->societe_id) { + if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->socid) { include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; $board = new Adherent($db); $dashboardlines['Adherent'] = $board->load_board($user); @@ -887,7 +887,7 @@ $boxlist.=$resultboxes['boxlista']; $boxlist.= '
'; -if (empty($user->societe_id) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) +if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) { // Remove allready present info in new dash board if(!empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD) && is_array($boxstatItems) && count($boxstatItems) > 0){ diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 2da7bd3fae6..3f6c6b493b1 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -56,7 +56,7 @@ $backtopage=GETPOST('backtopage', 'alpha'); // Security check $id = GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'expedition', $id, 'livraison', 'livraison'); $object = new Livraison($db); @@ -706,7 +706,7 @@ else * Boutons actions */ - if ($user->societe_id == 0) + if ($user->socid == 0) { print '
'; diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 066399320d8..7cf592a354c 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -44,7 +44,7 @@ $projectid = GETPOST('projectid', 'int'); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'loan', $id, '', ''); $object = new Loan($db); diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index 0cbcec2f209..a4bed07949e 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -40,7 +40,7 @@ $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'loan', $id, '', ''); // Get parameters diff --git a/htdocs/loan/info.php b/htdocs/loan/info.php index b4fb8851ad0..618345518ed 100644 --- a/htdocs/loan/info.php +++ b/htdocs/loan/info.php @@ -38,7 +38,7 @@ $action=GETPOST('action', 'aZ09'); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'loan', $id, '', ''); diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 7af7d55fb43..c77d6b1c855 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -32,7 +32,7 @@ $langs->loadLangs(array("loan","compta","banks","bills")); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'loan', '', '', ''); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 29b9df4bf70..1f937e6fe77 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -33,7 +33,7 @@ $langs->loadLangs(array("bills","banks","companies","loan")); $id=GETPOST("id", 'int'); $action=GETPOST('action', 'aZ09'); $confirm=GETPOST('confirm'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; // TODO ajouter regle pour restreindre acces paiement //$result = restrictedArea($user, 'facture', $id,''); @@ -271,7 +271,7 @@ print '
'; /* if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { - if ($user->societe_id == 0 && $payment->statut == 0 && $_GET['action'] == '') + if ($user->socid == 0 && $payment->statut == 0 && $_GET['action'] == '') { if ($user->rights->facture->paiement) { diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index 6742b0b1c04..742cf5ea5cf 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -38,9 +38,9 @@ $last=GETPOST('last'); // Security check $socid=0; -if ($user->societe_id > 0) +if ($user->socid > 0) { - $socid = $user->societe_id; + $socid = $user->socid; } $loan = new Loan($db); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 69ef6826b4e..efbe1a03a5e 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1020,7 +1020,7 @@ $heightforframes=50; // Init menu manager if (! defined('NOREQUIREMENU')) { - if (empty($user->societe_id)) // If internal user or not defined + if (empty($user->socid)) // If internal user or not defined { $conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED); } @@ -1048,7 +1048,7 @@ if (! defined('NOREQUIREMENU')) include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu; } } - $menumanager = new MenuManager($db, empty($user->societe_id)?0:1); + $menumanager = new MenuManager($db, empty($user->socid)?0:1); $menumanager->loadMenu(); } diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index b8f530660f1..a25528f58fb 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -36,7 +36,7 @@ $socid = GETPOST('socid', 'int'); $TSelectedProducts = GETPOST('products', 'array'); $TSelectedCats = GETPOST('categories', 'array'); -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result = restrictedArea($user, 'societe', '', ''); $result = restrictedArea($user, 'margins'); diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index a4aed7f668a..cbc134c0b66 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -40,7 +40,7 @@ $TSelectedCats=GETPOST('categories', 'array'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); $result=restrictedArea($user, 'margins'); diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 0ad3f2f645b..d9677ffa4da 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -36,7 +36,7 @@ $confirm=GETPOST('confirm', 'alpha'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); $object = new Product($db); @@ -94,7 +94,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); + dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref'); print '
'; diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index c5d1f0d1e0b..1edd5349467 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -30,7 +30,7 @@ $langs->loadLangs(array("companies", "bills", "products", "margins")); // Security check $socid = GETPOST('socid', 'int'); -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result = restrictedArea($user, 'societe', '', ''); @@ -90,7 +90,7 @@ if ($socid > 0) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/modulebuilder/template/mymoduleindex.php b/htdocs/modulebuilder/template/mymoduleindex.php index 2b681e817f8..d97af3cc99e 100644 --- a/htdocs/modulebuilder/template/mymoduleindex.php +++ b/htdocs/modulebuilder/template/mymoduleindex.php @@ -50,10 +50,10 @@ $action=GETPOST('action', 'alpha'); // Securite acces client if (! $user->rights->mymodule->read) accessforbidden(); $socid=GETPOST('socid', 'int'); -if (isset($user->societe_id) && $user->societe_id > 0) +if (isset($user->socid) && $user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $max=5; diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 7a15ba2843a..c452d908538 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -61,9 +61,9 @@ if (GETPOST('actioncode', 'array')) } else { - $actioncode=GETPOST("actioncode", "alpha", 3)?GETPOST("actioncode", "alpha", 3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); + $actioncode = GETPOST("actioncode", "alpha", 3)?GETPOST("actioncode", "alpha", 3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } -$search_agenda_label=GETPOST('search_agenda_label'); +$search_agenda_label = GETPOST('search_agenda_label'); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -77,7 +77,7 @@ if (! $sortfield) $sortfield='a.datep,a.id'; if (! $sortorder) $sortorder='DESC,DESC'; // Initialize technical objects -$object=new MyObject($db); +$object = new MyObject($db); $extrafields = new ExtraFields($db); $diroutputmassaction=$conf->mymodule->dir_output . '/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('myobjectagenda','globalcard')); // Note that conf->hooks_modules contains array @@ -89,13 +89,13 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity] . "/" . $object->id; // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $object->id); /* - * Actions + * Actions */ $parameters=array('id'=>$id); diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 2a9d6388552..ec70df73583 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -100,8 +100,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index 8deb44b9009..f4b918692ca 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -80,8 +80,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:$conf->entity] . "/myobject/" . dol_sanitizeFileName($object->ref); // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $object->id); diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index bf9b73e0f53..08fbcbaa98e 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -112,9 +112,9 @@ if (! $sortorder) $sortorder="ASC"; // Security check if (empty($conf->mymodule->enabled)) accessforbidden('Module not enabled'); $socid=0; -if ($user->societe_id > 0) // Protection if external user +if ($user->socid > 0) // Protection if external user { - //$socid = $user->societe_id; + //$socid = $user->socid; accessforbidden(); } //$result = restrictedArea($user, 'mymodule', $id, ''); diff --git a/htdocs/modulebuilder/template/myobject_note.php b/htdocs/modulebuilder/template/myobject_note.php index c8dbc5d3140..7cf5f418ff1 100644 --- a/htdocs/modulebuilder/template/myobject_note.php +++ b/htdocs/modulebuilder/template/myobject_note.php @@ -59,8 +59,8 @@ $hookmanager->initHooks(array('myobjectnote','globalcard')); // Note that co $extrafields->fetch_name_optionals_label($object->table_element); // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); // Load object diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index a86d062c5e4..884bc234cbf 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -54,8 +54,8 @@ else $search_agenda_label=GETPOST('search_agenda_label'); // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mrp', $id); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 0ecbefc32a7..07b6be426f3 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -88,8 +88,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->statut == Mo::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mrp', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php index 3732754a62f..2c4d1b36c99 100644 --- a/htdocs/mrp/mo_document.php +++ b/htdocs/mrp/mo_document.php @@ -41,8 +41,8 @@ $id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); $ref = GETPOST('ref', 'alpha'); // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mrp', $id); // Get parameters diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 96f19540a95..b91affe403f 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -98,9 +98,9 @@ if (! $sortorder) $sortorder="ASC"; // Security check if (empty($conf->mrp->enabled)) accessforbidden('Module not enabled'); $socid=0; -if ($user->societe_id > 0) // Protection if external user +if ($user->socid > 0) // Protection if external user { - //$socid = $user->societe_id; + //$socid = $user->socid; accessforbidden(); } //$result = restrictedArea($user, 'mrp', $id, ''); diff --git a/htdocs/mrp/mo_note.php b/htdocs/mrp/mo_note.php index f815dfbaef6..aeb4630168d 100644 --- a/htdocs/mrp/mo_note.php +++ b/htdocs/mrp/mo_note.php @@ -47,8 +47,8 @@ $hookmanager->initHooks(array('monote','globalcard')); // Note that conf->ho $extrafields->fetch_name_optionals_label($object->table_element); // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mrp', $id); // Load object diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 70de7155f39..345bfe3f8dd 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -88,8 +88,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->statut == Mo::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mrp', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index a264171f529..c6585f5e590 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -50,7 +50,7 @@ $search_agenda_label=GETPOST('search_agenda_label'); // Security check $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -if ($user->societe_id) $id=$user->societe_id; +if ($user->socid) $id=$user->socid; $result=restrictedArea($user, 'produit|service', $id, 'product&product'); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; @@ -132,7 +132,7 @@ if ($id > 0 || $ref) $object->next_prev_filter=" fk_product_type = ".$object->type; $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); diff --git a/htdocs/product/canvas/product/tpl/card_view.tpl.php b/htdocs/product/canvas/product/tpl/card_view.tpl.php index 594fd6c1b9b..dc7fea3fc0e 100644 --- a/htdocs/product/canvas/product/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_view.tpl.php @@ -37,7 +37,7 @@ $linkback = 'next_prev_filter=" fk_product_type = ".$object->type; $shownav = 1; -if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; +if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); ?> diff --git a/htdocs/product/card.php b/htdocs/product/card.php index fa131e1df6e..79511df9640 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -78,7 +78,7 @@ $confirm=GETPOST('confirm', 'alpha'); $socid=GETPOST('socid', 'int'); $duration_value = GETPOST('duration_value', 'int'); $duration_unit = GETPOST('duration_unit', 'alpha'); -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $object = new Product($db); $object->type = $type; // so test later to fill $usercancxxx is correct @@ -1650,7 +1650,7 @@ else $object->next_prev_filter=" fk_product_type = ".$object->type; $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 1b0020faa25..947e4292c1a 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -582,7 +582,7 @@ class Products extends DolibarrApi { global $db, $conf; $obj_ret = array(); - $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; + $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; $sql = "SELECT t.rowid, t.ref, t.ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."product as t"; if ($category > 0) { diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index a3517c593f1..8fb3420df49 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -45,7 +45,7 @@ $key=GETPOST('key'); $parent=GETPOST('parent'); // Security check -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); @@ -205,7 +205,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', '', '', '', 0, '', '', 0); diff --git a/htdocs/product/document.php b/htdocs/product/document.php index f62ea66fd48..ef508c9a200 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -48,7 +48,7 @@ $confirm= GETPOST('confirm', 'alpha'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -215,7 +215,7 @@ if ($object->id) $object->next_prev_filter=" fk_product_type = ".$object->type; $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index ef0d1bc1c85..402d27c8578 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -64,7 +64,7 @@ if (! empty($_REQUEST['search_fourn_id'])) // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); if (empty($user->rights->fournisseur->lire)) accessforbidden(); @@ -362,7 +362,7 @@ if ($id > 0 || $ref) $object->next_prev_filter=" fk_product_type = ".$object->type; $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 639b04cdbcc..2659d325676 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -72,8 +72,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index df67fbd0940..4ee108595e6 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -72,8 +72,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 0362a3767c3..9a20f00341b 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -68,9 +68,9 @@ if (! $sortorder) $sortorder="ASC"; // Security check $socid=0; -if ($user->societe_id > 0) // Protection if external user +if ($user->socid > 0) // Protection if external user { - //$socid = $user->societe_id; + //$socid = $user->socid; accessforbidden(); } if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) diff --git a/htdocs/product/note.php b/htdocs/product/note.php index c9a8bc6b1f9..d5593acfb78 100644 --- a/htdocs/product/note.php +++ b/htdocs/product/note.php @@ -40,7 +40,7 @@ $action = GETPOST('action', 'aZ09'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); $object = new Product($db); @@ -98,7 +98,7 @@ if ($id > 0 || ! empty($ref)) $object->next_prev_filter=" fk_product_type = ".$object->type; $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index a25ba2808d5..c50ca3538aa 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -36,7 +36,7 @@ $langs->load('propal'); $type=GETPOST("type", "int"); // Security check -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result=restrictedArea($user, 'produit|service'); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index e8e332d95b5..f6820bc37bc 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -62,7 +62,7 @@ $search_soc = GETPOST('search_soc'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid = $user->societe_id; +if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); if ($id > 0 || ! empty($ref)) @@ -706,7 +706,7 @@ $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1); + dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', '', '', '', 0, '', '', 1); dol_fiche_end(); } diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 58d65810772..e819110c344 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -40,7 +40,7 @@ $ref = GETPOST('ref', 'alpha'); $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $socid=''; -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -104,7 +104,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 56746cb33bc..ae3b642355a 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -39,8 +39,8 @@ $ref = GETPOST('ref', 'alpha'); $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $socid = ''; -if (! empty($user->societe_id)) - $socid = $user->societe_id; +if (! empty($user->socid)) + $socid = $user->socid; $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -109,7 +109,7 @@ if ($id > 0 || ! empty($ref)) { $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index f779ced92ee..8a14c3f19a4 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -37,7 +37,7 @@ $ref = GETPOST('ref', 'alpha'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -94,7 +94,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index d14eba99fae..6c5379d1ddb 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -41,7 +41,7 @@ $ref = GETPOST('ref', 'alpha'); $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $socid=''; -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -122,7 +122,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 5891942079a..70643e9c996 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -41,7 +41,7 @@ $ref = GETPOST('ref', 'alpha'); $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $socid = ''; -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -105,7 +105,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 0b8ae599809..4c58a6fb982 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -40,7 +40,7 @@ $ref = GETPOST('ref', 'alpha'); $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $socid=''; -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -105,7 +105,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index fbab22a0d2f..0dc19a47691 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -40,7 +40,7 @@ $ref = GETPOST('ref', 'alpha'); $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $socid=''; -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -105,7 +105,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 94012c1b9cf..22f7cc03b63 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -378,7 +378,7 @@ else $morehtmlref.='
'; $shownav = 1; - if ($user->societe_id && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/product/stock/info.php b/htdocs/product/stock/info.php index 3314fcf642c..692fe17a83d 100644 --- a/htdocs/product/stock/info.php +++ b/htdocs/product/stock/info.php @@ -60,7 +60,7 @@ $morehtmlref.=$langs->trans("LocationSummary").' : '.$object->lieu; $morehtmlref.='
'; $shownav = 1; -if ($user->societe_id && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; +if ($user->socid && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 5324ef80243..0f4e5476fd2 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -35,8 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $langs->loadLangs(array('products', 'stocks', 'orders', 'productbatch')); // Security check -if ($user->societe_id) { - $socid = $user->societe_id; +if ($user->socid) { + $socid = $user->socid; } $result=restrictedArea($user, 'produit|service'); diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index 86380c5d72f..5f4e1b97aa6 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -567,7 +567,7 @@ if ($resql) $morehtmlref.='
'; $shownav = 1; - if ($user->societe_id && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 57122db7e46..85f40a9d214 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -549,7 +549,7 @@ if ($resql) $morehtmlref.='
'; $shownav = 1; - if ($user->societe_id && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 060bcc57960..3428b75f395 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -76,7 +76,7 @@ if (!empty($batchnumber)) { } // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'produit&stock', $id, 'product&product', '', '', $fieldid); @@ -548,7 +548,7 @@ if ($id > 0 || $ref) $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; - if ($user->societe_id && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 00299c94459..c7f9a5ae8fa 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -53,7 +53,7 @@ if (empty($action) && empty($id) && empty($ref)) $action='list'; // Protection if external user -if ($user->societe_id > 0) +if ($user->socid > 0) { //accessforbidden(); } @@ -318,7 +318,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $linkback = '' . $langs->trans("BackToList") . ''; $shownav = 1; - if ($user->societe_id && ! in_array('batch', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('batch', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'batch'); diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index ed4aea8c010..5fb9cc23bca 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -48,7 +48,7 @@ $confirm= GETPOST('confirm', 'alpha'); // Security check $fieldvalue = (! empty($id) ? $id : ''); $fieldtype = 'rowid'; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'produit|service'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -132,7 +132,7 @@ if ($object->id) $linkback = '' . $langs->trans("BackToList") . ''; $shownav = 1; - if ($user->societe_id && ! in_array('batch', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('batch', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'batch'); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index fbbec95f2df..fd2a7c70c13 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -67,9 +67,9 @@ if (! $sortorder) $sortorder="ASC"; // Protection if external user $socid=0; -if ($user->societe_id > 0) +if ($user->socid > 0) { - $socid = $user->societe_id; + $socid = $user->socid; //accessforbidden(); } diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 3536088cab5..168ed5e54f9 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -38,8 +38,8 @@ require_once './lib/replenishment.lib.php'; $langs->loadLangs(array('products', 'stocks', 'orders')); // Security check -if ($user->societe_id) { - $socid = $user->societe_id; +if ($user->socid) { + $socid = $user->socid; } $result=restrictedArea($user, 'produit|service'); diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 2f0714737ee..27834923a0e 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->loadLangs(array('products', 'stocks', 'orders')); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'produit|service'); $sall = GETPOST('search_all', 'alphanohtml'); diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 054947183ab..19a23e1e9d2 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -42,7 +42,7 @@ $cancel=GETPOST('cancel', 'alpha'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); @@ -203,7 +203,7 @@ dol_fiche_head($head, 'translation', $titre, 0, $picto); $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; -if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; +if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', '', '', '', 0, '', '', 1); diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 4215b9778e3..cf1249aa9eb 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -36,7 +36,7 @@ if ($search_project_user == $user->id) $mine = 1; // Security check $socid=0; -if ($user->societe_id > 0) $socid=$user->societe_id; +if ($user->socid > 0) $socid=$user->socid; //$result = restrictedArea($user, 'projet', $projectid); if (!$user->rights->projet->lire) accessforbidden(); diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index b07b41c1b88..77dcaa641d2 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -56,7 +56,7 @@ $hookmanager->initHooks(array('timesheetperdaycard')); // Security check $socid=0; // For external user, no check is done on company because readability is managed by public status of project and assignement. -//if ($user->societe_id > 0) $socid=$user->societe_id; +//if ($user->socid > 0) $socid=$user->socid; $result = restrictedArea($user, 'projet', $projectid); $now=dol_now(); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index e51b2e4b404..8af733394bf 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -56,7 +56,7 @@ $hookmanager->initHooks(array('timesheetperweekcard')); // Security check $socid=0; // For external user, no check is done on company because readability is managed by public status of project and assignement. -// if ($user->societe_id > 0) $socid=$user->societe_id; +// if ($user->socid > 0) $socid=$user->socid; $result = restrictedArea($user, 'projet', $projectid); $now=dol_now(); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index e4a8dd078ec..5b3d69777b7 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -71,7 +71,7 @@ if ($id > 0 || ! empty($ref)) // Security check $socid=GETPOST('socid', 'int'); -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $object->id, 'projet&project'); // fetch optionals attributes and labels diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 0848f87ed19..e049945f235 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1456,7 +1456,7 @@ class Project extends CommonObject // Security check $socid=0; - if ($user->societe_id > 0) $socid = $user->societe_id; + if ($user->socid > 0) $socid = $user->socid; $tasksarray=$taskstatic->getTasksArray(0, 0, $fromid, $socid, 0); @@ -1536,7 +1536,7 @@ class Project extends CommonObject // Security check $socid=0; - if ($user->societe_id > 0) $socid = $user->societe_id; + if ($user->socid > 0) $socid = $user->socid; $tasksarray=$taskstatic->getTasksArray(0, 0, $this->id, $socid, 0); @@ -1767,7 +1767,7 @@ class Project extends CommonObject global $conf, $langs; // For external user, no check is done on company because readability is managed by public status of project and assignement. - //$socid=$user->societe_id; + //$socid=$user->socid; $projectsListId = null; if (! $user->rights->projet->all->lire) $projectsListId = $this->getProjectsAuthorizedForUser($user, 0, 1); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 71bf1b17f50..dcc4c18c497 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1969,7 +1969,7 @@ class Task extends CommonObject global $conf, $langs; // For external user, no check is done on company because readability is managed by public status of project and assignement. - //$socid=$user->societe_id; + //$socid=$user->socid; $projectstatic = new Project($this->db); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid); @@ -2042,7 +2042,7 @@ class Task extends CommonObject // phpcs:enable global $user; - $mine=0; $socid=$user->societe_id; + $mine=0; $socid=$user->socid; $projectstatic = new Project($this->db); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, $mine, 1, $socid); diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index b535b0f6ada..064f4a12729 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -49,7 +49,7 @@ $planned_workload=((GETPOST('planned_workloadhour', 'int')!='' || GETPOST('plann // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (! $user->rights->projet->lire) accessforbidden(); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index a1735e20ad6..82eb598190b 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -47,7 +47,7 @@ if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($ob // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id, 'projet&project'); $hookmanager->initHooks(array('projectcontactcard','globalcard')); diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 10c7a140df7..f77419f2e75 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -42,7 +42,7 @@ $mine = (GETPOST('mode', 'alpha') == 'mine' ? 1 : 0); // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result=restrictedArea($user, 'projet', $id, 'projet&project'); $object = new Project($db); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 5f74a971f87..14dccfedb8d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -100,7 +100,7 @@ if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($ob // Security check $socid=$object->socid; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $object->id, 'projet&project'); $hookmanager->initHooks(array('projectOverview')); diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 57be29b1bb2..725d99fb673 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -46,7 +46,7 @@ if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($ob // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id, 'projet&project'); // Load translation files required by the page diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index be8a924e1ab..a2526171b9b 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -45,7 +45,7 @@ if ($search_project_user == $user->id) $mine = 1; // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); $sortfield = GETPOST("sortfield", 'alpha'); diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index 207bd245d08..ff361e75d3d 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -62,7 +62,7 @@ $search_agenda_label=GETPOST('search_agenda_label'); // Security check $id = GETPOST("id", 'int'); $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result=restrictedArea($user, 'projet', $id, ''); if (!$user->rights->projet->lire) accessforbidden(); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 2c311de7792..6cbe9d68127 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -48,7 +48,7 @@ $title = $langs->trans("Projects"); // Security check $socid = (is_numeric($_GET["socid"]) ? $_GET["socid"] : 0 ); -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. if ($socid > 0) { $soc = new Societe($db); diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index ef324bb63bb..73c9d39d64d 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -43,7 +43,7 @@ if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($ob // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id, 'projet&project'); $permissionnote=$user->rights->projet->creer; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index f8480f8f322..a7e6bf510b3 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -38,10 +38,10 @@ $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height'); $userid=GETPOST('userid', 'int'); $socid=GETPOST('socid', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $nowyear=strftime("%Y", dol_now()); $year = GETPOST('year')>0?GETPOST('year'):$nowyear; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 2395f5f0bd1..0bffd50ce62 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -80,7 +80,7 @@ $extrafields->fetch_name_optionals_label($taskstatic->table_element); // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id, 'projet&project'); $diroutputmassaction=$conf->projet->dir_output . '/tasks/temp/massgeneration/'.$user->id; diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index d9a251b3c53..31211e59dbf 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -49,7 +49,7 @@ $planned_workload=((GETPOST('planned_workloadhour', 'int')!='' || GETPOST('plann // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (! $user->rights->projet->lire) accessforbidden(); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index b09d8345177..aa94d413fc9 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -42,7 +42,7 @@ $project_ref=GETPOST('project_ref', 'alpha'); // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. //$result = restrictedArea($user, 'projet', $id, 'projet_task'); if (! $user->rights->projet->lire) accessforbidden(); diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 52795f7a249..1944de13f61 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -46,7 +46,7 @@ $project_ref = GETPOST('project_ref', 'alpha'); // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. //$result=restrictedArea($user,'projet',$id,''); if (!$user->rights->projet->lire) accessforbidden(); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index e13b7092b26..8718806004b 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -83,7 +83,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); $diroutputmassaction=$conf->projet->dir_output . '/tasks/temp/massgeneration/'.$user->id; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index de2707bf734..42dbaa48cc2 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -40,7 +40,7 @@ $project_ref = GETPOST('project_ref', 'alpha'); // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); //$result = restrictedArea($user, 'projet', $id, '', 'task'); // TODO ameliorer la verification diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index c94a412be9c..c9e8bc335e7 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -38,10 +38,10 @@ $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height'); $userid=GETPOST('userid', 'int'); $socid=GETPOST('socid', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $nowyear=strftime("%Y", dol_now()); $year = GETPOST('year')>0?GETPOST('year'):$nowyear; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 78431f983a4..0bc07537ccf 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -48,7 +48,7 @@ $planned_workload=((GETPOST('planned_workloadhour', 'int')!='' || GETPOST('plann // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (! $user->rights->projet->lire) accessforbidden(); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 3dc54cc2223..24e5d067186 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -68,7 +68,7 @@ $search_valuebilled=GETPOST('search_valuebilled', 'int'); // Security check $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index ce93ec020c3..0bde25460e3 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -348,7 +348,7 @@ llxHeaderTicket($langs->trans("CreateTicket"), "", 0, 0, $arrayofjs, $arrayofcss print '
'; if ($action != "infos_success") { - $formticket->withfromsocid = isset($socid) ? $socid : $user->societe_id; + $formticket->withfromsocid = isset($socid) ? $socid : $user->socid; $formticket->withtitletopic = 1; $formticket->withcompany = 0; $formticket->withusercreate = 1; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 832fd4fc70d..2e9dbe5f57b 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -72,7 +72,7 @@ $line_id = GETPOST('lineid', 'int')?GETPOST('lineid', 'int'):''; // Security check $socid=''; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; if ($origin == 'reception') $result=restrictedArea($user, $origin, $id); else { @@ -820,7 +820,7 @@ if ($action == 'create') print "
'.$langs->trans("NotePrivate").''; @@ -2019,7 +2019,7 @@ elseif ($id || $ref) * Boutons actions */ - if (($user->societe_id == 0) && ($action!='presend')) + if (($user->socid == 0) && ($action!='presend')) { print '
'; diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index c49eec5c82d..da074c420b5 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -44,7 +44,7 @@ $ref=GETPOST('ref', 'alpha'); $action=GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'reception', $id, ''); $object = new Reception($db); diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 1a201a4bfd0..a7d7c51b7b1 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -42,7 +42,7 @@ $toselect = GETPOST('toselect', 'array'); // Security check $receptionid = GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'reception', $receptionid, ''); $diroutputmassaction=$conf->reception->dir_output . '/temp/massgeneration/'.$user->id; diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index cbc1185aaab..5a2e8745cb7 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -48,7 +48,7 @@ $action=GETPOST('action', 'alpha'); // Security check $socid=''; -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result=restrictedArea($user, $origin, $origin_id); $object = new Reception($db); diff --git a/htdocs/reception/stats/index.php b/htdocs/reception/stats/index.php index 76315ccce03..06304a2afb8 100644 --- a/htdocs/reception/stats/index.php +++ b/htdocs/reception/stats/index.php @@ -35,10 +35,10 @@ $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height'); $userid=GETPOST('userid', 'int'); $socid=GETPOST('socid', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $nowyear=strftime("%Y", dol_now()); @@ -74,7 +74,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenamenb = $dir.'/receptionsnbinyear-'.$user->id.'-'.$year.'.png'; } @@ -114,7 +114,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); //var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenameamount = $dir.'/receptionsamountinyear-'.$user->id.'-'.$year.'.png'; } @@ -152,7 +152,7 @@ if (! $mesg) /* $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filename_avg = $dir.'/receptionsaverage-'.$user->id.'-'.$year.'.png'; } diff --git a/htdocs/resource/agenda.php b/htdocs/resource/agenda.php index 303db5ec7b3..803190ec699 100644 --- a/htdocs/resource/agenda.php +++ b/htdocs/resource/agenda.php @@ -141,7 +141,7 @@ if ($object->id > 0) $morehtmlref.='
'; $shownav = 1; - if ($user->societe_id && ! in_array('resource', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('resource', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php index 872078ac51d..3e2a004e194 100644 --- a/htdocs/resource/contact.php +++ b/htdocs/resource/contact.php @@ -39,7 +39,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'resource', $id, 'resource'); $object = new DolResource($db); diff --git a/htdocs/resource/document.php b/htdocs/resource/document.php index 9f1b5af4322..e023134b9f5 100644 --- a/htdocs/resource/document.php +++ b/htdocs/resource/document.php @@ -44,7 +44,7 @@ $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'resource', $id, 'resource'); diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index a0c1a724ed8..2ab64799f1d 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -357,7 +357,7 @@ else } $morehtmlref.=''; - dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref, '&element='.$element, 0, '', ''); + dol_banner_tab($act, 'element_id', $linkback, ($user->socid?0:1), 'id', 'ref', $morehtmlref, '&element='.$element, 0, '', ''); print '
'; @@ -453,7 +453,7 @@ else dol_fiche_head($head, 'resources', $langs->trans("ThirdParty"), -1, 'company'); - dol_banner_tab($socstatic, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '&element='.$element); + dol_banner_tab($socstatic, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom', '', '&element='.$element); print '
'; @@ -557,7 +557,7 @@ else dol_fiche_head($head, 'resources', $titre, -1, $picto); $shownav = 1; - if ($user->societe_id && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; dol_banner_tab($product, 'ref', '', $shownav, 'ref', 'ref', '', '&element='.$element); dol_fiche_end(); diff --git a/htdocs/resource/note.php b/htdocs/resource/note.php index 8c7f106285f..322088ef317 100644 --- a/htdocs/resource/note.php +++ b/htdocs/resource/note.php @@ -37,7 +37,7 @@ $ref = GETPOST('ref', 'alpha'); $action=GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'resource', $id, 'resource'); $object = new DolResource($db); diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 32edd342cb8..4e9b9dac118 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -48,7 +48,7 @@ $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOS // Security check $socid = GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'salaries', '', '', ''); $object = new PaymentSalary($db); diff --git a/htdocs/salaries/document.php b/htdocs/salaries/document.php index a7b92d63efb..7bd9a14a718 100644 --- a/htdocs/salaries/document.php +++ b/htdocs/salaries/document.php @@ -45,7 +45,7 @@ $confirm = GETPOST('confirm', 'alpha'); // Security check $socid = GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'salaries', '', '', ''); diff --git a/htdocs/salaries/info.php b/htdocs/salaries/info.php index 5ba53c45665..a96db0cbd5f 100644 --- a/htdocs/salaries/info.php +++ b/htdocs/salaries/info.php @@ -36,7 +36,7 @@ $action=GETPOST('action', 'aZ09'); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'salaries', '', '', ''); diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 816b734ea23..02a729cb16c 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -33,7 +33,7 @@ $langs->loadLangs(array("compta","salaries","bills","hrm")); // Security check $socid = GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'salaries', '', '', ''); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/salaries/stats/index.php b/htdocs/salaries/stats/index.php index a301dc927a1..38a568d5fc0 100644 --- a/htdocs/salaries/stats/index.php +++ b/htdocs/salaries/stats/index.php @@ -38,7 +38,7 @@ $id = GETPOST('id', 'int'); // Security check $socid = GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'salaries', '', '', ''); $nowyear=strftime("%Y", dol_now()); diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 231174a0afa..ae2622d7f93 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -47,7 +47,7 @@ $search_agenda_label=GETPOST('search_agenda_label'); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'societe', $socid, '&societe'); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; @@ -117,7 +117,7 @@ if ($socid > 0) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 28f2ec7306b..aafcd8ffc69 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -266,7 +266,7 @@ abstract class ActionsCardCommon $this->tpl['showhead']=dol_get_fiche_head($head, 'card', '', 0, 'company'); $this->tpl['showend']=dol_get_fiche_end(); - $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', ($user->socid?0:1), 'rowid', 'nom'); $this->tpl['checkcustomercode'] = $this->object->check_codeclient(); $this->tpl['checksuppliercode'] = $this->object->check_codefournisseur(); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 8cf9dbd1752..edfb3767f11 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -61,7 +61,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; if (empty($socid) && $action == 'view') $action='create'; $object = new Societe($db); @@ -2241,7 +2241,7 @@ else $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 9c6c15e2f66..c345d195935 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -63,7 +63,7 @@ class Client extends Societe $sql = "SELECT count(s.rowid) as nb, s.client"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 48c37f044a5..4615290a03d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2238,7 +2238,7 @@ class Societe extends CommonObject $linkend=''; global $user; - if (! $user->rights->societe->client->voir && $user->societe_id > 0 && $this->id != $user->societe_id) + if (! $user->rights->societe->client->voir && $user->socid > 0 && $this->id != $user->socid) { $linkstart=''; $linkend=''; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 85df9b4f069..0039504e950 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'societe', $socid, '&societe'); $object = new Societe($db); if ($socid > 0) $object->fetch($socid); @@ -109,7 +109,7 @@ dol_fiche_head($head, 'consumption', $langs->trans("ThirdParty"), -1, 'company') $linkback = ''.$langs->trans("BackToList").''; -dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); +dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 1b119e9c89a..352c9c53c35 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -56,7 +56,7 @@ $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $confirm = GETPOST('confirm'); $socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; if (empty($socid) && $action == 'view') $action='create'; $object = new Societe($db); @@ -150,7 +150,7 @@ dol_fiche_head($head, 'contact', $langs->trans("ThirdParty"), 0, 'company'); $linkback = ''.$langs->trans("BackToList").''; -dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); +dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); dol_fiche_end(); diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 971944c4f30..8e0c36aa451 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -40,10 +40,10 @@ $id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); $ref = GETPOST('ref', 'alpha'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { unset($action); - $socid = $user->societe_id; + $socid = $user->socid; } $result = restrictedArea($user, 'societe', $id, '&societe'); @@ -117,7 +117,7 @@ if ($object->id) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 50b866ca089..5aadc5d3606 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -38,7 +38,7 @@ $hookmanager->initHooks(array('thirdpartiesindex')); $langs->load("companies"); $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid = $user->societe_id; +if ($user->socid) $socid=$user->socid; // Security check $result = restrictedArea($user, 'societe', 0, '', '', '', ''); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index ad793fcf63e..8f0d1895c1b 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -55,7 +55,7 @@ if ($contextpage == 'poslist') // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'societe', $socid, ''); $search_all=trim(GETPOST('search_all', 'alphanohtml')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 4d20f050518..0f2bc4d8002 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -35,7 +35,7 @@ $langs->load("companies"); // Security check $id = GETPOST('id')?GETPOST('id', 'int'):GETPOST('socid', 'int'); -if ($user->societe_id) $id=$user->societe_id; +if ($user->socid) $id=$user->socid; $result = restrictedArea($user, 'societe', $id, '&societe'); $object = new Societe($db); @@ -78,7 +78,7 @@ if ($object->id > 0) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); $cssclass='titlefield'; //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 54536fa7502..d3f4c30f575 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -39,7 +39,7 @@ $actionid = GETPOST('actionid'); $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'societe', '', ''); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; @@ -156,7 +156,7 @@ if ($result > 0) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index df803b180ab..5ed2b9a148f 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -44,7 +44,7 @@ $langs->loadLangs(array("companies","commercial","banks","bills",'paypal','strip // Security check $socid = GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'societe', '', ''); $id=GETPOST("id", "int"); @@ -804,7 +804,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field @@ -1615,7 +1615,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; @@ -1721,7 +1721,7 @@ if ($socid && $action == 'editcard' && $user->rights->societe->creer) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; @@ -1769,7 +1769,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; @@ -1869,7 +1869,7 @@ if ($socid && $action == 'createcard' && $user->rights->societe->creer) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 967f91ca39d..d3c4c75fca5 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -46,8 +46,8 @@ $cancel = GETPOST('cancel', 'alpha'); // Security check $socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int'); -if ($user->societe_id) - $socid = $user->societe_id; +if ($user->socid) + $socid = $user->socid; $result = restrictedArea($user, 'societe', $socid, '&societe'); $object = new Societe($db); @@ -187,7 +187,7 @@ dol_fiche_head($head, 'price', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; -dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); +dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index 8f825bfc18c..1ff2c24956e 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -35,7 +35,7 @@ $langs->loadLangs(array("companies", "projects")); // Security check $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'societe', $socid, '&societe'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -82,7 +82,7 @@ if ($socid) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 7f531498e2f..0894935b962 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -51,7 +51,7 @@ $pageprev = $page - 1; $pagenext = $page + 1; // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'societe', $id, ''); $object = new Societe($db); @@ -166,7 +166,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 0e0c5ac2cc8..6878ea8ed44 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -47,7 +47,7 @@ $search_status=GETPOST('search_status'); // Security check $id = GETPOST('id', 'int')?GETPOST('id', 'int'):GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'societe', $socid, '&societe'); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; @@ -195,7 +195,7 @@ dol_fiche_head($head, 'website', $langs->trans("ThirdParty"), - 1, 'company'); $linkback = '' . $langs->trans("BackToList") . ''; -dol_banner_tab($object, 'socid', $linkback, ($user->societe_id ? 0 : 1), 'rowid', 'nom'); +dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index a9e417aa581..f398a013fb6 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -33,7 +33,7 @@ $langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe')); // Security check $socid = GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; //$result = restrictedArea($user, 'salaries', '', '', ''); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index 2614c8498f3..e0ed986bfd6 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -65,9 +65,9 @@ $multicurrency_amountsresttopay=array(); // Security check $socid=0; -if ($user->societe_id > 0) +if ($user->socid > 0) { - $socid = $user->societe_id; + $socid = $user->socid; } $object=new Facture($db); diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php index 70988b339b5..e2f19c560be 100644 --- a/htdocs/stripe/payout.php +++ b/htdocs/stripe/payout.php @@ -33,7 +33,7 @@ $langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe')); // Security check $socid = GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; //$result = restrictedArea($user, 'salaries', '', '', ''); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 6dc0a1e0815..3bc1050f867 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -33,7 +33,7 @@ $langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe')); // Security check $socid = GETPOST("socid", "int"); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; //$result = restrictedArea($user, 'salaries', '', '', ''); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index b953087b885..1a8aa755e71 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -74,7 +74,7 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($co $NBLINES = 4; // Security check -if (! empty($user->societe_id)) $socid = $user->societe_id; +if (! empty($user->socid)) $socid = $user->socid; $result = restrictedArea($user, 'supplier_proposal', $id); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context diff --git a/htdocs/supplier_proposal/contact.php b/htdocs/supplier_proposal/contact.php index d60fb3c04bc..84b007c53fc 100644 --- a/htdocs/supplier_proposal/contact.php +++ b/htdocs/supplier_proposal/contact.php @@ -39,7 +39,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'supplier_proposal', $id, 'supplier_proposal', ''); $object = new SupplierProposal($db); diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index 991059b9141..da76e9ea897 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -45,9 +45,9 @@ $ref = GETPOST('ref', 'alpha'); // Security check $socid=''; -if (! empty($user->societe_id)) +if (! empty($user->socid)) { - $socid = $user->societe_id; + $socid = $user->socid; } $result = restrictedArea($user, 'supplier_proposal', $id); diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index dd2acd27311..55bde878918 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -38,10 +38,10 @@ $langs->loadLangs(array('supplier_proposal', 'companies')); // Security check $socid=GETPOST('socid', 'int'); -if (isset($user->societe_id) && $user->societe_id > 0) +if (isset($user->socid) && $user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $result = restrictedArea($user, 'supplier_proposal'); @@ -90,7 +90,7 @@ $sql.= ", ".MAIN_DB_PREFIX."supplier_proposal as p"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE p.fk_soc = s.rowid"; $sql.= " AND p.entity IN (".getEntity('supplier_proposal').")"; -if ($user->societe_id) $sql.=' AND p.fk_soc = '.$user->societe_id; +if ($user->socid) $sql.=' AND p.fk_soc = '.$user->socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " AND p.fk_statut IN (0,1,2,3,4)"; $sql.= " GROUP BY p.fk_statut"; diff --git a/htdocs/supplier_proposal/info.php b/htdocs/supplier_proposal/info.php index ec269354af6..7b259b166e4 100644 --- a/htdocs/supplier_proposal/info.php +++ b/htdocs/supplier_proposal/info.php @@ -39,7 +39,7 @@ $id=GETPOST('id', 'int'); $socid=GETPOST('socid', 'int'); // Security check -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; $result = restrictedArea($user, 'supplier_proposal', $id); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 687d98911f2..c48f3756611 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -103,7 +103,7 @@ $NBLINES=4; $module='supplier_proposal'; $dbtable=''; $objectid=''; -if (! empty($user->societe_id)) $socid=$user->societe_id; +if (! empty($user->socid)) $socid=$user->socid; if (! empty($socid)) { $objectid=$socid; diff --git a/htdocs/supplier_proposal/note.php b/htdocs/supplier_proposal/note.php index 447dc057979..0e12da2c104 100644 --- a/htdocs/supplier_proposal/note.php +++ b/htdocs/supplier_proposal/note.php @@ -40,7 +40,7 @@ $ref=GETPOST('ref', 'alpha'); $action=GETPOST('action', 'alpha'); // Security check -if ($user->societe_id) $socid=$user->societe_id; +if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'supplier_proposal', $id, 'supplier_proposal'); $object = new SupplierProposal($db); diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index dee2168136c..6db51996d12 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -78,19 +78,19 @@ if (!$action) { // Security check $id = GETPOST("id", 'int'); $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result=restrictedArea($user, 'ticket', $id, ''); if (!$user->rights->ticket->read) { accessforbidden(); } // restrict access for externals users -if ($user->societe_id > 0 && ($object->fk_soc != $user->societe_id)) +if ($user->socid > 0 && ($object->fk_soc != $user->socid)) { accessforbidden(); } // or for unauthorized internals users -if (!$user->societe_id && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { +if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { accessforbidden(); } @@ -138,15 +138,15 @@ if ($socid > 0) { dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company'); - dol_banner_tab($object->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); + dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom'); dol_fiche_end(); } -if (!$user->societe_id && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { +if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { $object->next_prev_filter = "te.fk_user_assign = '" . $user->id . "'"; -} elseif ($user->societe_id > 0) { - $object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'"; +} elseif ($user->socid > 0) { + $object->next_prev_filter = "te.fk_soc = '" . $user->socid . "'"; } $head = ticket_prepare_head($object); @@ -172,7 +172,7 @@ if (!empty($object->origin_email)) { if (! empty($conf->societe->enabled)) { $morehtmlref.='
'.$langs->trans('ThirdParty'); - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) { + /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; }*/ $morehtmlref.=' : '; @@ -220,7 +220,7 @@ $morehtmlref.='
'; $linkback = '' . $langs->trans("BackToList") . ' '; -dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); +dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_fiche_end(); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index eec2c813d26..6aa6d42e590 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -95,8 +95,8 @@ if ($id || $track_id || $ref) { $url_page_current = DOL_URL_ROOT.'/ticket/card.php'; // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; $result = restrictedArea($user, 'ticket', $object->id); $triggermodname = 'TICKET_MODIFY'; @@ -622,7 +622,7 @@ if ($action == 'create' || $action == 'presend') print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket'); - $formticket->withfromsocid = $socid ? $socid : $user->societe_id; + $formticket->withfromsocid = $socid ? $socid : $user->socid; $formticket->withfromcontactid = $contactid ? $contactid : ''; $formticket->withtitletopic = 1; $formticket->withnotifytiersatcreate = ($notifyTiers?1:0); @@ -645,7 +645,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd if ($res > 0) { // or for unauthorized internals users - if (!$user->societe_id && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { + if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { accessforbidden('', 0, 1); } @@ -741,14 +741,14 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd $head = societe_prepare_head($object->thirdparty); dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company'); - dol_banner_tab($object->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); + dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom'); dol_fiche_end(); } - if (!$user->societe_id && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { + if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { $object->next_prev_filter = "te.fk_user_assign = '" . $user->id . "'"; - } elseif ($user->societe_id > 0) { - $object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'"; + } elseif ($user->socid > 0) { + $object->next_prev_filter = "te.fk_soc = '" . $user->socid . "'"; } $head = ticket_prepare_head($object); @@ -775,7 +775,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd if (! empty($conf->societe->enabled)) { $morehtmlref.='
'.$langs->trans('ThirdParty') . ' '; - if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) { + if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 0) . ' : '; } if ($action == 'editcustomer') { @@ -821,7 +821,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd $linkback = '' . $langs->trans("BackToList") . ' '; - dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref); print '
'; print '
'; @@ -845,9 +845,9 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd // Subject print '
'; - print $form->editfieldkey("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->societe_id, 'string'); + print $form->editfieldkey("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->socid, 'string'); print ''; - print $form->editfieldval("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->societe_id, 'string'); + print $form->editfieldval("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->socid, 'string'); print '
'; - if ($action != 'progression' && $object->fk_statut < 8 && !$user->societe_id) { + if ($action != 'progression' && $object->fk_statut < 8 && !$user->socid) { print ''; } print '
'; print $langs->trans('Progression') . ''; print '' . img_edit($langs->trans('Modify')) . '
'; @@ -1033,7 +1033,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd // Display navbar with links to change ticket status print ''; - if (!$user->societe_id && $user->rights->ticket->write && $object->fk_status < 8 && GETPOST('set') !== 'properties') { + if (!$user->socid && $user->rights->ticket->write && $object->fk_status < 8 && GETPOST('set') !== 'properties') { $actionobject->viewStatusActions($object); } @@ -1187,12 +1187,12 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd } // Re-open ticket - if (!$user->socid && $object->fk_statut == Ticket::STATUS_CLOSED && !$user->societe_id) { + if (!$user->socid && $object->fk_statut == Ticket::STATUS_CLOSED && !$user->socid) { print ''; } // Delete ticket - if ($user->rights->ticket->delete && ! $user->societe_id) { + if ($user->rights->ticket->delete && ! $user->socid) { print ''; } } diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index 65682fef2b3..78e78b86f7d 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -51,8 +51,8 @@ $ligne = GETPOST('ligne', 'int'); $lineid = GETPOST('lineid', 'int'); // Protection if external user -if ($user->societe_id > 0) { - $socid = $user->societe_id; +if ($user->socid > 0) { + $socid = $user->socid; accessforbidden(); } @@ -129,14 +129,14 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { $object->fetch_thirdparty(); $head = societe_prepare_head($object->thirdparty); dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company'); - dol_banner_tab($object->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); + dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom'); dol_fiche_end(); } - if (!$user->societe_id && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { + if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { $object->next_prev_filter = "te.fk_user_assign = '" . $user->id . "'"; - } elseif ($user->societe_id > 0) { - $object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'"; + } elseif ($user->socid > 0) { + $object->next_prev_filter = "te.fk_soc = '" . $user->socid . "'"; } $head = ticket_prepare_head($object); @@ -163,7 +163,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { if (! empty($conf->societe->enabled)) { $morehtmlref.='
'.$langs->trans('ThirdParty'); - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) { + /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; }*/ $morehtmlref.=' : '; @@ -211,7 +211,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { $linkback = '' . $langs->trans("BackToList") . ' '; - dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1, ''); + dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1, ''); dol_fiche_end(); diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index a80d455e43f..5a6b2b131f1 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -94,14 +94,14 @@ if ($object->id) $object->fetch_thirdparty(); $head = societe_prepare_head($object->thirdparty); dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company'); - dol_banner_tab($object->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); + dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom'); dol_fiche_end(); } - if (!$user->societe_id && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { + if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { $object->next_prev_filter = "te.fk_user_assign = '" . $user->id . "'"; - } elseif ($user->societe_id > 0) { - $object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'"; + } elseif ($user->socid > 0) { + $object->next_prev_filter = "te.fk_soc = '" . $user->socid . "'"; } $head = ticket_prepare_head($object); @@ -128,7 +128,7 @@ if ($object->id) if (! empty($conf->societe->enabled)) { $morehtmlref.='
'.$langs->trans('ThirdParty'); - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) { + /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; }*/ $morehtmlref.=' : '; @@ -176,7 +176,7 @@ if ($object->id) $linkback = '' . $langs->trans("BackToList") . ' '; - dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); + dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_fiche_end(); diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index be29b1be25e..d749aa25f02 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -44,8 +44,8 @@ $msg_id = GETPOST('msg_id', 'int'); $action = GETPOST('action', 'aZ09'); -if ($user->societe_id) { - $socid = $user->societe_id; +if ($user->socid) { + $socid = $user->socid; } // Security check @@ -141,8 +141,8 @@ if (!$user->rights->societe->client->voir && !$socid) { } // External users restriction -if ($user->societe_id > 0) { - $sql .= " AND t.fk_soc='" . $user->societe_id . "'"; +if ($user->socid > 0) { + $sql .= " AND t.fk_soc='" . $user->socid . "'"; } else { // For internals users, if (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && !$user->rights->ticket->manage) { @@ -288,8 +288,8 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id; } -if ($user->societe_id > 0) { - $sql .= " AND t.fk_soc='" . $user->societe_id . "'"; +if ($user->socid > 0) { + $sql .= " AND t.fk_soc='" . $user->socid . "'"; } else { // Restricted to assigned user only if ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && !$user->rights->ticket->manage) { diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index bfaa8ad3876..7c6f525a0c4 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -246,7 +246,7 @@ foreach($search as $key => $val) if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_fk_project) $sql.= natural_search('fk_project', $search_fk_project, 2); -if (! $user->societe_id && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) { +if (! $user->socid && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) { $sql.= " AND (t.fk_user_assign = ".$user->id; if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) $sql.=" OR t.fk_user_create = ".$user->id; $sql.=")"; @@ -319,7 +319,7 @@ if ($socid && ! $projectid && ! $project_ref && $user->rights->societe->lire) { dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), -1, 'company'); - dol_banner_tab($socstat, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); + dol_banner_tab($socstat, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 7b4341cf684..11bd501bd17 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -77,19 +77,19 @@ if (!$action) { // Security check $id = GETPOST("id", 'int'); $socid=0; -//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result=restrictedArea($user, 'ticket', $id, ''); if (!$user->rights->ticket->read) { accessforbidden(); } // restrict access for externals users -if ($user->societe_id > 0 && ($object->fk_soc != $user->societe_id)) +if ($user->socid > 0 && ($object->fk_soc != $user->socid)) { accessforbidden(); } // or for unauthorized internals users -if (!$user->societe_id && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { +if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { accessforbidden(); } @@ -171,7 +171,7 @@ if (!empty($object->origin_email)) { if (! empty($conf->societe->enabled)) { $morehtmlref.='
'.$langs->trans('ThirdParty'); - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) { + /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; }*/ $morehtmlref.=' : '; diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php index f3cb531bb09..a6baeef7c06 100644 --- a/htdocs/ticket/stats/index.php +++ b/htdocs/ticket/stats/index.php @@ -37,10 +37,10 @@ $object_status=GETPOST('object_status'); $userid=GETPOST('userid', 'int'); $socid=GETPOST('socid', 'int'); // Security check -if ($user->societe_id > 0) +if ($user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $nowyear=strftime("%Y", dol_now()); @@ -80,7 +80,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenamenb = $dir.'/ticketsnbinyear-'.$user->id.'-'.$year.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsnbinyear-'.$user->id.'-'.$year.'.png'; @@ -121,7 +121,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear); //var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filenameamount = $dir.'/ticketsamountinyear-'.$user->id.'-'.$year.'.png'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsamountinyear-'.$user->id.'-'.$year.'.png'; @@ -160,7 +160,7 @@ if (! $mesg) $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); -if (!$user->rights->societe->client->voir || $user->societe_id) +if (!$user->rights->societe->client->voir || $user->socid) { $filename_avg = $dir.'/ticketsaverage-'.$user->id.'-'.$year.'.png'; $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsaverage-'.$user->id.'-'.$year.'.png'; diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index d6f2eedb430..245718bd171 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -55,7 +55,7 @@ $object->getrights(); // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 886e931e38f..284c88a867b 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -46,7 +46,7 @@ $cancel = GETPOST('cancel', 'alpha'); // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); // Ok if user->rights->salaries->read or user->rights->hrm->read //$result = restrictedArea($user, 'salaries|hrm', $id, 'user&user', $feature2); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 7ff0fdb3d9c..c924aae08bf 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -83,7 +83,7 @@ if ($id) // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; $feature2='user'; $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 04a0f4c3883..f4c3e63f9cf 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -33,7 +33,7 @@ $id=GETPOST('id', 'int'); // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 1ae457fb907..63b31328716 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -64,7 +64,7 @@ if ($id) // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; $feature2='user'; $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index 1cdf76e5ca4..448f38aea50 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -49,7 +49,7 @@ $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; $object = new Usergroup($db); $object->fetch($id); diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index a89fe447aa0..dc990497808 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -37,8 +37,8 @@ $langs->loadLangs(array('users', 'companies')); // Security check (for external users) $socid=0; -if ($user->societe_id > 0) - $socid = $user->societe_id; +if ($user->socid > 0) + $socid = $user->socid; $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $search_user=GETPOST('search_user', 'alpha'); diff --git a/htdocs/user/home.php b/htdocs/user/home.php index b17eafb22e6..ec742f3e6a9 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -45,7 +45,7 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) // Security check (for external users) $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; $companystatic = new Societe($db); $fuserstatic = new User($db); diff --git a/htdocs/user/info.php b/htdocs/user/info.php index 9296f0213ae..f10328e2a99 100644 --- a/htdocs/user/info.php +++ b/htdocs/user/info.php @@ -41,7 +41,7 @@ if ($id > 0 || ! empty($ref)) // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php index da3f3c774c6..0f11b91cd9e 100644 --- a/htdocs/user/ldap.php +++ b/htdocs/user/ldap.php @@ -35,7 +35,7 @@ $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'userldap // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 668f05fa6c2..31e5c5382de 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -42,8 +42,8 @@ $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'userlist // Security check (for external users) $socid=0; -if ($user->societe_id > 0) { - $socid = $user->societe_id; +if ($user->socid > 0) { + $socid = $user->socid; } // Load mode employee diff --git a/htdocs/user/note.php b/htdocs/user/note.php index 0fdbdd26b81..51f6740d636 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -43,7 +43,7 @@ if (($object->id != $user->id) && (! $user->rights->user->user->lire)) accessfor // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 577af6c04ba..2d6bc021355 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -39,7 +39,7 @@ $action = GETPOST('action', 'aZ09'); $actionid=GETPOST('actionid'); // Security check -if ($user->societe_id) $id=$user->societe_id; +if ($user->socid) $id=$user->socid; $result = restrictedArea($user, 'societe', '', ''); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 813b5ab4b7f..736db8767ec 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -47,7 +47,7 @@ if ($id) // Security check $socid=0; -if ($user->societe_id > 0) $socid = $user->societe_id; +if ($user->socid > 0) $socid = $user->socid; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index d85adf12a3e..26758f52ab0 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -56,7 +56,7 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) // Security check $socid=0; -if (isset($user->societe_id) && $user->societe_id > 0) $socid = $user->societe_id; +if (isset($user->socid) && $user->socid > 0) $socid = $user->socid; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); // A user can always read its own card if not advanced perms enabled, or if he has advanced perms, except for admin if ($user->id == $id && (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->user->self_advance->readperms) && empty($user->admin))) @@ -255,7 +255,7 @@ print '
'; if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules")); // Show warning about external users -if (empty($user->societe_id)) print info_admin(showModulesExludedForExternal($modules))."\n"; +if (empty($user->socid)) print info_admin(showModulesExludedForExternal($modules))."\n"; $parameters=array('permsgroupbyentity'=>$permsgroupbyentity); $reshook=$hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index a87959e76fb..03f424f2dcc 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -304,7 +304,7 @@ if (! empty($id) || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter=" fk_product_type = ".$object->type; - dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1); + dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', '', '', '', 0, '', '', 1); print '
'; diff --git a/htdocs/variants/generator.php b/htdocs/variants/generator.php index 6bec619269a..27f811fdafe 100644 --- a/htdocs/variants/generator.php +++ b/htdocs/variants/generator.php @@ -159,7 +159,7 @@ if (! empty($id) || ! empty($ref)) { $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter=" fk_product_type = ".$object->type; - dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1); + dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', '', '', '', 0, '', '', 1); dol_fiche_end(); } diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 904266e281b..123578fb5ab 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -198,7 +198,7 @@ if (! empty($hashp)) else { // Basic protection (against external users only) - if ($user->societe_id > 0) + if ($user->socid > 0) { if ($sqlprotectagainstexternals) { @@ -210,7 +210,7 @@ else while ($i < $num) { $obj = $db->fetch_object($resql); - if ($user->societe_id != $obj->fk_soc) + if ($user->socid != $obj->fk_soc) { $accessallowed=0; break; diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 509115d48d6..8f06153a34e 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -359,7 +359,7 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '') 'pass_indatabase_crypted' => $user->pass_indatabase_crypted, 'datec' => dol_print_date($user->datec, 'dayhourrfc'), 'datem' => dol_print_date($user->datem, 'dayhourrfc'), - 'fk_thirdparty' => $user->societe_id, + 'fk_thirdparty' => $user->socid, 'fk_contact' => $user->contact_id, 'fk_member' => $user->fk_member, 'datelastlogin' => dol_print_date($user->datelastlogin, 'dayhourrfc'), diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index b9a1239449e..db8c5b632f6 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -61,8 +61,8 @@ foreach($object->fields as $key => $val) if (empty($action) && empty($id) && empty($ref)) $action='view'; // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'website', $id); $permissionnote=$user->rights->websiteaccount->write; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/zapier/class/api_zapier.class.php b/htdocs/zapier/class/api_zapier.class.php index 287f1b9e3b7..c4fb81065d5 100644 --- a/htdocs/zapier/class/api_zapier.class.php +++ b/htdocs/zapier/class/api_zapier.class.php @@ -149,7 +149,7 @@ class ZapierApi extends DolibarrApi $obj_ret = array(); - $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; + $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; // Set to 1 if there is a field socid in table of object $restrictonsocid = 0; diff --git a/htdocs/zapier/hook_agenda.php b/htdocs/zapier/hook_agenda.php index 6a10972a30e..52909360ba0 100644 --- a/htdocs/zapier/hook_agenda.php +++ b/htdocs/zapier/hook_agenda.php @@ -66,8 +66,8 @@ else $search_agenda_label=GETPOST('search_agenda_label'); // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; diff --git a/htdocs/zapier/hook_card.php b/htdocs/zapier/hook_card.php index 1d8a042435e..aca2e59df9b 100644 --- a/htdocs/zapier/hook_card.php +++ b/htdocs/zapier/hook_card.php @@ -99,8 +99,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); diff --git a/htdocs/zapier/hook_document.php b/htdocs/zapier/hook_document.php index e5b4d8277b9..6ad31221cc4 100644 --- a/htdocs/zapier/hook_document.php +++ b/htdocs/zapier/hook_document.php @@ -54,8 +54,8 @@ $id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); $ref = GETPOST('ref', 'alpha'); // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); // Get parameters diff --git a/htdocs/zapier/hook_list.php b/htdocs/zapier/hook_list.php index c1437eb02f6..e622ce8bcff 100644 --- a/htdocs/zapier/hook_list.php +++ b/htdocs/zapier/hook_list.php @@ -116,9 +116,9 @@ if (! $sortorder) { // Security check $socid=0; -if ($user->societe_id > 0) { +if ($user->socid > 0) { // Protection if external user - //$socid = $user->societe_id; + //$socid = $user->socid; accessforbidden(); } //$result = restrictedArea($user, 'mymodule', $id, ''); diff --git a/htdocs/zapier/hook_note.php b/htdocs/zapier/hook_note.php index 718acc606d4..dcfba358da1 100644 --- a/htdocs/zapier/hook_note.php +++ b/htdocs/zapier/hook_note.php @@ -60,8 +60,8 @@ $hookmanager->initHooks(array('myobjectnote','globalcard')); // Note that co $extrafields->fetch_name_optionals_label($object->table_element); // Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; +//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); // Load object diff --git a/htdocs/zapier/zapierindex.php b/htdocs/zapier/zapierindex.php index 6e9e0491946..9bec765c35e 100644 --- a/htdocs/zapier/zapierindex.php +++ b/htdocs/zapier/zapierindex.php @@ -50,10 +50,10 @@ $action=GETPOST('action', 'alpha'); // Securite acces client if (! $user->rights->zapierfordolibarr->read) accessforbidden(); $socid=GETPOST('socid', 'int'); -if (isset($user->societe_id) && $user->societe_id > 0) +if (isset($user->socid) && $user->socid > 0) { $action = ''; - $socid = $user->societe_id; + $socid = $user->socid; } $max=5;