mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
2990d71898
|
|
@ -108,9 +108,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
|
|||
if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
||||
$permissiontoadd = $user->hasRight('stock', 'creer');
|
||||
$permissiontodelete = $user->hasRight('stock', 'supprimer');
|
||||
$permissiontoupdatestock = $user->hasRight('stock', 'mouvement', 'creer');
|
||||
} else {
|
||||
$permissiontoadd = $user->hasRight('stock', 'inventory_advance', 'write');
|
||||
$permissiontodelete = $user->hasRight('stock', 'inventory_advance', 'write');
|
||||
$permissiontoupdatestock = $user->hasRight('stock', 'inventory_advance', 'write');
|
||||
}
|
||||
|
||||
$now = dol_now();
|
||||
|
|
@ -135,12 +137,12 @@ if ($reshook < 0) {
|
|||
if (empty($reshook)) {
|
||||
$error = 0;
|
||||
|
||||
if ($action == 'cancel_record' && $permissiontoadd) {
|
||||
if ($action == 'cancel_record' && $permissiontoupdatestock) {
|
||||
$object->setCanceled($user);
|
||||
}
|
||||
|
||||
// Close inventory by recording the stock movements
|
||||
if ($action == 'update' && $user->hasRight('stock', 'mouvement', 'creer') && $object->status == $object::STATUS_VALIDATED) {
|
||||
if ($action == 'update' && $permissiontoupdatestock && $object->status == $object::STATUS_VALIDATED) {
|
||||
$stockmovment = new MouvementStock($db);
|
||||
$stockmovment->setOrigin($object->element, $object->id);
|
||||
|
||||
|
|
@ -267,7 +269,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Save quantity found during inventory (when we click on Save button on inventory page)
|
||||
if ($action == 'updateinventorylines' && $permissiontoadd) {
|
||||
if ($action == 'updateinventorylines' && $permissiontoupdatestock) {
|
||||
$sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
|
||||
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id';
|
||||
|
|
@ -591,7 +593,7 @@ if ($action != 'record') {
|
|||
|
||||
if (empty($reshook)) {
|
||||
if ($object->status == Inventory::STATUS_DRAFT) {
|
||||
if ($permissiontoadd) {
|
||||
if ($permissiontoupdatestock) {
|
||||
if (getDolGlobalInt('INVENTORY_INCLUDE_SUB_WAREHOUSE') && !empty($object->fk_warehouse)) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=validate&token='.newToken().'">'.$langs->trans("Validate").' ('.$langs->trans("Start").')</a>';
|
||||
} else {
|
||||
|
|
@ -604,13 +606,13 @@ if ($action != 'record') {
|
|||
|
||||
// Save
|
||||
if ($object->status == $object::STATUS_VALIDATED) {
|
||||
if ($permissiontoadd) {
|
||||
if ($permissiontoupdatestock) {
|
||||
print '<a class="butAction classfortooltip" id="idbuttonmakemovementandclose" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=record&page='.$page.$paramwithsearch.'&token='.newToken().'" title="'.dol_escape_htmltag($langs->trans("MakeMovementsAndClose")).'">'.$langs->trans("MakeMovementsAndClose").'</a>'."\n";
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('MakeMovementsAndClose').'</a>'."\n";
|
||||
}
|
||||
|
||||
if ($permissiontoadd) {
|
||||
if ($permissiontoupdatestock) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_cancel&page='.$page.$paramwithsearch.'&token='.newToken().'">'.$langs->trans("Cancel").'</a>'."\n";
|
||||
}
|
||||
}
|
||||
|
|
@ -627,7 +629,7 @@ if ($action != 'record') {
|
|||
if ($object->status == Inventory::STATUS_VALIDATED) {
|
||||
print '<center>';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
if ($permissiontoadd) {
|
||||
if ($permissiontoupdatestock) {
|
||||
// Link to launch scan tool
|
||||
if (isModEnabled('barcode') || isModEnabled('productbatch')) {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=updatebyscaning&token='.currentToken().'" class="marginrightonly paddingright marginleftonly paddingleft">'.img_picto('', 'barcode', 'class="paddingrightonly"').$langs->trans("UpdateByScaning").'</a>';
|
||||
|
|
@ -665,7 +667,7 @@ if ($object->status == Inventory::STATUS_VALIDATED) {
|
|||
|
||||
// Popup for mass barcode scanning
|
||||
if ($action == 'updatebyscaning') {
|
||||
if ($permissiontoadd) {
|
||||
if ($permissiontoupdatestock) {
|
||||
// Output the javascript to manage the scanner tool.
|
||||
print '<script>';
|
||||
|
||||
|
|
@ -1001,7 +1003,11 @@ if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STAT
|
|||
}
|
||||
// Actions
|
||||
print '<td class="center">';
|
||||
print '<input type="submit" class="button paddingright" name="addline" value="'.$langs->trans("Add").'">';
|
||||
if ($permissiontoupdatestock) {
|
||||
print '<input type="submit" class="button paddingright" name="addline" value="'.$langs->trans("Add").'">';
|
||||
} else {
|
||||
print '<input type="submit" class="button paddingright" disabled="disabled" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'" name="addline" value="'.$langs->trans("Add").'">';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user