FIX : action buttons only if $permissiontoadd

This commit is contained in:
Gauthier PC portable 024 2021-10-20 09:32:03 +02:00
parent 4614b0dd65
commit 210926d23a

View File

@ -281,6 +281,7 @@ if (empty($reshook)) {
} }
} }
if($permissiontoadd) {
// Décrémentation // Décrémentation
if ($action == 'confirm_destock' && $confirm == 'yes' && $object->status == $object::STATUS_VALIDATED) { if ($action == 'confirm_destock' && $confirm == 'yes' && $object->status == $object::STATUS_VALIDATED) {
$lines = $object->getLinesArray(); $lines = $object->getLinesArray();
@ -364,6 +365,8 @@ if (empty($reshook)) {
setEventMessage('StockStransferIncrementedShortCancel', 'warnings'); setEventMessage('StockStransferIncrementedShortCancel', 'warnings');
} }
} }
}
// Set incoterm // Set incoterm
if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $permissiontoadd) { if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $permissiontoadd) {
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
@ -982,12 +985,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>'; print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>';
} }
} }
} elseif ($object->status == $object::STATUS_VALIDATED) { } elseif ($object->status == $object::STATUS_VALIDATED && $permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=destock">'.$langs->trans("StockTransferDecrementation").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=destock">'.$langs->trans("StockTransferDecrementation").'</a>';
} elseif ($object->status == $object::STATUS_TRANSFERED) { } elseif ($object->status == $object::STATUS_TRANSFERED && $permissiontoadd) {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=destockcancel">'.$langs->trans("StockTransferDecrementationCancel").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=destockcancel">'.$langs->trans("StockTransferDecrementationCancel").'</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=addstock">'.$langs->trans("StockTransferIncrementation").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=addstock">'.$langs->trans("StockTransferIncrementation").'</a>';
} elseif ($object->status == $object::STATUS_CLOSED) { } elseif ($object->status == $object::STATUS_CLOSED && $permissiontoadd) {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=addstockcancel">'.$langs->trans("StockTransferIncrementationCancel").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=addstockcancel">'.$langs->trans("StockTransferIncrementationCancel").'</a>';
} }