mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-05 16:42:53 +01:00
48 lines
917 B
PHP
48 lines
917 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;
|
|
}
|