Fix : php 8.1 warnings

This commit is contained in:
hystepik 2022-12-09 14:27:43 +01:00
parent 5f3e231d13
commit d8ce58811a
16 changed files with 57 additions and 55 deletions

View File

@ -101,14 +101,14 @@ if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer);
$canadduser = ($user->admin || $user->hasRight("user", "user", "creer"));
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
$caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight("user", "self", "creer"))
|| (($user->id != $object->user_id) && $user->hasRight("user", "user", "creer")));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight("user", "self", "password"))
|| (($user->id != $object->user_id) && $user->hasRight("user", "user", "password")));
}
}
@ -641,7 +641,7 @@ if ($rowid > 0) {
print '</td>';
if ($action != 'editlogin' && $user->hasRight('adherent', 'creer')) {
print '<td class="right">';
if ($user->rights->user->user->creer) {
if ($user->hasRight("user", "user", "creer")) {
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editlogin&token='.newToken().'&rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).'</a>';
}
print '</td>';

View File

@ -1433,7 +1433,7 @@ class ActionComm extends CommonObject
$response->label = $langs->trans("ActionsToDo");
$response->labelShort = $langs->trans("ActionsToDoShort");
$response->url = DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&actioncode=0&status=todo&mainmenu=agenda';
if ($user->rights->agenda->allactions->read) {
if ($user->hasRight("agenda", "allactions", "read")) {
$response->url .= '&filtert=-1';
}
$response->img = img_object('', "action", 'class="inline-block valigntextmiddle"');

View File

@ -76,7 +76,7 @@ class box_bookmarks extends ModeleBoxes
'text' => $langs->trans("BoxMyLastBookmarks", $max),
'sublink' => DOL_URL_ROOT.'/bookmarks/list.php',
);
if ($user->rights->bookmark->creer) {
if ($user->hasRight("bookmark", "creer")) {
$this->info_box_head['subpicto'] = 'bookmark';
$this->info_box_head['subtext'] = $langs->trans("BookmarksManagement");
} else {
@ -121,7 +121,7 @@ class box_bookmarks extends ModeleBoxes
if ($num == 0) {
$mytxt = $langs->trans("NoRecordedBookmarks");
if ($user->rights->bookmark->creer) {
if ($user->hasRight("bookmark", "creer")) {
$mytxt .= ' '.$langs->trans("ClickToAdd");
}
$this->info_box_contents[$line][0] = array(

View File

@ -807,11 +807,11 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
$i = -1;
if (isModEnabled('project') && $user->rights->projet->lire) {
if (isModEnabled('project') && $user->hasRight('projet', 'lire')) {
$langs->load("projects");
$newcardbutton = '';
if (isModEnabled('project') && $user->rights->projet->creer && empty($nocreatelink)) {
if (isModEnabled('project') && $user->hasRight('projet', 'creer') && empty($nocreatelink)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('AddProject'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage));
}
@ -1062,7 +1062,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
$arrayfields = dol_sort_array($arrayfields, 'position');
$newcardbutton = '';
if ($user->rights->societe->contact->creer) {
if ($user->hasRight('societe', 'contact', 'creer')) {
$addcontact = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
$newcardbutton .= dolGetButtonTitle($addcontact, '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage));
}
@ -1363,14 +1363,14 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
print '<td align="right">';
// Add to agenda
if (isModEnabled('agenda')&& $user->rights->agenda->myactions->create) {
if (isModEnabled('agenda')&& $user->hasRight('agenda', 'myactions', 'create')) {
print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&actioncode=&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
print img_object($langs->trans("Event"), "action");
print '</a> &nbsp; ';
}
// Edit
if ($user->rights->societe->contact->creer) {
if ($user->hasRight('societe', 'contact', 'creer')) {
print '<a class="editfielda paddingleft" href="'.DOL_URL_ROOT.'/contact/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($backtopage).'">';
print img_edit();
print '</a>';

View File

@ -2209,7 +2209,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
}
if ($object->element == 'societe') {
if (!empty($conf->use_javascript_ajax) && $user->rights->societe->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
if (!empty($conf->use_javascript_ajax) && $user->hasRight('societe', 'creer') && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
$morehtmlstatus .= ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased');
} else {
$morehtmlstatus .= $object->getLibStatut(6);
@ -3041,7 +3041,7 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
$newemail .= img_warning($langs->trans("ErrorBadEMail", $email));
}
if (($cid || $socid) && isModEnabled('agenda') && $user->rights->agenda->myactions->create) {
if (($cid || $socid) && isModEnabled('agenda') && $user->hasRight("agenda", "myactions", "create")) {
$type = 'AC_EMAIL';
$link = '';
if (!empty($conf->global->AGENDA_ADDACTIONFOREMAIL)) {
@ -3484,7 +3484,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
}
//if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
if (isModEnabled('agenda') && $user->rights->agenda->myactions->create) {
if (isModEnabled('agenda') && $user->hasRight("agenda", "myactions", "create")) {
$type = 'AC_TEL';
$link = '';
if ($addlink == 'AC_FAX') {
@ -11813,7 +11813,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone = '';
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) {
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->dp > $now)) {
$tododone = 'todo';
}

View File

@ -232,9 +232,9 @@ if ($object->id > 0) {
$langs->load('compta');
print '<tr>';
print '<td>';
print $form->editfieldkey("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
print $form->editfieldkey("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->hasRight('societe', 'creer'));
print '</td><td>';
print $form->editfieldval("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
print $form->editfieldval("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->hasRight('societe', 'creer'));
print '</td>';
print '</tr>';
}
@ -272,7 +272,7 @@ if ($object->id > 0) {
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('PaymentConditions');
print '<td>';
if (($action != 'editconditions') && $user->rights->societe->creer) {
if (($action != 'editconditions') && $user->hasRight('societe', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
}
print '</tr></table>';
@ -290,7 +290,7 @@ if ($object->id > 0) {
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentMode');
print '<td>';
if (($action != 'editmode') && $user->rights->societe->creer) {
if (($action != 'editmode') && $user->hasRight('societe', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
}
print '</tr></table>';
@ -309,7 +309,7 @@ if ($object->id > 0) {
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentBankAccount');
print '<td>';
if (($action != 'editbankaccount') && $user->rights->societe->creer) {
if (($action != 'editbankaccount') && $user->hasRight('societe', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
}
print '</tr></table>';
@ -328,7 +328,7 @@ if ($object->id > 0) {
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans("CustomerRelativeDiscountShort");
print '<td><td class="right">';
if ($user->rights->societe->creer && !$user->socid > 0) {
if ($user->hasRight('societe', 'creer') && !$user->socid > 0) {
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create&token='.newToken().'">'.img_edit($langs->trans("Modify")).'</a>';
}
print '</td></tr></table>';
@ -341,7 +341,7 @@ if ($object->id > 0) {
print '<tr><td class="nowrap">';
print $langs->trans("CustomerAbsoluteDiscountShort");
print '<td><td class="right">';
if ($user->rights->societe->creer && !$user->socid > 0) {
if ($user->hasRight('societe', 'creer') && !$user->socid > 0) {
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create&token='.newToken().'">'.img_edit($langs->trans("Modify")).'</a>';
}
print '</td></tr></table>';
@ -881,7 +881,7 @@ if ($object->id > 0) {
}
}
if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) {
if ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer')) {
$langs->load("orders");
if ($object->status == 1) {
print dolGetButtonAction('', $langs->trans('AddSupplierOrderShort'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&amp;token='.newToken().'&amp;socid='.$object->id, '');
@ -890,7 +890,7 @@ if ($object->id > 0) {
}
}
if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')) {
if (!empty($orders2invoice) && $orders2invoice > 0) {
if ($object->status == 1) {
// Company is open
@ -903,7 +903,7 @@ if ($object->id > 0) {
}
}
if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')) {
$langs->load("bills");
if ($object->status == 1) {
print dolGetButtonAction('', $langs->trans('AddBill'), 'default', DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;socid='.$object->id, '');

View File

@ -2123,7 +2123,7 @@ class Project extends CommonObject
$projectsListId = null;
if (!$user->rights->projet->all->lire) {
if (!$user->hasRight("projet", "all", "lire")) {
$response->url = DOL_URL_ROOT.'/projet/list.php?search_status=1&mainmenu=project';
$projectsListId = $this->getProjectsAuthorizedForUser($user, 0, 1);
if (empty($projectsListId)) {

View File

@ -2226,7 +2226,7 @@ class Task extends CommonObjectLine
$response = new WorkboardResponse();
$response->warning_delay = $conf->project->task->warning_delay / 60 / 60 / 24;
$response->label = $langs->trans("OpenedTasks");
if ($user->rights->projet->all->lire) {
if ($user->hasRight("projet", "all", "lire")) {
$response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mainmenu=project';
} else {
$response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mode=mine&amp;mainmenu=project';

View File

@ -138,10 +138,10 @@ if (!empty($canvas)) {
// Permissions
$permissiontoread = $user->hasRight('societe', 'lire');
$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontoadd = $user->hasRight('societe', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$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
$permissionnote = $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->hasRight('societe', 'creer'); // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1];
// Security check
@ -978,7 +978,7 @@ if (empty($reshook)) {
// Actions to build doc
$id = $socid;
$upload_dir = !empty($conf->societe->multidir_output[$object->entity])?$conf->societe->multidir_output[$object->entity]:$conf->societe->dir_output;
$permissiontoadd = $user->rights->societe->creer;
$permissiontoadd = $user->hasRight('societe', 'creer');
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
}
@ -3018,7 +3018,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Third-Party Type
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans('ThirdPartyType').'</td>';
if ($action != 'editthirdpartytype' && $user->rights->societe->creer) {
if ($action != 'editthirdpartytype' && $user->hasRight('societe', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editthirdpartytype&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
}
print '</tr></table>';
@ -3087,7 +3087,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (isModEnabled('incoterm')) {
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans('IncotermLabel').'</td>';
if ($action != 'editincoterm' && $user->rights->societe->creer) {
if ($action != 'editincoterm' && $user->hasRight('societe', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=editincoterm&token='.newToken().'">'.img_edit('', 1).'</a></td>';
}
print '</tr></table>';
@ -3151,7 +3151,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) {
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans('ParentCompany').'</td>';
if ($action != 'editparentcompany' && $user->rights->societe->creer) {
if ($action != 'editparentcompany' && $user->hasRight('societe', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editparentcompany&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
}
print '</tr></table>';
@ -3279,7 +3279,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->hasRight('societe', 'lire');
$delallowed = $user->rights->societe->creer;
$delallowed = $user->hasRight('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);
}

View File

@ -204,13 +204,13 @@ if ($object->fournisseur) {
$obj = $db->fetch_object($resql);
$nbCmdsFourn = $obj->nb;
$thirdTypeArray['supplier'] = $langs->trans("supplier");
if ((isModEnabled('fournisseur') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_invoice") && $user->rights->supplier_invoice->lire)) {
if ((isModEnabled('fournisseur') && $user->hasRight('fournisseur', 'facture', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
$elementTypeArray['supplier_invoice'] = $langs->transnoentitiesnoconv('SuppliersInvoices');
}
if ((isModEnabled('fournisseur') && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->rights->supplier_order->lire)) {
if ((isModEnabled('fournisseur') && $user->hasRight('fournisseur', 'commande', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire'))) {
$elementTypeArray['supplier_order'] = $langs->transnoentitiesnoconv('SuppliersOrders');
}
if (isModEnabled('supplier_proposal') && $user->rights->supplier_proposal->lire) {
if (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire')) {
$elementTypeArray['supplier_proposal'] = $langs->transnoentitiesnoconv('SupplierProposals');
}
}
@ -399,6 +399,7 @@ $typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPO
$button = '<input type="submit" class="button buttonform small" name="button_third" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
$total_qty = 0;
$param = '';
if ($sql_select) {
$resql = $db->query($sql);

View File

@ -83,7 +83,7 @@ if ($id > 0 || !empty($ref)) {
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('thirdpartydocument', 'globalcard'));
$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontoadd = $user->hasRight('societe', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
// Security check
if ($user->socid > 0) {
@ -187,8 +187,8 @@ print '</div>';
print dol_get_fiche_end();
$modulepart = 'societe';
$permissiontoadd = $user->rights->societe->creer;
$permtoedit = $user->rights->societe->creer;
$permissiontoadd = $user->hasRight('societe', 'creer');
$permtoedit = $user->hasRight('societe', 'creer');
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';

View File

@ -385,7 +385,7 @@ if (empty($reshook)) {
$objectlabel = 'ThirdParty';
$permissiontoread = $user->hasRight('societe', 'lire');
$permissiontodelete = $user->hasRight('societe', 'supprimer');
$permissiontoadd = $user->rights->societe->creer;
$permissiontoadd = $user->hasRight("societe", "creer");
$uploaddir = $conf->societe->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
@ -922,16 +922,16 @@ $arrayofmassactions = array(
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
);
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if (isModEnabled('category') && $user->rights->societe->creer) {
if (isModEnabled('category') && $user->hasRight("societe", "creer")) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if ($user->rights->societe->creer) {
if ($user->hasRight("societe", "creer")) {
$arrayofmassactions['preenable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToEnabled");
}
if ($user->rights->societe->creer) {
if ($user->hasRight("societe", "creer")) {
$arrayofmassactions['predisable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToDisabled");
}
if ($user->rights->societe->creer) {
if ($user->hasRight("societe", "creer")) {
$arrayofmassactions['presetcommercial'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("AllocateCommercial");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) {
@ -969,8 +969,8 @@ if ($contextpage != 'poslist') {
if (!empty($socid)) {
$url .= '&socid='.$socid;
}
$newcardbutton = dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->rights->societe->creer);
} elseif ($user->rights->societe->creer) {
$newcardbutton = dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->hasRight("societe", "creer"));
} elseif ($user->hasRight("societe", "creer")) {
$url = DOL_URL_ROOT.'/societe/card.php?action=create&type=t&contextpage=poslist&optioncss=print&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type=t&contextpage=poslist&nomassaction=1&optioncss=print&place='.$place);
$label = 'MenuNewCustomer';
$newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url);

View File

@ -48,7 +48,7 @@ if ($id > 0) {
}
// Permissions
$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
$permissionnote = $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('thirdpartynote', 'globalcard'));

View File

@ -306,7 +306,7 @@ if ($result > 0) {
while ($i < $num) {
$obj = $db->fetch_object($resql);
$contactstatic->id = $obj->contact_id;
$contactstatic->id = $obj->contactid;
$contactstatic->lastname = $obj->lastname;
$contactstatic->firstname = $obj->firstname;

View File

@ -80,7 +80,7 @@ $hookmanager->initHooks(array('thirdpartybancard', 'globalcard'));
// Permissions
$permissiontoread = $user->hasRight('societe', 'lire');
$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_builddoc.inc.php
$permissiontoadd = $user->hasRight('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)));
@ -111,6 +111,7 @@ if ($cancel) {
$action = '';
}
$morehtmlright = '';
$parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {

View File

@ -28,7 +28,7 @@ print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('SalesRepresentatives');
print '</td>';
if ($action != 'editsalesrepresentatives' && $user->rights->societe->creer) {
if ($action != 'editsalesrepresentatives' && $user->hasRight('societe', 'creer')) {
print '<td class="right">';
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editsalesrepresentatives&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
print '</td>';