Merge pull request #24786 from Hystepik/develop#2
fix : php 8.1 warnings
This commit is contained in:
commit
886954deb2
19 changed files with 70 additions and 70 deletions
|
|
@ -194,7 +194,7 @@ if ($object->id > 0) {
|
|||
$out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id);
|
||||
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||
$out .= '&backtopage='.urlencode($urlbacktopage);
|
||||
$permok = $user->rights->agenda->myactions->create;
|
||||
$permok = $user->hasRight('paymentbagendaybanktransfer', 'myactions', 'create');
|
||||
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
|
||||
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
||||
if (get_class($objthirdparty) == 'Societe') {
|
||||
|
|
|
|||
|
|
@ -747,10 +747,10 @@ if ($object->id > 0) {
|
|||
print "\n".'<div class="tabsAction">'."\n";
|
||||
|
||||
$buttonlabel = $langs->trans("MakeWithdrawRequest");
|
||||
$user_perms = $user->rights->prelevement->bons->creer;
|
||||
$user_perms = $user->hasRight('prelevement', 'bons', 'creer');
|
||||
if ($type == 'bank-transfer') {
|
||||
$buttonlabel = $langs->trans("MakeBankTransferOrder");
|
||||
$user_perms = $user->rights->paymentbybanktransfer->create;
|
||||
$user_perms = $user->hasRight('paymentbybanktransfer', 'create');
|
||||
}
|
||||
|
||||
// Add a transfer request
|
||||
|
|
|
|||
|
|
@ -2340,14 +2340,14 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
|||
}
|
||||
} elseif ($object->element == 'product') {
|
||||
//$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Sell").') ';
|
||||
if (!empty($conf->use_javascript_ajax) && $user->rights->produit->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
if (!empty($conf->use_javascript_ajax) && $user->hasRight('produit', 'creer') && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
$morehtmlstatus .= ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
|
||||
} else {
|
||||
$morehtmlstatus .= '<span class="statusrefsell">'.$object->getLibStatut(6, 0).'</span>';
|
||||
}
|
||||
$morehtmlstatus .= ' ';
|
||||
//$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Buy").') ';
|
||||
if (!empty($conf->use_javascript_ajax) && $user->rights->produit->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
if (!empty($conf->use_javascript_ajax) && $user->hasRight('produit', 'creer') && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
$morehtmlstatus .= ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
|
||||
} else {
|
||||
$morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(6, 1).'</span>';
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ function product_prepare_head($object)
|
|||
}
|
||||
|
||||
if ($object->isProduct() || ($object->isService() && !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { // If physical product we can stock (or service with option)
|
||||
if (isModEnabled('stock') && $user->rights->stock->lire) {
|
||||
if (isModEnabled('stock') && $user->hasRight('stock', 'lire')) {
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("Stock");
|
||||
$head[$h][2] = 'stock';
|
||||
|
|
@ -457,7 +457,7 @@ function show_stats_for_company($product, $socid)
|
|||
print '</tr>';
|
||||
}
|
||||
// Supplier proposals
|
||||
if (isModEnabled('supplier_proposal') && $user->rights->supplier_proposal->lire) {
|
||||
if (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire')) {
|
||||
$nblines++;
|
||||
$ret = $product->load_stats_proposal_supplier($socid);
|
||||
if ($ret < 0) {
|
||||
|
|
@ -495,7 +495,7 @@ function show_stats_for_company($product, $socid)
|
|||
print '</tr>';
|
||||
}
|
||||
// Supplier orders
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (isModEnabled("supplier_order") && $user->rights->supplier_order->lire)) {
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'commande', 'lire')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire'))) {
|
||||
$nblines++;
|
||||
$ret = $product->load_stats_commande_fournisseur($socid);
|
||||
if ($ret < 0) {
|
||||
|
|
@ -552,7 +552,7 @@ function show_stats_for_company($product, $socid)
|
|||
print '</tr>';
|
||||
}
|
||||
// Supplier invoices
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (isModEnabled("supplier_invoice") && $user->rights->supplier_invoice->lire)) {
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
|
||||
$nblines++;
|
||||
$ret = $product->load_stats_facture_fournisseur($socid);
|
||||
if ($ret < 0) {
|
||||
|
|
@ -592,7 +592,7 @@ function show_stats_for_company($product, $socid)
|
|||
}
|
||||
|
||||
// BOM
|
||||
if (isModEnabled('bom') && $user->rights->bom->read) {
|
||||
if (isModEnabled('bom') && $user->hasRight('bom', 'read')) {
|
||||
$nblines++;
|
||||
$ret = $product->load_stats_bom($socid);
|
||||
if ($ret < 0) {
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ if ($id > 0 || $ref) {
|
|||
$out = '';
|
||||
$morehtmlcenter = '';
|
||||
if (isModEnabled('agenda')) {
|
||||
$permok = $user->rights->agenda->myactions->create;
|
||||
$permok = $user->hasRight('agenda', 'myactions', 'create');
|
||||
if ((!empty($objproduct->id) || !empty($objcon->id)) && $permok) {
|
||||
if (get_class($objproduct) == 'Product') {
|
||||
$out .= '&prodid='.$objproduct->id.'&origin=product&originid='.$id;
|
||||
|
|
|
|||
|
|
@ -194,9 +194,9 @@ if ($object->id > 0) {
|
|||
$hookmanager->initHooks(array('productcard', 'globalcard'));
|
||||
|
||||
// Permissions
|
||||
$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->lire));
|
||||
$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer));
|
||||
$usercandelete = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer));
|
||||
$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'read')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'lire')));
|
||||
$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'creer')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'creer')));
|
||||
$usercandelete = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'supprimer')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'supprimer')));
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ if ($object->id > 0) {
|
|||
restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
|
||||
}
|
||||
|
||||
$permissiontoadd = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer));
|
||||
$permissiontoadd = (($object->type == Product::TYPE_PRODUCT && $user->hasRight('produit', 'creer')) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'creer')));
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -244,10 +244,10 @@ $arrayfields = array(
|
|||
'p.numbuyprice'=>array('label'=>"BuyingPriceNumShort", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>43),
|
||||
'p.pmp'=>array('label'=>"PMPValueShort", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>44),
|
||||
'p.cost_price'=>array('label'=>"CostPrice", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>45),
|
||||
'p.seuil_stock_alerte'=>array('label'=>"StockLimit", 'checked'=>0, 'enabled'=>(isModEnabled('stock') && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>50),
|
||||
'p.desiredstock'=>array('label'=>"DesiredStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>51),
|
||||
'p.stock'=>array('label'=>"PhysicalStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>52),
|
||||
'stock_virtual'=>array('label'=>"VirtualStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && $virtualdiffersfromphysical), 'position'=>53),
|
||||
'p.seuil_stock_alerte'=>array('label'=>"StockLimit", 'checked'=>0, 'enabled'=>(isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>50),
|
||||
'p.desiredstock'=>array('label'=>"DesiredStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>51),
|
||||
'p.stock'=>array('label'=>"PhysicalStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>52),
|
||||
'stock_virtual'=>array('label'=>"VirtualStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && $virtualdiffersfromphysical), 'position'=>53),
|
||||
'p.tobatch'=>array('label'=>"ManageLotSerial", 'checked'=>0, 'enabled'=>(isModEnabled('productbatch')), 'position'=>60),
|
||||
'p.fk_country'=>array('label'=>"Country", 'checked'=>0, 'position'=>100),
|
||||
'p.fk_state'=>array('label'=>"State", 'checked'=>0, 'position'=>101),
|
||||
|
|
@ -373,9 +373,9 @@ if (empty($reshook)) {
|
|||
$objectlabel = 'Products';
|
||||
}
|
||||
|
||||
$permissiontoread = $user->rights->{$rightskey}->lire;
|
||||
$permissiontodelete = $user->rights->{$rightskey}->supprimer;
|
||||
$permissiontoadd = $user->rights->{$rightskey}->creer;
|
||||
$permissiontoread = $user->hasRight($rightskey, 'lire');
|
||||
$permissiontodelete = $user->hasRight($rightskey, 'supprimer');
|
||||
$permissiontoadd = $user->hasRight($rightskey, 'creer');
|
||||
$uploaddir = $conf->product->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
|
|
@ -807,15 +807,15 @@ $arrayofmassactions = array(
|
|||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
);
|
||||
|
||||
if ($user->rights->{$rightskey}->supprimer) {
|
||||
if ($user->hasRight($rightskey, 'supprimer')) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if ($user->rights->{$rightskey}->creer) {
|
||||
if ($user->hasRight($rightskey, 'creer')) {
|
||||
$arrayofmassactions['switchonsalestatus'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SwitchOnSaleStatus");
|
||||
$arrayofmassactions['switchonpurchasestatus'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SwitchOnPurchaseStatus");
|
||||
$arrayofmassactions['preupdateprice'] = img_picto('', 'edit', 'class="pictofixedwidth"').$langs->trans("UpdatePrice");
|
||||
}
|
||||
if (isModEnabled('category') && $user->rights->{$rightskey}->creer) {
|
||||
if (isModEnabled('category') && $user->hasRight($rightskey, 'creer')) {
|
||||
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
|
||||
}
|
||||
if (in_array($massaction, array('presend', 'predelete','preaffecttag', 'edit_extrafields', 'preupdateprice'))) {
|
||||
|
|
@ -828,11 +828,11 @@ $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars i
|
|||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
|
||||
if ($type === "") {
|
||||
$perm = ($user->rights->produit->creer || $user->rights->service->creer);
|
||||
$perm = ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'));
|
||||
} elseif ($type == Product::TYPE_SERVICE) {
|
||||
$perm = $user->rights->service->creer;
|
||||
$perm = $user->hasRight('service', 'creer');
|
||||
} elseif ($type == Product::TYPE_PRODUCT) {
|
||||
$perm = $user->rights->produit->creer;
|
||||
$perm = $user->hasRight('produit', 'creer');
|
||||
}
|
||||
$oldtype = $type;
|
||||
$params = array();
|
||||
|
|
@ -1510,7 +1510,7 @@ while ($i < $imaxinloop) {
|
|||
}
|
||||
|
||||
// STOCK_DISABLE_OPTIM_LOAD can be set to force load_stock whatever is permissions on stock.
|
||||
if ((isModEnabled('stock') && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) { // To optimize call of load_stock
|
||||
if ((isModEnabled('stock') && $user->hasRight('stock', 'lire') && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) { // To optimize call of load_stock
|
||||
if ($product_static->type != 1 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Not a service
|
||||
$option = 'nobatch';
|
||||
if (empty($arrayfields['stock_virtual']['checked'])) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
$object->fetch($id, $ref);
|
||||
}
|
||||
|
||||
$permissionnote = ($user->rights->produit->creer || $user->rights->service->creer); // Used by the include of actions_setnotes.inc.php
|
||||
$permissionnote = ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')); // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
if ($object->id > 0) {
|
||||
if ($object->type == $object::TYPE_PRODUCT) {
|
||||
|
|
|
|||
|
|
@ -1333,12 +1333,12 @@ if (!$action || $action == 'delete' || $action == 'showlog_customer_price' || $a
|
|||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
if (empty($reshook)) {
|
||||
if ($object->isVariant()) {
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("NoEditVariants")) . '">' . $langs->trans("UpdateDefaultPrice") . '</a></div>';
|
||||
}
|
||||
} else {
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&token='.newToken().'&id=' . $object->id . '">' . $langs->trans("UpdateDefaultPrice") . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">' . $langs->trans("UpdateDefaultPrice") . '</span></div>';
|
||||
|
|
@ -1346,7 +1346,7 @@ if (!$action || $action == 'delete' || $action == 'showlog_customer_price' || $a
|
|||
}
|
||||
|
||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&token='.newToken().'&id=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">' . $langs->trans("AddCustomerPrice") . '</span></div>';
|
||||
|
|
@ -1354,13 +1354,13 @@ if (!$action || $action == 'delete' || $action == 'showlog_customer_price' || $a
|
|||
}
|
||||
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_vat&token='.newToken().'&id=' . $object->id . '">' . $langs->trans("UpdateVAT") . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">' . $langs->trans("UpdateVAT") . '</span></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&token='.newToken().'&id=' . $object->id . '">' . $langs->trans("UpdateLevelPrices") . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">' . $langs->trans("UpdateLevelPrices") . '</span></div>';
|
||||
|
|
@ -1378,7 +1378,7 @@ if (!$action || $action == 'delete' || $action == 'showlog_customer_price' || $a
|
|||
* Edit price area
|
||||
*/
|
||||
|
||||
if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||
if ($action == 'edit_vat' && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) {
|
||||
print load_fiche_titre($langs->trans("UpdateVAT"), '');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">';
|
||||
|
|
@ -2339,7 +2339,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||
print '<td class="right">'.price($object->price_min_ttc).'</td>';
|
||||
print '<td class="right">';
|
||||
print '</td>';
|
||||
if ($user->rights->produit->supprimer || $user->rights->service->supprimer) {
|
||||
if ($user->hasRight('produit', 'supprimer') || $user->hasRight('service', 'supprimer')) {
|
||||
print '<td class="nowraponall">';
|
||||
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?action=showlog_default_price&token='.newToken().'&id='.$object->id.'">';
|
||||
print img_info($langs->trans('PriceByCustomerLog'));
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
|
||||
if ($showmessage && $nboflines > 1) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers")).'</span>';
|
||||
} elseif ($user->rights->facture->lire) {
|
||||
} elseif ($user->hasRight('facture', 'lire')) {
|
||||
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
|
||||
$sql .= " f.ref, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,";
|
||||
$sql .= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
|
||||
|
|
|
|||
|
|
@ -104,9 +104,9 @@ if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $acti
|
|||
accessforbidden();
|
||||
}
|
||||
|
||||
$permissiontoadd = $user->rights->projet->creer;
|
||||
$permissiontodelete = $user->rights->projet->supprimer;
|
||||
$permissiondellink = $user->rights->projet->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoadd = $user->hasRight('projet', 'creer');
|
||||
$permissiontodelete = $user->hasRight('projet', 'supprimer');
|
||||
$permissiondellink = $user->hasRight('projet', 'creer'); // Used by the include of actions_dellink.inc.php
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -1504,7 +1504,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
|
|||
|
||||
// Back to draft
|
||||
if (!getDolGlobalString('MAIN_DISABLEDRAFTSTATUS') && !getDolGlobalString('MAIN_DISABLEDRAFTSTATUS_PROJECT')) {
|
||||
if ($object->statut != Project::STATUS_DRAFT && $user->rights->projet->creer) {
|
||||
if ($object->statut != Project::STATUS_DRAFT && $user->hasRight('projet', 'creer')) {
|
||||
if ($userWrite > 0) {
|
||||
print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?action=confirm_setdraft&confirm=yes&token='.newToken().'&id='.$object->id, '');
|
||||
} else {
|
||||
|
|
@ -1514,7 +1514,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
|
|||
}
|
||||
|
||||
// Modify
|
||||
if ($object->statut != Project::STATUS_CLOSED && $user->rights->projet->creer) {
|
||||
if ($object->statut != Project::STATUS_CLOSED && $user->hasRight('projet', 'creer')) {
|
||||
if ($userWrite > 0) {
|
||||
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '');
|
||||
} else {
|
||||
|
|
@ -1523,7 +1523,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
|
|||
}
|
||||
|
||||
// Validate
|
||||
if ($object->statut == Project::STATUS_DRAFT && $user->rights->projet->creer) {
|
||||
if ($object->statut == Project::STATUS_DRAFT && $user->hasRight('projet', 'creer')) {
|
||||
if ($userWrite > 0) {
|
||||
print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&token='.newToken().'&id='.$object->id, '');
|
||||
} else {
|
||||
|
|
@ -1570,7 +1570,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
|
|||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->projet->creer) {
|
||||
if ($user->hasRight('projet', 'creer')) {
|
||||
if ($userWrite > 0) {
|
||||
print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.$object->id, '');
|
||||
} else {
|
||||
|
|
@ -1579,8 +1579,8 @@ if ($action == 'create' && $user->rights->projet->creer) {
|
|||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->projet->supprimer || ($object->statut == Project::STATUS_DRAFT && $user->rights->projet->creer)) {
|
||||
if ($userDelete > 0 || ($object->statut == Project::STATUS_DRAFT && $user->rights->projet->creer)) {
|
||||
if ($user->hasRight('projet', 'supprimer') || ($object->statut == Project::STATUS_DRAFT && $user->hasRight('projet', 'creer'))) {
|
||||
if ($userDelete > 0 || ($object->statut == Project::STATUS_DRAFT && $user->hasRight('projet', 'creer'))) {
|
||||
print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '');
|
||||
} else {
|
||||
print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
||||
|
|
@ -1605,8 +1605,8 @@ if ($action == 'create' && $user->rights->projet->creer) {
|
|||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->project->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed = ($user->rights->projet->lire && $userAccess > 0);
|
||||
$delallowed = ($user->rights->projet->creer && $userWrite > 0);
|
||||
$genallowed = ($user->hasRight('projet', 'lire') && $userAccess > 0);
|
||||
$delallowed = ($user->hasRight('projet', 'creer') && $userWrite > 0);
|
||||
|
||||
print $formfile->showdocuments('project', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 0, 0, '', '', '', '', '', $object);
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ $socid = 0;
|
|||
//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');
|
||||
|
||||
$permissiontoadd = $user->rights->projet->creer;
|
||||
$permissiontoadd = $user->hasRight('projet', 'creer');
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ $listofreferent = array(
|
|||
'lang'=>'sendings',
|
||||
'buttonnew'=>'CreateShipment',
|
||||
'testnew'=>0,
|
||||
'test'=>$conf->expedition->enabled && $user->rights->expedition->lire),
|
||||
'test'=>$conf->expedition->enabled && $user->hasRight('expedition', 'lire')),
|
||||
'mrp'=>array(
|
||||
'name'=>"MO",
|
||||
'title'=>"ListMOAssociatedProject",
|
||||
|
|
|
|||
|
|
@ -317,14 +317,14 @@ if (empty($reshook)) {
|
|||
// Mass actions
|
||||
$objectclass = 'Project';
|
||||
$objectlabel = 'Project';
|
||||
$permissiontoread = $user->rights->projet->lire;
|
||||
$permissiontodelete = $user->rights->projet->supprimer;
|
||||
$permissiontoadd = $user->rights->projet->creer;
|
||||
$permissiontoread = $user->hasRight('projet', 'lire');
|
||||
$permissiontodelete = $user->hasRight('projet', 'supprimer');
|
||||
$permissiontoadd = $user->hasRight('projet', 'creer');
|
||||
$uploaddir = $conf->project->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
// Close records
|
||||
if (!$error && $massaction == 'close' && $user->rights->projet->creer) {
|
||||
if (!$error && $massaction == 'close' && $user->hasRight('projet', 'creer')) {
|
||||
$db->begin();
|
||||
|
||||
$objecttmp = new $objectclass($db);
|
||||
|
|
@ -903,14 +903,14 @@ $arrayofmassactions = array(
|
|||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
);
|
||||
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->projet->creer) {
|
||||
if ($user->hasRight('projet', 'creer')) {
|
||||
$arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Close");
|
||||
$arrayofmassactions['preaffectuser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("AffectUser");
|
||||
}
|
||||
if ($user->rights->projet->supprimer) {
|
||||
if ($user->hasRight('projet', 'supprimer')) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if (isModEnabled('category') && $user->rights->projet->creer) {
|
||||
if (isModEnabled('category') && $user->hasRight('projet', 'creer')) {
|
||||
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
|
||||
}
|
||||
if (in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preaffectuser'))) {
|
||||
|
|
@ -930,7 +930,7 @@ if ($search_usage_event_organization == 1) {
|
|||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewProject'), '', 'fa fa-plus-circle', $url, '', $user->rights->projet->creer);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewProject'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('projet', 'creer'));
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') {
|
||||
|
|
@ -950,7 +950,7 @@ $texthelp = '';
|
|||
if ($search_project_user == $user->id) {
|
||||
$texthelp .= $langs->trans("MyProjectsDesc");
|
||||
} else {
|
||||
if ($user->rights->projet->all->lire && !$socid) {
|
||||
if ($user->hasRight('projet', 'all', 'lire') && !$socid) {
|
||||
$texthelp .= $langs->trans("ProjectsDesc");
|
||||
} else {
|
||||
$texthelp .= $langs->trans("ProjectsPublicDesc");
|
||||
|
|
@ -1001,7 +1001,7 @@ if ($user->rights->user->user->lire) {
|
|||
}
|
||||
|
||||
// Filter on categories
|
||||
if (isModEnabled('categorie') && $user->rights->categorie->lire) {
|
||||
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
|
||||
$formcategory = new FormCategory($db);
|
||||
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array, 'minwidth300imp widthcentpercentminusx');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ print dol_get_fiche_end();
|
|||
// Actions buttons
|
||||
|
||||
$out = '';
|
||||
$permok = $user->rights->agenda->myactions->create;
|
||||
$permok = $user->hasRight('agenda', 'myactions', 'create');
|
||||
if ($permok) {
|
||||
$out .= '&projectid='.$object->id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ $socid = 0;
|
|||
$hookmanager->initHooks(array('projetnote'));
|
||||
$result = restrictedArea($user, 'projet', $id, 'projet&project');
|
||||
|
||||
$permissionnote = $user->rights->projet->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissionnote = $user->hasRight('projet', 'creer'); // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -240,8 +240,8 @@ if (empty($reshook)) {
|
|||
// Mass actions
|
||||
$objectclass = 'Task';
|
||||
$objectlabel = 'Tasks';
|
||||
$permissiontoread = $user->rights->projet->lire;
|
||||
$permissiontodelete = $user->rights->projet->supprimer;
|
||||
$permissiontoread = $user->hasRight('projet', 'lire');
|
||||
$permissiontodelete = $user->hasRight('projet', 'supprimer');
|
||||
$uploaddir = $conf->project->dir_output.'/tasks';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
|
@ -555,7 +555,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
$arrayofmassactions = array();
|
||||
if ($user->rights->projet->creer) {
|
||||
if ($user->hasRight('projet', 'creer')) {
|
||||
$arrayofmassactions['preclonetasks'] = img_picto('', 'rightarrow', 'class="pictofixedwidth"').$langs->trans("Clone");
|
||||
}
|
||||
if ($permissiontodelete) {
|
||||
|
|
@ -853,7 +853,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
|||
// Link to create task
|
||||
$linktocreatetaskParam = array();
|
||||
$linktocreatetaskUserRight = false;
|
||||
if ($user->rights->projet->all->creer || $user->rights->projet->creer) {
|
||||
if ($user->hasRight('projet', 'all', 'creer') || $user->hasRight('projet', 'creer')) {
|
||||
if ($object->public || $userWrite > 0) {
|
||||
$linktocreatetaskUserRight = true;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -140,9 +140,9 @@ $arrayfields['nb_products'] = array(
|
|||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$permissiontoread = $user->rights->variants->read;
|
||||
$permissiontoadd = $user->rights->variants->write;
|
||||
$permissiontodelete = $user->rights->variants->delete;
|
||||
$permissiontoread = $user->hasRight('variants', 'read');
|
||||
$permissiontoadd = $user->hasRight('variants', 'write');
|
||||
$permissiontodelete = $user->hasRight('variants', 'delete');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('variants')) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue