FIX using decimal on stock correction
Conflicts: htdocs/product/stock/product.php
This commit is contained in:
parent
2e609d448c
commit
2e7f588cac
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
@ -67,8 +67,8 @@ $stocklimit = GETPOST('seuil_stock_alerte');
|
|||||||
$desiredstock = GETPOST('desiredstock');
|
$desiredstock = GETPOST('desiredstock');
|
||||||
$cancel = GETPOST('cancel', 'alpha');
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
$fieldid = isset($_GET["ref"]) ? 'ref' : 'rowid';
|
$fieldid = isset($_GET["ref"]) ? 'ref' : 'rowid';
|
||||||
$d_eatby = dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']);
|
$d_eatby = dol_mktime(0, 0, 0, GETPOST('eatbymonth', 'int'), GETPOST('eatbyday', 'int'), GETPOST('eatbyyear', 'int'));
|
||||||
$d_sellby = dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
|
$d_sellby = dol_mktime(0, 0, 0, GETPOST('sellbymonth', 'int'), GETPOST('sellbyday', 'int'), GETPOST('sellbyyear', 'int'));
|
||||||
$pdluoid = GETPOST('pdluoid', 'int');
|
$pdluoid = GETPOST('pdluoid', 'int');
|
||||||
$batchnumber = GETPOST('batch_number', 'san_alpha');
|
$batchnumber = GETPOST('batch_number', 'san_alpha');
|
||||||
if (!empty($batchnumber)) {
|
if (!empty($batchnumber)) {
|
||||||
@ -224,7 +224,8 @@ if ($action == "correct_stock" && !$cancel)
|
|||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$priceunit = price2num(GETPOST("unitprice"));
|
$priceunit = price2num(GETPOST("unitprice"));
|
||||||
if (is_numeric(GETPOST("nbpiece")) && $id)
|
$nbpiece = price2num(GETPOST("nbpiece", 'alphanohtml'));
|
||||||
|
if (is_numeric($nbpiece) && $nbpiece != 0 && $id)
|
||||||
{
|
{
|
||||||
$origin_element = '';
|
$origin_element = '';
|
||||||
$origin_id = null;
|
$origin_id = null;
|
||||||
@ -243,15 +244,15 @@ if ($action == "correct_stock" && !$cancel)
|
|||||||
{
|
{
|
||||||
$result = $object->correct_stock_batch(
|
$result = $object->correct_stock_batch(
|
||||||
$user,
|
$user,
|
||||||
GETPOST("id_entrepot"),
|
GETPOST("id_entrepot", 'int'),
|
||||||
GETPOST("nbpiece"),
|
$nbpiece,
|
||||||
GETPOST("mouvement"),
|
GETPOST("mouvement", 'int'),
|
||||||
GETPOST("label"), // label movement
|
GETPOST("label", 'alphanohtml'), // label movement
|
||||||
$priceunit,
|
$priceunit,
|
||||||
$d_eatby,
|
$d_eatby,
|
||||||
$d_sellby,
|
$d_sellby,
|
||||||
$batchnumber,
|
$batchnumber,
|
||||||
GETPOST('inventorycode'),
|
GETPOST('inventorycode', 'alphanohtml'),
|
||||||
$origin_element,
|
$origin_element,
|
||||||
$origin_id
|
$origin_id
|
||||||
); // We do not change value of stock for a correction
|
); // We do not change value of stock for a correction
|
||||||
@ -260,12 +261,12 @@ if ($action == "correct_stock" && !$cancel)
|
|||||||
{
|
{
|
||||||
$result = $object->correct_stock(
|
$result = $object->correct_stock(
|
||||||
$user,
|
$user,
|
||||||
GETPOST("id_entrepot"),
|
GETPOST("id_entrepot", 'int'),
|
||||||
GETPOST("nbpiece"),
|
$nbpiece,
|
||||||
GETPOST("mouvement"),
|
GETPOST("mouvement", 'int'),
|
||||||
GETPOST("label"),
|
GETPOST("label", 'alphanohtml'),
|
||||||
$priceunit,
|
$priceunit,
|
||||||
GETPOST('inventorycode'),
|
GETPOST('inventorycode', 'alphanohtml'),
|
||||||
$origin_element,
|
$origin_element,
|
||||||
$origin_id
|
$origin_id
|
||||||
); // We do not change value of stock for a correction
|
); // We do not change value of stock for a correction
|
||||||
@ -343,6 +344,8 @@ if ($action == "transfert_stock" && !$cancel)
|
|||||||
if (isset($object->pmp)) $pricesrc = $object->pmp;
|
if (isset($object->pmp)) $pricesrc = $object->pmp;
|
||||||
$pricedest = $pricesrc;
|
$pricedest = $pricesrc;
|
||||||
|
|
||||||
|
$nbpiece = price2num(GETPOST("nbpiece", 'alphanohtml'));
|
||||||
|
|
||||||
if ($object->hasbatch())
|
if ($object->hasbatch())
|
||||||
{
|
{
|
||||||
$pdluo = new Productbatch($db);
|
$pdluo = new Productbatch($db);
|
||||||
@ -377,12 +380,12 @@ if ($action == "transfert_stock" && !$cancel)
|
|||||||
$result1 = $object->correct_stock_batch(
|
$result1 = $object->correct_stock_batch(
|
||||||
$user,
|
$user,
|
||||||
$srcwarehouseid,
|
$srcwarehouseid,
|
||||||
GETPOST("nbpiece", 'int'),
|
$nbpiece,
|
||||||
1,
|
1,
|
||||||
GETPOST("label", 'san_alpha'),
|
GETPOST("label", 'alphanohtml'),
|
||||||
$pricesrc,
|
$pricesrc,
|
||||||
$eatby, $sellby, $batch,
|
$eatby, $sellby, $batch,
|
||||||
GETPOST('inventorycode')
|
GETPOST('inventorycode', 'alphanohtml')
|
||||||
);
|
);
|
||||||
if ($result1 < 0) $error++;
|
if ($result1 < 0) $error++;
|
||||||
}
|
}
|
||||||
@ -392,12 +395,12 @@ if ($action == "transfert_stock" && !$cancel)
|
|||||||
$result2 = $object->correct_stock_batch(
|
$result2 = $object->correct_stock_batch(
|
||||||
$user,
|
$user,
|
||||||
GETPOST("id_entrepot_destination", 'int'),
|
GETPOST("id_entrepot_destination", 'int'),
|
||||||
GETPOST("nbpiece", 'int'),
|
$nbpiece,
|
||||||
0,
|
0,
|
||||||
GETPOST("label", 'san_alpha'),
|
GETPOST("label", 'alphanohtml'),
|
||||||
$pricedest,
|
$pricedest,
|
||||||
$eatby, $sellby, $batch,
|
$eatby, $sellby, $batch,
|
||||||
GETPOST('inventorycode')
|
GETPOST('inventorycode', 'alphanohtml')
|
||||||
);
|
);
|
||||||
if ($result2 < 0) $error++;
|
if ($result2 < 0) $error++;
|
||||||
}
|
}
|
||||||
@ -409,12 +412,12 @@ if ($action == "transfert_stock" && !$cancel)
|
|||||||
// Remove stock
|
// Remove stock
|
||||||
$result1 = $object->correct_stock(
|
$result1 = $object->correct_stock(
|
||||||
$user,
|
$user,
|
||||||
GETPOST("id_entrepot"),
|
GETPOST("id_entrepot", 'int'),
|
||||||
GETPOST("nbpiece"),
|
$nbpiece,
|
||||||
1,
|
1,
|
||||||
GETPOST("label"),
|
GETPOST("label", 'alphanohtml'),
|
||||||
$pricesrc,
|
$pricesrc,
|
||||||
GETPOST('inventorycode')
|
GETPOST('inventorycode', 'alphanohtml')
|
||||||
);
|
);
|
||||||
if ($result1 < 0) $error++;
|
if ($result1 < 0) $error++;
|
||||||
}
|
}
|
||||||
@ -423,12 +426,12 @@ if ($action == "transfert_stock" && !$cancel)
|
|||||||
// Add stock
|
// Add stock
|
||||||
$result2 = $object->correct_stock(
|
$result2 = $object->correct_stock(
|
||||||
$user,
|
$user,
|
||||||
GETPOST("id_entrepot_destination"),
|
GETPOST("id_entrepot_destination", 'int'),
|
||||||
GETPOST("nbpiece"),
|
$nbpiece,
|
||||||
0,
|
0,
|
||||||
GETPOST("label"),
|
GETPOST("label", 'alphanohtml'),
|
||||||
$pricedest,
|
$pricedest,
|
||||||
GETPOST('inventorycode')
|
GETPOST('inventorycode', 'alphanohtml')
|
||||||
);
|
);
|
||||||
if ($result2 < 0) $error++;
|
if ($result2 < 0) $error++;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user