Update card.php

This commit is contained in:
Laurent Destailleur 2018-03-10 12:52:09 +01:00 committed by GitHub
parent a7f82af352
commit 64f2f324de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,6 +75,16 @@ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
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
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
$permissiontoadd = $user->rights->stock->write;
$permissiontodelete = $user->rights->stock->write;
}
else
{
$permissiontoadd = $user->rights->stock->advance_inventory->create;
$permissiontodelete = $user->rights->stock->advance_inventory->write;
}
/*
@ -89,16 +99,6 @@ if (empty($reshook))
{
$error=0;
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
$permissiontoadd = $user->rights->stock->write;
$permissiontodelete = $user->rights->stock->write;
}
else
{
$permissiontoadd = $user->rights->stock->advance_inventory->create;
$permissiontodelete = $user->rights->stock->advance_inventory->write;
}
$backurlforlist = DOL_URL_ROOT.'/product/inventory/list.php';
// Actions cancel, add, update or delete
@ -344,7 +344,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Send
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
if ($user->rights->stock->advance_inventory->write)
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
}
@ -353,7 +353,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
}
if ($user->rights->stock->advance_inventory->write)
if ($permissiontodelete)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'."\n";
}