Fix: Add a protection if user has no option to edit stock
This commit is contained in:
parent
de64ce5b2a
commit
fa7e7c75bf
@ -65,6 +65,21 @@ if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL &&
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If stock decrease on bill validation, check user has stock edit permissions
|
||||||
|
if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL && ! empty($username))
|
||||||
|
{
|
||||||
|
$testuser=new User($db);
|
||||||
|
$testuser->fetch(0,$username);
|
||||||
|
$testuser->getrights('stock');
|
||||||
|
if (empty($testuser->rights->stock->creer))
|
||||||
|
{
|
||||||
|
$retour=$langs->trans("UserNeedPermissionToEditStockToUsePos");
|
||||||
|
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (! empty($_POST['txtUsername']) && ! empty($conf->banque->enabled) && (empty($conf_fkaccount_cash) && empty($conf_fkaccount_cheque) && empty($conf_fkaccount_cb)))
|
if (! empty($_POST['txtUsername']) && ! empty($conf->banque->enabled) && (empty($conf_fkaccount_cash) && empty($conf_fkaccount_cheque) && empty($conf_fkaccount_cb)))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -37,3 +37,4 @@ ShowCompany=Show company
|
|||||||
ShowStock=Show warehouse
|
ShowStock=Show warehouse
|
||||||
DeleteArticle=Click to remove this article
|
DeleteArticle=Click to remove this article
|
||||||
FilterRefOrLabelOrBC=Search (Ref/Label)
|
FilterRefOrLabelOrBC=Search (Ref/Label)
|
||||||
|
UserNeedPermissionToEditStockToUsePos=You ask to decrease stock on invoice creation, so user that use POS need to have permission to edit stock.
|
||||||
@ -37,3 +37,4 @@ ShowCompany=Voir société
|
|||||||
ShowStock=Voir entrepôt
|
ShowStock=Voir entrepôt
|
||||||
DeleteArticle=Cliquez pour enlever cet article
|
DeleteArticle=Cliquez pour enlever cet article
|
||||||
FilterRefOrLabelOrBC=Recherche (Ref/Lib.)
|
FilterRefOrLabelOrBC=Recherche (Ref/Lib.)
|
||||||
|
UserNeedPermissionToEditStockToUsePos=La configuration du module stock demande une réduction du stock sur facturation, aussi l'utilisateur du Point De Vente doit avoir les droits de modifier les stocks
|
||||||
@ -488,6 +488,7 @@ class User extends CommonObject
|
|||||||
* Clear all permissions array of user
|
* Clear all permissions array of user
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @see getrights
|
||||||
*/
|
*/
|
||||||
function clearrights()
|
function clearrights()
|
||||||
{
|
{
|
||||||
@ -503,6 +504,7 @@ class User extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param string $moduletag Limit permission for a particular module ('' by default means load all permissions)
|
* @param string $moduletag Limit permission for a particular module ('' by default means load all permissions)
|
||||||
* @return void
|
* @return void
|
||||||
|
* @see clearrights
|
||||||
*/
|
*/
|
||||||
function getrights($moduletag='')
|
function getrights($moduletag='')
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user