Merge pull request #22179 from grandoc/new_branch_10_09_2022
update code toward php8 compliance
This commit is contained in:
commit
f08f00bda0
@ -480,8 +480,8 @@ if (empty($reshook)) {
|
||||
// Mass actions
|
||||
$objectclass = 'Bookkeeping';
|
||||
$objectlabel = 'Bookkeeping';
|
||||
$permissiontoread = $user->rights->societe->lire;
|
||||
$permissiontodelete = $user->rights->societe->supprimer;
|
||||
$permissiontoread = $user->hasRight('societe', 'lire');
|
||||
$permissiontodelete = $user->hasRight('societe', 'supprimer');
|
||||
$permissiontoadd = $user->rights->societe->creer;
|
||||
$uploaddir = $conf->societe->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
@ -395,8 +395,8 @@ if (empty($reshook)) {
|
||||
// Mass actions
|
||||
$objectclass = 'Bookkeeping';
|
||||
$objectlabel = 'Bookkeeping';
|
||||
$permissiontoread = $user->rights->societe->lire;
|
||||
$permissiontodelete = $user->rights->societe->supprimer;
|
||||
$permissiontoread = $user->hasRight('societe', 'lire');
|
||||
$permissiontodelete = $user->hasRight('societe', 'supprimer');
|
||||
$permissiontoadd = $user->rights->societe->creer;
|
||||
$uploaddir = $conf->societe->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
@ -186,7 +186,7 @@ if (isModEnabled('adherent') && !empty($user->rights->adherent->lire)) {
|
||||
if (isModEnabled('recruitment') && !empty($user->rights->recruitment->recruitmentjobposition->read)) {
|
||||
$elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures'));
|
||||
}
|
||||
if (isModEnabled("societe") && !empty($user->rights->societe->lire)) {
|
||||
if (isModEnabled("societe") && $user->hasRight('societe', 'lire')) {
|
||||
$elementList['thirdparty'] = img_picto('', 'company', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToThirdparty'));
|
||||
}
|
||||
if (isModEnabled('project')) {
|
||||
|
||||
@ -272,7 +272,7 @@ class Documents extends DolibarrApi
|
||||
if ($modulepart == 'societe' || $modulepart == 'thirdparty') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
|
||||
@ -397,7 +397,7 @@ if (!empty($user->rights->produit->lire) || !empty($user->rights->service->lire)
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if (!empty($user->rights->societe->lire)) {
|
||||
if ($user->hasRight('societe', 'lire')) {
|
||||
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromthirdparty') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"><label for="fillfromthirdparty"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").'</label>';
|
||||
print '<br>';
|
||||
print '<div class="showforthirdpartyselector">';
|
||||
|
||||
@ -315,7 +315,7 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(401);
|
||||
} elseif ($type == Categorie::TYPE_CONTACT && !DolibarrApiAccess::$user->rights->contact->lire) {
|
||||
throw new RestException(401);
|
||||
} elseif ($type == Categorie::TYPE_CUSTOMER && !DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
} elseif ($type == Categorie::TYPE_CUSTOMER && !DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
|
||||
throw new RestException(401);
|
||||
} elseif ($type == Categorie::TYPE_SUPPLIER && !DolibarrApiAccess::$user->rights->fournisseur->lire) {
|
||||
throw new RestException(401);
|
||||
|
||||
@ -131,7 +131,7 @@ if ($id > 0 && empty($object->id)) {
|
||||
}
|
||||
}
|
||||
if ($object->id > 0) {
|
||||
if (!($object->client > 0) || empty($user->rights->societe->lire)) {
|
||||
if (!($object->client > 0) || !$user->hasRight('societe', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
}
|
||||
|
||||
@ -594,7 +594,7 @@ print '</div><div class="fichetwothirdright">';
|
||||
/*
|
||||
* Last modified customers or prospects
|
||||
*/
|
||||
if (isModEnabled("societe") && $user->rights->societe->lire) {
|
||||
if (isModEnabled("societe") && $user->hasRight('societe', 'lire')) {
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
|
||||
$sql .= ", s.code_client, s.code_compta, s.client";
|
||||
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
|
||||
@ -700,7 +700,7 @@ if (isModEnabled("societe") && $user->rights->societe->lire) {
|
||||
/*
|
||||
* Last suppliers
|
||||
*/
|
||||
if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $user->rights->societe->lire) {
|
||||
if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $user->hasRight('societe', 'lire')) {
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
|
||||
$sql .= ", s.code_client, s.code_compta, s.client";
|
||||
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
|
||||
|
||||
@ -312,8 +312,8 @@ if (empty($reshook)) {
|
||||
// Mass actions
|
||||
$objectclass = 'Contact';
|
||||
$objectlabel = 'Contact';
|
||||
$permissiontoread = $user->rights->societe->lire;
|
||||
$permissiontodelete = $user->rights->societe->supprimer;
|
||||
$permissiontoread = $user->hasRight('societe', 'lire');
|
||||
$permissiontodelete = $user->hasRight('societe', 'supprimer');
|
||||
$permissiontoadd = $user->rights->societe->creer;
|
||||
$uploaddir = $conf->societe->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
@ -690,7 +690,7 @@ $arrayofmassactions = array(
|
||||
// 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->societe->supprimer) {
|
||||
if ($user->hasRight('societe', 'supprimer')) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if ($user->rights->societe->creer) {
|
||||
|
||||
@ -67,7 +67,7 @@ if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
//$user->rights->societe->lire = 0;$user->rights->fournisseur->lire = 0;
|
||||
//$user->hasRight('societe', 'lire') = 0;$user->rights->fournisseur->lire = 0;
|
||||
//restrictedArea($user, 'societe', $id);
|
||||
|
||||
if (in_array($field, array('status'))) {
|
||||
|
||||
@ -86,7 +86,7 @@ class box_clients extends ModeleBoxes
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedCustomers", $max));
|
||||
|
||||
if ($user->rights->societe->lire) {
|
||||
if ($user->hasRight('societe', 'lire')) {
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
|
||||
$sql .= ", s.code_client, s.code_compta, s.client";
|
||||
$sql .= ", s.logo, s.email, s.entity";
|
||||
|
||||
@ -85,7 +85,7 @@ class box_contacts extends ModeleBoxes
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedContacts", $max));
|
||||
|
||||
if ($user->rights->societe->lire && $user->rights->societe->contact->lire) {
|
||||
if ($user->hasRight('societe', 'lire') && $user->rights->societe->contact->lire) {
|
||||
$sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc, sp.statut as status";
|
||||
|
||||
$sql .= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile, sp.email as spemail";
|
||||
|
||||
@ -86,7 +86,7 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastOutstandingBillReached", $max));
|
||||
|
||||
if ($user->rights->societe->lire) {
|
||||
if ($user->hasRight('societe', 'lire')) {
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
|
||||
$sql .= ", s.code_client, s.code_compta, s.client";
|
||||
$sql .= ", s.logo, s.email, s.entity";
|
||||
|
||||
@ -114,8 +114,8 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
$conditions = array(
|
||||
'users' => $user->hasRight('user', 'user', 'lire'),
|
||||
'members' => isModEnabled('adherent') && $user->rights->adherent->lire,
|
||||
'customers' => isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
|
||||
'prospects' => isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
|
||||
'customers' => isModEnabled('societe') && $user->hasRight('societe', 'lire') && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
|
||||
'prospects' => isModEnabled('societe') && $user->hasRight('societe', 'lire') && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
|
||||
'suppliers' => ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->lire)
|
||||
|| (isModEnabled("supplier_order") && $user->rights->supplier_order->lire)
|
||||
|| (isModEnabled("supplier_invoice") && $user->rights->supplier_invoice->lire)
|
||||
|
||||
@ -81,7 +81,7 @@ class box_fournisseurs extends ModeleBoxes
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedSuppliers", $max));
|
||||
|
||||
if ($user->rights->societe->lire) {
|
||||
if ($user->hasRight('societe', 'lire')) {
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
|
||||
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
|
||||
$sql .= ", s.logo, s.email, s.entity";
|
||||
|
||||
@ -69,7 +69,7 @@ class box_goodcustomers extends ModeleBoxes
|
||||
$this->enabled = 0; // not enabled by default. Very slow on large database
|
||||
}
|
||||
|
||||
$this->hidden = empty($user->rights->societe->lire);
|
||||
$this->hidden = !$user->hasRight('societe', 'lire');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,7 +90,7 @@ class box_goodcustomers extends ModeleBoxes
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleGoodCustomers", $max));
|
||||
|
||||
if ($user->rights->societe->lire) {
|
||||
if ($user->hasRight('societe', 'lire')) {
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms as datem, s.status as status,";
|
||||
$sql .= " count(*) as nbfact, sum(".$this->db->ifsql('f.paye=1', '1', '0').") as nbfactpaye";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
|
||||
|
||||
@ -86,7 +86,7 @@ class box_prospect extends ModeleBoxes
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects", $max));
|
||||
|
||||
if ($user->rights->societe->lire) {
|
||||
if ($user->hasRight('societe', 'lire')) {
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
|
||||
$sql .= ", s.code_client, s.code_compta, s.client";
|
||||
$sql .= ", s.logo, s.email, s.entity";
|
||||
|
||||
@ -104,7 +104,7 @@ class FormContract
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
|
||||
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($user->rights->societe->lire)) {
|
||||
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$user->hasRight('societe', 'lire')) {
|
||||
// Do nothing
|
||||
} else {
|
||||
$labeltoshow = dol_trunc($obj->ref, 18);
|
||||
|
||||
@ -99,7 +99,7 @@ class FormIntervention
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
|
||||
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($user->rights->societe->lire)) {
|
||||
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$user->hasRight('societe', 'lire')) {
|
||||
// Do nothing
|
||||
} else {
|
||||
$labeltoshow = dol_trunc($obj->ref, 18);
|
||||
|
||||
@ -206,7 +206,7 @@ class FormProjets
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
|
||||
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($user->rights->societe->lire)) {
|
||||
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$user->hasRight('societe', 'lire')) {
|
||||
// Do nothing
|
||||
} else {
|
||||
if ($discard_closed == 1 && $obj->fk_statut == 2 && $obj->rowid != $selected) { // We discard closed except if selected
|
||||
|
||||
@ -104,7 +104,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
}
|
||||
}
|
||||
|
||||
if (isModEnabled('societe') && !empty($user->rights->societe->lire)) {
|
||||
if (isModEnabled('societe') && $user->hasRight('societe', 'lire')) {
|
||||
print '<div class="divsearchfield">';
|
||||
print img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth inline-block"');
|
||||
print $form->select_company($socid, 'search_socid', '', ' ', 0, 0, null, 0, 'minwidth100 maxwidth500');
|
||||
|
||||
@ -242,7 +242,7 @@ function societe_prepare_head(Societe $object)
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (isModEnabled('website') && (!empty($conf->global->WEBSITE_USE_WEBSITE_ACCOUNTS)) && (!empty($user->rights->societe->lire))) {
|
||||
if (isModEnabled('website') && (!empty($conf->global->WEBSITE_USE_WEBSITE_ACCOUNTS)) && ($user->hasRight('societe', 'lire'))) {
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/website.php?id='.urlencode($object->id);
|
||||
$head[$h][1] = $langs->trans("WebSiteAccounts");
|
||||
$nbNote = 0;
|
||||
|
||||
@ -421,7 +421,7 @@ function restrictedArea(User $user, $features, $objectid = 0, $tableandshare = '
|
||||
}
|
||||
|
||||
if ($feature == 'societe') {
|
||||
if (empty($user->rights->societe->lire) && empty($user->rights->fournisseur->lire)) {
|
||||
if (!$user->hasRight('societe', 'lire') && empty($user->rights->fournisseur->lire)) {
|
||||
$readok = 0;
|
||||
$nbko++;
|
||||
}
|
||||
@ -831,7 +831,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
if ($user->socid != $objectid) {
|
||||
return false;
|
||||
}
|
||||
} elseif (isModEnabled("societe") && ($user->rights->societe->lire && empty($user->rights->societe->client->voir))) {
|
||||
} elseif (isModEnabled("societe") && ($user->hasRight('societe', 'lire') && empty($user->rights->societe->client->voir))) {
|
||||
// If internal user: Check permission for internal users that are restricted on their objects
|
||||
$sql = "SELECT COUNT(sc.fk_soc) as nb";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -857,7 +857,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
$sql .= " WHERE dbt.".$dbt_select." IN (".$db->sanitize($objectid, 1).")";
|
||||
$sql .= " AND dbt.fk_soc = ".((int) $user->socid);
|
||||
} elseif (isModEnabled("societe") && ($user->rights->societe->lire && empty($user->rights->societe->client->voir))) {
|
||||
} elseif (isModEnabled("societe") && ($user->hasRight('societe', 'lire') && empty($user->rights->societe->client->voir))) {
|
||||
// If internal user: Check permission for internal users that are restricted on their objects
|
||||
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
|
||||
@ -337,7 +337,7 @@ function displayPositionCard(&$object)
|
||||
// */
|
||||
// $filedir = $conf->societe->multidir_output[$object->entity].'/'.$object->id;
|
||||
// $urlsource = $_SERVER["PHP_SELF"]."?socid=".$object->id;
|
||||
// $genallowed = $user->rights->societe->lire;
|
||||
// $genallowed = $user->hasRight('societe', 'lire');
|
||||
// $delallowed = $user->rights->societe->creer;
|
||||
//
|
||||
// print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang);
|
||||
|
||||
@ -27,7 +27,7 @@ require '../main.inc.php';
|
||||
|
||||
if ($user->rights->produit->lire) {
|
||||
$page = 'productMargins';
|
||||
} elseif ($user->rights->societe->lire) {
|
||||
} elseif ($user->hasRight('societe', 'lire')) {
|
||||
$page = 'customerMargins';
|
||||
} else {
|
||||
$page = 'agentMargins';
|
||||
|
||||
@ -71,7 +71,7 @@ function marges_prepare_head()
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($user->rights->societe->lire) {
|
||||
if ($user->hasRight('societe', 'lire')) {
|
||||
$head[$h][0] = DOL_URL_ROOT."/margin/customerMargins.php";
|
||||
$head[$h][1] = $langs->trans("CustomerMargins");
|
||||
$head[$h][2] = 'customerMargins';
|
||||
|
||||
@ -263,7 +263,7 @@ for ($i = 1; $i <= 4; $i++) {
|
||||
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=edit&token='.newToken().'&canvas='.urlencode($canvas); ?>"><?php echo $langs->trans("Modify"); ?></a>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($user->rights->societe->supprimer) { ?>
|
||||
<?php if ($user->hasRight('societe', 'supprimer')) { ?>
|
||||
<?php if ($conf->use_javascript_ajax) { ?>
|
||||
<span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span>
|
||||
<?php } else { ?>
|
||||
@ -283,7 +283,7 @@ for ($i = 1; $i <= 4; $i++) {
|
||||
*/
|
||||
$filedir = $conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid;
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?socid=".$socid;
|
||||
$genallowed = $user->rights->societe->lire;
|
||||
$genallowed = $user->hasRight('societe', 'lire');
|
||||
$delallowed = $user->rights->societe->creer;
|
||||
|
||||
print $formfile->showdocuments('company', $socid, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $objcanvas->control->object->default_lang);
|
||||
|
||||
@ -190,7 +190,7 @@ if ($this->control->tpl['action_delete']) {
|
||||
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=edit&token='.newToken().'&canvas='.urlencode($canvas); ?>"><?php echo $langs->trans("Modify"); ?></a>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($user->rights->societe->supprimer) { ?>
|
||||
<?php if ($user->hasRight('societe', 'supprimer')) { ?>
|
||||
<?php if ($conf->use_javascript_ajax) { ?>
|
||||
<span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span>
|
||||
<?php } else { ?>
|
||||
@ -209,7 +209,7 @@ if ($this->control->tpl['action_delete']) {
|
||||
*/
|
||||
$filedir = $conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid;
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?socid=".$socid;
|
||||
$genallowed = $user->rights->societe->lire;
|
||||
$genallowed = $user->hasRight('societe', 'lire');
|
||||
$delallowed = $user->rights->societe->creer;
|
||||
|
||||
print $formfile->showdocuments('company', $socid, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $objcanvas->control->object->default_lang);
|
||||
|
||||
@ -137,9 +137,9 @@ if (!empty($canvas)) {
|
||||
}
|
||||
|
||||
// Permissions
|
||||
$permissiontoread = $user->rights->societe->lire;
|
||||
$permissiontoread = $user->hasRight('societe', 'lire');
|
||||
$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->rights->societe->supprimer || ($permissiontoadd && isset($object->status) && $object->status == 0);
|
||||
$permissiontodelete = $user->hasRight('societe', 'supprimer') || ($permissiontoadd && isset($object->status) && $object->status == 0);
|
||||
$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->societe->creer; // Used by the include of actions_dellink.inc.php
|
||||
$upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
@ -914,7 +914,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Delete third party
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->supprimer) {
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('societe', 'supprimer')) {
|
||||
$object->fetch($socid);
|
||||
$object->oldcopy = clone $object;
|
||||
$result = $object->delete($socid, $user);
|
||||
@ -3247,7 +3247,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
print dolGetButtonAction($langs->trans('MergeThirdparties'), $langs->trans('Merge'), 'danger', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=merge&token='.newToken(), '', $permissiontodelete);
|
||||
|
||||
if ($user->rights->societe->supprimer) {
|
||||
if ($user->hasRight('societe', 'supprimer')) {
|
||||
$deleteUrl = $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken();
|
||||
$buttonId = 'action-delete-no-ajax';
|
||||
if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) { // We can't use preloaded confirm form with jmobile
|
||||
@ -3277,7 +3277,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
*/
|
||||
$filedir = $conf->societe->multidir_output[$object->entity].'/'.$object->id;
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?socid=".$object->id;
|
||||
$genallowed = $user->rights->societe->lire;
|
||||
$genallowed = $user->hasRight('societe', 'lire');
|
||||
$delallowed = $user->rights->societe->creer;
|
||||
|
||||
print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang);
|
||||
|
||||
@ -132,7 +132,7 @@ class Thirdparties extends DolibarrApi
|
||||
{
|
||||
$obj_ret = array();
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -527,7 +527,7 @@ class Thirdparties extends DolibarrApi
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->societe->supprimer) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('societe', 'supprimer')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->company->fetch($id);
|
||||
@ -848,7 +848,7 @@ class Thirdparties extends DolibarrApi
|
||||
*/
|
||||
public function getOutStandingProposals($id, $mode = 'customer')
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -890,7 +890,7 @@ class Thirdparties extends DolibarrApi
|
||||
*/
|
||||
public function getOutStandingOrder($id, $mode = 'customer')
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -931,7 +931,7 @@ class Thirdparties extends DolibarrApi
|
||||
*/
|
||||
public function getOutStandingInvoices($id, $mode = 'customer')
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -972,7 +972,7 @@ class Thirdparties extends DolibarrApi
|
||||
*/
|
||||
public function getSalesRepresentatives($id, $mode = 0)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -1015,7 +1015,7 @@ class Thirdparties extends DolibarrApi
|
||||
{
|
||||
$obj_ret = array();
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -1439,7 +1439,7 @@ class Thirdparties extends DolibarrApi
|
||||
*/
|
||||
public function getSocieteAccounts($id, $site = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -1870,7 +1870,7 @@ class Thirdparties extends DolibarrApi
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login.'. No read permission on thirdparties.');
|
||||
}
|
||||
|
||||
|
||||
@ -124,10 +124,10 @@ $result = $db->query($sql);
|
||||
if ($result) {
|
||||
while ($objp = $db->fetch_object($result)) {
|
||||
$found = 0;
|
||||
if (isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) {
|
||||
if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) {
|
||||
$found = 1; $third['prospect']++;
|
||||
}
|
||||
if (isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) {
|
||||
if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) {
|
||||
$found = 1; $third['customer']++;
|
||||
}
|
||||
if (((isModEnabled('fournisseur') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->rights->supplier_order->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) {
|
||||
@ -150,10 +150,10 @@ $thirdpartygraph .= '<tr class="liste_titre"><th colspan="2">'.$langs->trans("St
|
||||
if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + (round($third['customer']) ? 1 : 0) + (round($third['supplier']) ? 1 : 0) + (round($third['other']) ? 1 : 0) >= 2)) {
|
||||
$thirdpartygraph .= '<tr><td class="center" colspan="2">';
|
||||
$dataseries = array();
|
||||
if (isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) {
|
||||
if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) {
|
||||
$dataseries[] = array($langs->trans("Prospects"), round($third['prospect']));
|
||||
}
|
||||
if (isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) {
|
||||
if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) {
|
||||
$dataseries[] = array($langs->trans("Customers"), round($third['customer']));
|
||||
}
|
||||
if (((isModEnabled('fournisseur') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->rights->supplier_order->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) {
|
||||
@ -173,12 +173,12 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) +
|
||||
$thirdpartygraph .= $dolgraph->show();
|
||||
$thirdpartygraph .= '</td></tr>'."\n";
|
||||
} else {
|
||||
if (isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) {
|
||||
if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) {
|
||||
$statstring = "<tr>";
|
||||
$statstring .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=p">'.$langs->trans("Prospects").'</a></td><td class="right">'.round($third['prospect']).'</td>';
|
||||
$statstring .= "</tr>";
|
||||
}
|
||||
if (isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) {
|
||||
if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) {
|
||||
$statstring .= "<tr>";
|
||||
$statstring .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=c">'.$langs->trans("Customers").'</a></td><td class="right">'.round($third['customer']).'</td>';
|
||||
$statstring .= "</tr>";
|
||||
|
||||
@ -383,8 +383,8 @@ if (empty($reshook)) {
|
||||
// Mass actions
|
||||
$objectclass = 'Societe';
|
||||
$objectlabel = 'ThirdParty';
|
||||
$permissiontoread = $user->rights->societe->lire;
|
||||
$permissiontodelete = $user->rights->societe->supprimer;
|
||||
$permissiontoread = $user->hasRight('societe', 'lire');
|
||||
$permissiontodelete = $user->hasRight('societe', 'supprimer');
|
||||
$permissiontoadd = $user->rights->societe->creer;
|
||||
$uploaddir = $conf->societe->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
@ -898,7 +898,7 @@ if ($user->rights->societe->creer) {
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) {
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
if ($user->rights->societe->supprimer) {
|
||||
if ($user->hasRight('societe', 'supprimer')) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
@ -79,7 +79,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$hookmanager->initHooks(array('thirdpartybancard', 'globalcard'));
|
||||
|
||||
// Permissions
|
||||
$permissiontoread = $user->rights->societe->lire;
|
||||
$permissiontoread = $user->hasRight('societe', 'lire');
|
||||
$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_builddoc.inc.php
|
||||
|
||||
$permissiontoaddupdatepaymentinformation = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $permissiontoadd) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->societe->thirdparty_paymentinformation_advance->write)));
|
||||
|
||||
@ -161,8 +161,8 @@ if (empty($reshook)) {
|
||||
// Mass actions
|
||||
$objectclass = 'WebsiteAccount';
|
||||
$objectlabel = 'WebsiteAccount';
|
||||
$permissiontoread = $user->rights->societe->lire;
|
||||
$permissiontodelete = $user->rights->societe->supprimer;
|
||||
$permissiontoread = $user->hasRight('societe', 'lire');
|
||||
$permissiontodelete = $user->hasRight('societe', 'supprimer');
|
||||
$uploaddir = $conf->societe->multidir_output[$object->entity];
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -250,7 +250,7 @@ print dol_get_fiche_end();
|
||||
|
||||
$newcardbutton = '';
|
||||
if (isModEnabled('website')) {
|
||||
if (!empty($user->rights->societe->lire)) {
|
||||
if ($user->hasRight('societe', 'lire')) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans("AddWebsiteAccount"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id));
|
||||
} else {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', 0);
|
||||
|
||||
@ -491,7 +491,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
||||
|
||||
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', '');
|
||||
|
||||
if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) {
|
||||
if ($socid && !$projectid && !$project_ref && $user->hasRight('societe', 'lire')) {
|
||||
$socstat = new Societe($db);
|
||||
$res = $socstat->fetch($socid);
|
||||
if ($res > 0) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user