dolibarr/htdocs/product/inventory/ajax/ajax.inventory.php
Scrutinizer Auto-Fixer 444c293c01 Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2020-04-10 08:59:32 +00:00

51 lines
919 B
PHP

<?php
require '../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php';
$get = GETPOST('get', 'alpha');
$put = GETPOST('put', 'alpha');
switch ($put)
{
case 'qty':
if (empty($user->rights->stock->creer)) { echo -1; exit; }
$fk_det_inventory = GETPOST('fk_det_inventory');
$det = new InventoryLine($db);
if ($det->fetch($fk_det_inventory))
{
$det->qty_view += GETPOST('qty');
$res = $det->update($user);
echo $det->qty_view;
}
else
{
echo -2;
}
break;
case 'pmp':
if (empty($user->rights->stock->creer) || empty($user->rights->stock->changePMP)) { echo -1; exit; }
$fk_det_inventory = GETPOST('fk_det_inventory');
$det = new InventoryLine($db);
if ($det->fetch($fk_det_inventory))
{
$det->new_pmp = price2num(GETPOST('pmp'));
$det->update($user);
echo $det->new_pmp;
}
else
{
echo -2;
}
break;
}